mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c.
This commit is contained in:
commit
1ef4f3befe
@ -185,6 +185,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_bug818118.js \
|
||||
browser_bug820497.js \
|
||||
browser_bug822367.js \
|
||||
browser_bug902156.js \
|
||||
browser_bug832435.js \
|
||||
browser_bug839103.js \
|
||||
browser_bug880101.js \
|
||||
@ -299,6 +300,10 @@ MOCHITEST_BROWSER_FILES = \
|
||||
file_bug822367_4B.html \
|
||||
file_bug822367_5.html \
|
||||
file_bug822367_6.html \
|
||||
file_bug902156_1.html \
|
||||
file_bug902156_2.html \
|
||||
file_bug902156_3.html \
|
||||
file_bug902156.js \
|
||||
file_fullscreen-window-open.html \
|
||||
healthreport_testRemoteCommands.html \
|
||||
moz.png \
|
||||
|
@ -5,7 +5,11 @@
|
||||
|
||||
const PREF_DISPLAY = "security.mixed_content.block_display_content";
|
||||
const PREF_ACTIVE = "security.mixed_content.block_active_content";
|
||||
|
||||
// We alternate for even and odd test cases to simulate different hosts
|
||||
const gHttpTestRoot = "https://example.com/browser/browser/base/content/test/";
|
||||
const gHttpTestRoot2 = "https://test1.example.com/browser/browser/base/content/test/";
|
||||
|
||||
var origBlockDisplay;
|
||||
var origBlockActive;
|
||||
var gTestBrowser = null;
|
||||
@ -62,7 +66,7 @@ function MixedTest1C() {
|
||||
//Mixed Display Test - Doorhanger should not appear
|
||||
function MixedTest2() {
|
||||
gTestBrowser.addEventListener("load", MixedTest2A, true);
|
||||
var url = gHttpTestRoot + "file_bug822367_2.html";
|
||||
var url = gHttpTestRoot2 + "file_bug822367_2.html";
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
|
||||
@ -102,7 +106,7 @@ function MixedTest3D() {
|
||||
function MixedTest4() {
|
||||
gTestBrowser.removeEventListener("load", MixedTest3B, true);
|
||||
gTestBrowser.addEventListener("load", MixedTest4A, true);
|
||||
var url = gHttpTestRoot + "file_bug822367_4.html";
|
||||
var url = gHttpTestRoot2 + "file_bug822367_4.html";
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
function MixedTest4A() {
|
||||
@ -152,7 +156,7 @@ function MixedTest5C() {
|
||||
function MixedTest6() {
|
||||
gTestBrowser.removeEventListener("load", MixedTest5B, true);
|
||||
gTestBrowser.addEventListener("load", MixedTest6A, true);
|
||||
var url = gHttpTestRoot + "file_bug822367_6.html";
|
||||
var url = gHttpTestRoot2 + "file_bug822367_6.html";
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
function MixedTest6A() {
|
||||
|
213
browser/base/content/test/browser_bug902156.js
Normal file
213
browser/base/content/test/browser_bug902156.js
Normal file
@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Description of the Tests for
|
||||
* - Bug 902156: Persist "disable protection" option for Mixed Content Blocker
|
||||
*
|
||||
* 1. Navigate to the same domain via document.location
|
||||
* - Load a html page which has mixed content
|
||||
* - Doorhanger to disable protection appears - we disable it
|
||||
* - Load a new page from the same origin using document.location
|
||||
* - Doorhanger should not appear anymore!
|
||||
*
|
||||
* 2. Navigate to the same domain via simulateclick for a link on the page
|
||||
* - Load a html page which has mixed content
|
||||
* - Doorhanger to disable protection appears - we disable it
|
||||
* - Load a new page from the same origin simulating a click
|
||||
* - Doorhanger should not appear anymore!
|
||||
*
|
||||
* 3. Navigate to a differnet domain and show the content is still blocked
|
||||
* - Load a different html page which has mixed content
|
||||
* - Doorhanger to disable protection should appear again because
|
||||
* we navigated away from html page where we disabled the protection.
|
||||
*
|
||||
* Note, for all tests we set gHttpTestRoot to use 'https'.
|
||||
*/
|
||||
|
||||
const PREF_ACTIVE = "security.mixed_content.block_active_content";
|
||||
|
||||
// We alternate for even and odd test cases to simulate different hosts
|
||||
const gHttpTestRoot1 = "https://test1.example.com/browser/browser/base/content/test/";
|
||||
const gHttpTestRoot2 = "https://test2.example.com/browser/browser/base/content/test/";
|
||||
|
||||
var origBlockActive;
|
||||
var gTestBrowser = null;
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
// Set preferences back to their original values
|
||||
Services.prefs.setBoolPref(PREF_ACTIVE, origBlockActive);
|
||||
});
|
||||
|
||||
function cleanUpAfterTests() {
|
||||
gBrowser.removeCurrentTab();
|
||||
window.focus();
|
||||
finish();
|
||||
}
|
||||
/*
|
||||
* Whenever we disable the Mixed Content Blocker of the page
|
||||
* we have to make sure that our condition is properly loaded.
|
||||
*/
|
||||
function waitForCondition(condition, nextTest, errorMsg) {
|
||||
var tries = 0;
|
||||
var interval = setInterval(function() {
|
||||
if (tries >= 30) {
|
||||
ok(false, errorMsg);
|
||||
moveOn();
|
||||
}
|
||||
if (condition()) {
|
||||
moveOn();
|
||||
}
|
||||
tries++;
|
||||
}, 100);
|
||||
var moveOn = function() {
|
||||
clearInterval(interval); nextTest();
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------ Test 1 ------------------------------
|
||||
|
||||
function test1A() {
|
||||
// Removing EventListener because we have to register a new
|
||||
// one once the page is loaded with mixed content blocker disabled
|
||||
gTestBrowser.removeEventListener("load", test1A, true);
|
||||
gTestBrowser.addEventListener("load", test1B, true);
|
||||
|
||||
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
|
||||
ok(notification, "OK: Mixed Content Doorhanger appeared in Test1A!");
|
||||
|
||||
// Disable Mixed Content Protection for the page
|
||||
notification.secondaryActions[0].callback();
|
||||
}
|
||||
|
||||
function test1B() {
|
||||
var expected = "Mixed Content Blocker disabled";
|
||||
waitForCondition(
|
||||
function() content.document.getElementById('mctestdiv').innerHTML == expected,
|
||||
test1C, "Error: Waited too long for mixed script to run in Test 1B");
|
||||
}
|
||||
|
||||
function test1C() {
|
||||
gTestBrowser.removeEventListener("load", test1B, true);
|
||||
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
||||
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 1C");
|
||||
|
||||
// The Script loaded after we disabled the page, now we are going to reload the
|
||||
// page and see if our decision is persistent
|
||||
gTestBrowser.addEventListener("load", test1D, true);
|
||||
|
||||
var url = gHttpTestRoot1 + "file_bug902156_2.html";
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
|
||||
function test1D() {
|
||||
gTestBrowser.removeEventListener("load", test1D, true);
|
||||
|
||||
// The Doorhanger should not appear, because our decision of disabling the
|
||||
// mixed content blocker is persistent.
|
||||
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
|
||||
ok(!notification, "OK: Mixed Content Doorhanger did not appear again in Test1D!");
|
||||
|
||||
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
||||
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 1D");
|
||||
|
||||
// move on to Test 2
|
||||
test2();
|
||||
}
|
||||
|
||||
//------------------------ Test 2 ------------------------------
|
||||
|
||||
function test2() {
|
||||
gTestBrowser.addEventListener("load", test2A, true);
|
||||
var url = gHttpTestRoot2 + "file_bug902156_2.html";
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
|
||||
function test2A() {
|
||||
// Removing EventListener because we have to register a new
|
||||
// one once the page is loaded with mixed content blocker disabled
|
||||
gTestBrowser.removeEventListener("load", test2A, true);
|
||||
gTestBrowser.addEventListener("load", test2B, true);
|
||||
|
||||
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
|
||||
ok(notification, "OK: Mixed Content Doorhanger appeared in Test 2A!");
|
||||
|
||||
// Disable Mixed Content Protection for the page
|
||||
notification.secondaryActions[0].callback();
|
||||
}
|
||||
|
||||
function test2B() {
|
||||
var expected = "Mixed Content Blocker disabled";
|
||||
waitForCondition(
|
||||
function() content.document.getElementById('mctestdiv').innerHTML == expected,
|
||||
test2C, "Error: Waited too long for mixed script to run in Test 2B");
|
||||
}
|
||||
|
||||
function test2C() {
|
||||
gTestBrowser.removeEventListener("load", test2B, true);
|
||||
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
||||
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 2C");
|
||||
|
||||
// The Script loaded after we disabled the page, now we are going to reload the
|
||||
// page and see if our decision is persistent
|
||||
gTestBrowser.addEventListener("load", test2D, true);
|
||||
|
||||
// reload the page using the provided link in the html file
|
||||
var mctestlink = content.document.getElementById("mctestlink");
|
||||
mctestlink.click();
|
||||
}
|
||||
|
||||
function test2D() {
|
||||
gTestBrowser.removeEventListener("load", test2D, true);
|
||||
|
||||
// The Doorhanger should not appear, because our decision of disabling the
|
||||
// mixed content blocker is persistent.
|
||||
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
|
||||
ok(!notification, "OK: Mixed Content Doorhanger did not appear again in Test2D!");
|
||||
|
||||
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
||||
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 2D");
|
||||
|
||||
// move on to Test 3
|
||||
test3();
|
||||
}
|
||||
|
||||
//------------------------ Test 3 ------------------------------
|
||||
|
||||
function test3() {
|
||||
gTestBrowser.addEventListener("load", test3A, true);
|
||||
var url = gHttpTestRoot1 + "file_bug902156_3.html";
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
|
||||
function test3A() {
|
||||
// Removing EventListener because we have to register a new
|
||||
// one once the page is loaded with mixed content blocker disabled
|
||||
gTestBrowser.removeEventListener("load", test3A, true);
|
||||
|
||||
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
|
||||
ok(notification, "OK: Mixed Content Doorhanger appeared in Test 3A!");
|
||||
|
||||
// We are done with tests, clean up
|
||||
cleanUpAfterTests();
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
|
||||
function test() {
|
||||
// Performing async calls, e.g. 'onload', we have to wait till all of them finished
|
||||
waitForExplicitFinish();
|
||||
|
||||
// Store original preferences so we can restore settings after testing
|
||||
origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
|
||||
|
||||
Services.prefs.setBoolPref(PREF_ACTIVE, true);
|
||||
|
||||
// Not really sure what this is doing
|
||||
var newTab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = newTab;
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
newTab.linkedBrowser.stop()
|
||||
|
||||
// Starting Test Number 1:
|
||||
gTestBrowser.addEventListener("load", test1A, true);
|
||||
var url = gHttpTestRoot1 + "file_bug902156_1.html";
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
5
browser/base/content/test/file_bug902156.js
Normal file
5
browser/base/content/test/file_bug902156.js
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Once the mixed content blocker is disabled for the page, this scripts loads
|
||||
* and updates the text inside the div container.
|
||||
*/
|
||||
document.getElementById("mctestdiv").innerHTML = "Mixed Content Blocker disabled";
|
15
browser/base/content/test/file_bug902156_1.html
Normal file
15
browser/base/content/test/file_bug902156_1.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test 1 for Bug 902156 - See file browser_bug902156.js for description.
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=902156
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test 1 for Bug 902156</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mctestdiv">Mixed Content Blocker enabled</div>
|
||||
<script src="http://test1.example.com/browser/browser/base/content/test/file_bug902156.js" ></script>
|
||||
</body>
|
||||
</html>
|
17
browser/base/content/test/file_bug902156_2.html
Normal file
17
browser/base/content/test/file_bug902156_2.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test 2 for Bug 902156 - See file browser_bug902156.js for description.
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=902156
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test 2 for Bug 902156</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mctestdiv">Mixed Content Blocker enabled</div>
|
||||
<a href="https://test2.example.com/browser/browser/base/content/test/file_bug902156_1.html"
|
||||
id="mctestlink" target="_top">Go to http site</a>
|
||||
<script src="http://test2.example.com/browser/browser/base/content/test/file_bug902156.js" ></script>
|
||||
</body>
|
||||
</html>
|
15
browser/base/content/test/file_bug902156_3.html
Normal file
15
browser/base/content/test/file_bug902156_3.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test 3 for Bug 902156 - See file browser_bug902156.js for description.
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=902156
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test 3 for Bug 902156</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mctestdiv">Mixed Content Blocker enabled</div>
|
||||
<script src="http://test1.example.com/browser/browser/base/content/test/file_bug902156.js" ></script>
|
||||
</body>
|
||||
</html>
|
@ -9,8 +9,6 @@
|
||||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsdbgapi.h"
|
||||
#include "nsIXPCSecurityManager.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsHashtable.h"
|
||||
@ -23,6 +21,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace JS {
|
||||
template <typename T> class Handle;
|
||||
template <typename T> class MutableHandle;
|
||||
}
|
||||
class nsIDocShell;
|
||||
class nsString;
|
||||
class nsIClassInfo;
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include "domstubs.idl"
|
||||
|
||||
%{C++
|
||||
#include "jsapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace indexedDB {
|
||||
|
@ -16,11 +16,6 @@ interface nsIGlobalObject;
|
||||
interface nsIInputStream;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
%{C++
|
||||
// for jsval
|
||||
#include "jsapi.h"
|
||||
%}
|
||||
|
||||
[scriptable, builtinclass, uuid(ac97e161-9f1d-4163-adc9-e9a59e18682c)]
|
||||
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
|
||||
// event handler attributes
|
||||
|
@ -22,7 +22,6 @@
|
||||
// Need this for BinaryType.
|
||||
#include "mozilla/dom/WebSocketBinding.h"
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
@ -927,7 +927,8 @@ nsContentUtils::ParseSandboxAttributeToFlags(const nsAString& aSandboxAttrValue)
|
||||
SANDBOXED_FORMS |
|
||||
SANDBOXED_SCRIPTS |
|
||||
SANDBOXED_AUTOMATIC_FEATURES |
|
||||
SANDBOXED_POINTER_LOCK;
|
||||
SANDBOXED_POINTER_LOCK |
|
||||
SANDBOXED_DOMAIN;
|
||||
|
||||
if (!aSandboxAttrValue.IsEmpty()) {
|
||||
// The separator optional flag is used because the HTML5 spec says any
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -135,7 +136,7 @@ class MOZ_STACK_CLASS SameProcessCpowHolder : public CpowHolder
|
||||
bool ToObject(JSContext* aCx, JSObject** aObjp);
|
||||
|
||||
private:
|
||||
JS::RootedObject mObj;
|
||||
JS::Rooted<JSObject*> mObj;
|
||||
};
|
||||
|
||||
class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
@ -60,4 +60,9 @@ const unsigned long SANDBOXED_AUTOMATIC_FEATURES = 0x40;
|
||||
* This flag blocks the document from acquiring pointerlock.
|
||||
*/
|
||||
const unsigned long SANDBOXED_POINTER_LOCK = 0x80;
|
||||
|
||||
/**
|
||||
* This flag blocks the document from changing document.domain.
|
||||
*/
|
||||
const unsigned long SANDBOXED_DOMAIN = 0x100;
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
@ -664,6 +664,8 @@ MOCHITEST_FILES_C= \
|
||||
file_CSP_bug802872.html^headers^ \
|
||||
file_CSP_bug802872.js \
|
||||
file_CSP_bug802872.sjs \
|
||||
test_bug907892.html \
|
||||
file_bug907892.html \
|
||||
$(NULL)
|
||||
|
||||
# OOP tests don't work on Windows (bug 763081) or native-fennec
|
||||
|
12
content/base/test/file_bug907892.html
Normal file
12
content/base/test/file_bug907892.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<script>
|
||||
var threw;
|
||||
try {
|
||||
document.domain = "example.org";
|
||||
threw = false;
|
||||
} catch (e) {
|
||||
threw = true;
|
||||
}
|
||||
var sandboxed = (location.search == "?sandboxed");
|
||||
parent.postMessage({ threw: threw, sandboxed: sandboxed }, "*");
|
||||
</script>
|
49
content/base/test/test_bug907892.html
Normal file
49
content/base/test/test_bug907892.html
Normal file
@ -0,0 +1,49 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=907892
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 907892</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 907892 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var expectedMessages = 2;
|
||||
window.onmessage = function (ev) {
|
||||
if (ev.data.sandboxed) {
|
||||
ok(ev.data.threw,
|
||||
"Should have thrown when setting document.domain in sandboxed iframe");
|
||||
} else {
|
||||
ok(!ev.data.threw,
|
||||
"Should not have thrown when setting document.domain in iframe");
|
||||
}
|
||||
|
||||
--expectedMessages;
|
||||
if (expectedMessages == 0) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=907892">Mozilla Bug 907892</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<!-- Set all the sandbox flags to "allow" to make sure we cover that case -->
|
||||
<iframe
|
||||
sandbox="allow-same-origin allow-scripts allow-forms allow-top-navigation alllow-pointer-lock"
|
||||
src="http://test1.example.org/tests/content/base/test/file_bug907892.html?sandboxed">
|
||||
</iframe>
|
||||
<iframe
|
||||
src="http://test1.example.org/tests/content/base/test/file_bug907892.html?normal">
|
||||
</iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -16,8 +16,6 @@
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -9,7 +9,12 @@
|
||||
#include "WebGLTypes.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
namespace JS {
|
||||
template <typename T> class Handle;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -87,6 +87,7 @@ MOCHITEST_FILES = \
|
||||
test_mozDashOffset.html \
|
||||
file_drawImage_document_domain.html \
|
||||
test_windingRuleUndefined.html \
|
||||
test_strokeText_throw.html \
|
||||
$(NULL)
|
||||
|
||||
# SkiaGL on Android/Gonk does not implement these composite ops yet
|
||||
|
68
content/canvas/test/test_strokeText_throw.html
Normal file
68
content/canvas/test/test_strokeText_throw.html
Normal file
@ -0,0 +1,68 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=728629
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 728629</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 728629 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function test() {
|
||||
var c = document.createElement('canvas');
|
||||
document.body.appendChild(c);
|
||||
try {
|
||||
c.getContext("2d").strokeText("Hello",NaN,50);
|
||||
ok(true, "strokeText should not throw with NaN.");
|
||||
} catch (e) {
|
||||
ok(false, "strokeText should not throw with NaN.");
|
||||
}
|
||||
try {
|
||||
c.getContext("2d").strokeText("Hello",Infinity,50);
|
||||
ok(true, "strokeText should not throw with Infinity.");
|
||||
} catch (e) {
|
||||
ok(false, "strokeText should not throw with Infinity.");
|
||||
}
|
||||
try {
|
||||
c.getContext("2d").strokeText("Hello",undefined,50);
|
||||
ok(true, "strokeText should not throw with undefined.");
|
||||
} catch (e) {
|
||||
ok(false, "strokeText should not throw with undefined.");
|
||||
}
|
||||
try {
|
||||
c.getContext("2d").fillText("Hello",NaN,50);
|
||||
ok(true, "fillText should not throw with NaN.");
|
||||
} catch (e) {
|
||||
ok(false, "fillText should not throw with NaN.");
|
||||
}
|
||||
try {
|
||||
c.getContext("2d").fillText("Hello",Infinity,50);
|
||||
ok(true, "fillText should not throw with Infinity.");
|
||||
} catch (e) {
|
||||
ok(false, "fillText should not throw with Infinity.");
|
||||
}
|
||||
try {
|
||||
c.getContext("2d").fillText("Hello",undefined,50);
|
||||
ok(true, "fillText should not throw with undefined.");
|
||||
} catch (e) {
|
||||
ok(false, "fillText should not throw with undefined.");
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="test();">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=728629">Mozilla Bug 728629</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -9,7 +9,6 @@
|
||||
#include "nsIDOMMessageEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/MessageEventBinding.h"
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,6 @@
|
||||
#ifndef nsEventListenerManager_h__
|
||||
#define nsEventListenerManager_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/EventListenerBinding.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Link.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "nsIHTMLCollection.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsGenericHTMLElement;
|
||||
class nsIDocument;
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "nsString.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
|
@ -1006,6 +1006,12 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain)
|
||||
void
|
||||
nsHTMLDocument::SetDomain(const nsAString& aDomain, ErrorResult& rv)
|
||||
{
|
||||
if (mSandboxFlags & SANDBOXED_DOMAIN) {
|
||||
// We're sandboxed; disallow setting domain
|
||||
rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aDomain.IsEmpty()) {
|
||||
rv.Throw(NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN);
|
||||
return;
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIScriptElement.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "pldhash.h"
|
||||
|
@ -366,6 +366,11 @@ MediaPluginReader::ImageBufferCallback::operator()(size_t aWidth, size_t aHeight
|
||||
rgbImage = mozilla::layers::CreateSharedRGBImage(mImageContainer,
|
||||
nsIntSize(aWidth, aHeight),
|
||||
gfxASurface::ImageFormatRGB16_565);
|
||||
if (!rgbImage) {
|
||||
NS_WARNING("Could not create rgb image");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mImage = rgbImage;
|
||||
return rgbImage->AsSharedImage()->GetBuffer();
|
||||
case MPAPI::YCbCr:
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsXBLPrototypeBinding;
|
||||
class nsIContent;
|
||||
|
@ -6,8 +6,6 @@
|
||||
#ifndef nsXBLMaybeCompiled_h__
|
||||
#define nsXBLMaybeCompiled_h__
|
||||
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
/*
|
||||
* A union containing either a pointer representing uncompiled source or a
|
||||
* JSObject* representing the compiled result. The class is templated on the
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsContentUtils.h" // For NS_CONTENT_DELETE_LIST_MEMBER.
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXBLMaybeCompiled.h"
|
||||
#include "nsXBLProtoImplMember.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXBLSerialize.h"
|
||||
#include "nsXBLMaybeCompiled.h"
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
class JSObject;
|
||||
class nsIDOMEvent;
|
||||
class nsIContent;
|
||||
@ -28,6 +26,10 @@ class nsIObjectInputStream;
|
||||
class nsIObjectOutputStream;
|
||||
class nsXBLPrototypeBinding;
|
||||
|
||||
namespace JS {
|
||||
template <typename T> class MutableHandle;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class EventTarget;
|
||||
|
@ -6,12 +6,15 @@
|
||||
#ifndef nsXBLSerialize_h__
|
||||
#define nsXBLSerialize_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
namespace JS {
|
||||
template <typename T> class Handle;
|
||||
template <typename T> class MutableHandle;
|
||||
}
|
||||
|
||||
typedef uint8_t XBLBindingSerializeDetails;
|
||||
|
||||
// A version number to ensure we don't load cached data in a different
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyledElement.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "jspubtd.h"
|
||||
#include "nsFrameLoader.h"
|
||||
|
||||
class nsIDocument;
|
||||
|
@ -17,11 +17,8 @@
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIStorageStream.h"
|
||||
|
||||
#include "jspubtd.h"
|
||||
|
||||
#include "mozilla/scache/StartupCache.h"
|
||||
|
||||
|
||||
class nsCSSStyleSheet;
|
||||
|
||||
/**
|
||||
|
@ -9552,9 +9552,20 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
||||
if (mLoadType == LOAD_RELOAD_ALLOW_MIXED_CONTENT) {
|
||||
rv = SetMixedContentChannel(channel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
rv = SetMixedContentChannel(nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else if (mMixedContentChannel) {
|
||||
/*
|
||||
* If the user "Disables Protection on This Page", we call
|
||||
* SetMixedContentChannel for the first time, otherwise
|
||||
* mMixedContentChannel is still null.
|
||||
* Later, if the new channel passes a same orign check, we remember the
|
||||
* users decision by calling SetMixedContentChannel using the new channel.
|
||||
* This way, the user does not have to click the disable protection button
|
||||
* over and over for browsing the same site.
|
||||
*/
|
||||
rv = nsContentUtils::CheckSameOrigin(mMixedContentChannel, channel);
|
||||
if (NS_FAILED(rv) || NS_FAILED(SetMixedContentChannel(channel))) {
|
||||
SetMixedContentChannel(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
//hack
|
||||
|
@ -5,8 +5,6 @@
|
||||
#ifndef StructuredCloneTags_h__
|
||||
#define StructuredCloneTags_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef mozilla_dom_WindowNamedPropertiesHandler_h
|
||||
#define mozilla_dom_WindowNamedPropertiesHandler_h
|
||||
|
||||
#include "jsproxy.h"
|
||||
#include "mozilla/dom/DOMJSProxyHandler.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -266,7 +266,7 @@ public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
|
||||
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
virtual void PreserveWrapper(nsISupports *aNative) MOZ_OVERRIDE;
|
||||
|
||||
@ -355,12 +355,12 @@ protected:
|
||||
public:
|
||||
NS_IMETHOD CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t mode,
|
||||
jsval *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
|
||||
NS_IMETHODIMP AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval);
|
||||
JSObject *obj, jsid id, JS::Value *vp, bool *_retval);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
@ -419,7 +419,7 @@ protected:
|
||||
|
||||
public:
|
||||
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
// Not implemented, nothing should create an instance of this class.
|
||||
@ -443,7 +443,7 @@ public:
|
||||
static bool DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
unsigned flags, JS::MutableHandle<JSObject*> objp);
|
||||
static void ReleaseDocument(JSFreeOp *fop, JSObject *obj);
|
||||
static bool CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp);
|
||||
static bool CallToGetPropMapper(JSContext *cx, unsigned argc, JS::Value *vp);
|
||||
};
|
||||
|
||||
|
||||
@ -465,7 +465,7 @@ protected:
|
||||
|
||||
public:
|
||||
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
|
||||
@ -489,7 +489,7 @@ public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
@ -611,13 +611,13 @@ protected:
|
||||
JSObject *obj, jsid id, uint32_t flags,
|
||||
JSObject **objp, bool *_retval) MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE;
|
||||
NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, bool *_retval) MOZ_OVERRIDE;
|
||||
NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, uint32_t enum_op, jsval *statep,
|
||||
JSObject *obj, uint32_t enum_op, JS::Value *statep,
|
||||
jsid *idp, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
@ -676,7 +676,7 @@ public:
|
||||
JSObject *obj, const JS::CallArgs &args, bool *_retval) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, const jsval &val, bool *bp,
|
||||
JSObject *obj, const JS::Value &val, bool *bp,
|
||||
bool *_retval);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -6,7 +6,6 @@
|
||||
#ifndef nsDOMJSUtils_h__
|
||||
#define nsDOMJSUtils_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIJSArgArray;
|
||||
|
@ -184,6 +184,7 @@
|
||||
#endif
|
||||
#include "prlog.h"
|
||||
#include "prenv.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#include "mozilla/dom/indexedDB/IDBFactory.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define nsIJSEventListener_h__
|
||||
|
||||
#include "nsIScriptContext.h"
|
||||
#include "jsapi.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define nsIJSNativeInitializer_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
#define NS_IJSNATIVEINITIALIZER_IID \
|
||||
{ 0xdb48eee5, 0x89a4, 0x4f18, \
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIProgrammingLanguage.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "jspubtd.h"
|
||||
#include "js/GCAPI.h"
|
||||
|
||||
|
@ -698,6 +698,7 @@ static const char js_baselinejit_eager_str[] = JS_OPTIONS_DOT_STR "baselinejit.
|
||||
static const char js_ion_content_str[] = JS_OPTIONS_DOT_STR "ion.content";
|
||||
static const char js_ion_chrome_str[] = JS_OPTIONS_DOT_STR "ion.chrome";
|
||||
static const char js_ion_eager_str[] = JS_OPTIONS_DOT_STR "ion.unsafe_eager_compilation";
|
||||
static const char js_parallel_parsing_str[] = JS_OPTIONS_DOT_STR "parallel_parsing";
|
||||
static const char js_ion_parallel_compilation_str[] = JS_OPTIONS_DOT_STR "ion.parallel_compilation";
|
||||
|
||||
int
|
||||
@ -739,6 +740,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
js_ion_content_str);
|
||||
bool useIonEager = Preferences::GetBool(js_ion_eager_str);
|
||||
bool useAsmJS = Preferences::GetBool(js_asmjs_content_str);
|
||||
bool parallelParsing = Preferences::GetBool(js_parallel_parsing_str);
|
||||
bool parallelIonCompilation = Preferences::GetBool(js_ion_parallel_compilation_str);
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
|
||||
if (xr) {
|
||||
@ -793,7 +795,8 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
|
||||
::JS_SetOptions(context->mContext, newDefaultJSOptions & JSOPTION_MASK);
|
||||
|
||||
::JS_SetParallelCompilationEnabled(context->mContext, parallelIonCompilation);
|
||||
::JS_SetParallelParsingEnabled(context->mContext, parallelParsing);
|
||||
::JS_SetParallelIonCompilationEnabled(context->mContext, parallelIonCompilation);
|
||||
|
||||
::JS_SetGlobalCompilerOption(context->mContext, JSCOMPILER_BASELINE_USECOUNT_TRIGGER,
|
||||
(useBaselineJITEager ? 0 : -1));
|
||||
|
@ -8,8 +8,6 @@
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "prtime.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -174,6 +174,13 @@ nsScriptNameSpaceManager::AddToHash(PLDHashTable *aTable, const nsAString *aKey,
|
||||
return &entry->mGlobalName;
|
||||
}
|
||||
|
||||
void
|
||||
nsScriptNameSpaceManager::RemoveFromHash(PLDHashTable *aTable,
|
||||
const nsAString *aKey)
|
||||
{
|
||||
PL_DHashTableOperate(aTable, aKey, PL_DHASH_REMOVE);
|
||||
}
|
||||
|
||||
nsGlobalNameStruct*
|
||||
nsScriptNameSpaceManager::GetConstructorProto(const nsGlobalNameStruct* aStruct)
|
||||
{
|
||||
@ -392,6 +399,7 @@ nsScriptNameSpaceManager::Init()
|
||||
|
||||
if (serv) {
|
||||
serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID, true);
|
||||
serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID, true);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -615,10 +623,12 @@ nsScriptNameSpaceManager::RegisterDOMCIData(const char *aName,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry)
|
||||
nsScriptNameSpaceManager::OperateCategoryEntryHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry,
|
||||
bool aRemove)
|
||||
{
|
||||
MOZ_ASSERT(aCategoryManager);
|
||||
// Get the type from the category name.
|
||||
// NOTE: we could have passed the type in FillHash() and guessed it in
|
||||
// Observe() but this way, we have only one place to update and this is
|
||||
@ -650,6 +660,31 @@ nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryMa
|
||||
nsresult rv = strWrapper->GetData(categoryEntry);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PLDHashTable *table;
|
||||
if (type == nsGlobalNameStruct::eTypeNavigatorProperty) {
|
||||
table = &mNavigatorNames;
|
||||
} else {
|
||||
table = &mGlobalNames;
|
||||
}
|
||||
|
||||
// We need to handle removal before calling GetCategoryEntry
|
||||
// because the category entry is already removed before we are
|
||||
// notified.
|
||||
if (aRemove) {
|
||||
NS_ConvertASCIItoUTF16 entry(categoryEntry);
|
||||
const nsGlobalNameStruct *s =
|
||||
type == nsGlobalNameStruct::eTypeNavigatorProperty ?
|
||||
LookupNavigatorName(entry) : LookupNameInternal(entry);
|
||||
// Verify mType so that this API doesn't remove names
|
||||
// registered by others.
|
||||
if (!s || s->mType != type) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RemoveFromHash(table, &entry);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsXPIDLCString contractId;
|
||||
rv = aCategoryManager->GetCategoryEntry(aCategory, categoryEntry.get(),
|
||||
getter_Copies(contractId));
|
||||
@ -709,13 +744,6 @@ nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryMa
|
||||
}
|
||||
}
|
||||
|
||||
PLDHashTable *table;
|
||||
if (type == nsGlobalNameStruct::eTypeNavigatorProperty) {
|
||||
table = &mNavigatorNames;
|
||||
} else {
|
||||
table = &mGlobalNames;
|
||||
}
|
||||
|
||||
nsGlobalNameStruct *s = AddToHash(table, categoryEntry.get());
|
||||
NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
@ -732,6 +760,24 @@ nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryMa
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::AddCategoryEntryToHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry)
|
||||
{
|
||||
return OperateCategoryEntryHash(aCategoryManager, aCategory, aEntry,
|
||||
/* aRemove = */ false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::RemoveCategoryEntryFromHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry)
|
||||
{
|
||||
return OperateCategoryEntryHash(aCategoryManager, aCategory, aEntry,
|
||||
/* aRemove = */ true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptNameSpaceManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
@ -740,7 +786,7 @@ nsScriptNameSpaceManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID) == 0) {
|
||||
if (!strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID)) {
|
||||
nsCOMPtr<nsICategoryManager> cm =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
if (!cm) {
|
||||
@ -749,11 +795,19 @@ nsScriptNameSpaceManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
|
||||
return AddCategoryEntryToHash(cm, NS_ConvertUTF16toUTF8(aData).get(),
|
||||
aSubject);
|
||||
} else if (!strcmp(aTopic, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID)) {
|
||||
nsCOMPtr<nsICategoryManager> cm =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
if (!cm) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return RemoveCategoryEntryFromHash(cm, NS_ConvertUTF16toUTF8(aData).get(),
|
||||
aSubject);
|
||||
}
|
||||
|
||||
// TODO: we could observe NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID
|
||||
// and NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID but we are safe without it.
|
||||
// See bug 600460.
|
||||
// TODO: we could observe NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID
|
||||
// but we are safe without it. See bug 600460.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -177,6 +177,8 @@ private:
|
||||
NS_ConvertASCIItoUTF16 key(aKey);
|
||||
return AddToHash(aTable, &key, aClassName);
|
||||
}
|
||||
// Removes an existing entry from the hash.
|
||||
void RemoveFromHash(PLDHashTable *aTable, const nsAString *aKey);
|
||||
|
||||
nsresult FillHash(nsICategoryManager *aCategoryManager,
|
||||
const char *aCategory);
|
||||
@ -197,6 +199,24 @@ private:
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry);
|
||||
|
||||
/**
|
||||
* Remove an existing category entry from the hash table.
|
||||
* Only some categories can be removed (see the beginning of the definition).
|
||||
* The other ones will be ignored.
|
||||
*
|
||||
* @aCategory Category where the entry will be removed from.
|
||||
* @aEntry The entry that should be removed.
|
||||
*/
|
||||
nsresult RemoveCategoryEntryFromHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry);
|
||||
|
||||
// common helper for AddCategoryEntryToHash and RemoveCategoryEntryFromHash
|
||||
nsresult OperateCategoryEntryHash(nsICategoryManager* aCategoryManager,
|
||||
const char* aCategory,
|
||||
nsISupports* aEntry,
|
||||
bool aRemove);
|
||||
|
||||
nsGlobalNameStruct* LookupNameInternal(const nsAString& aName,
|
||||
const PRUnichar **aClassName = nullptr);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
#include "mozilla/Base64.h"
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define nsStructuredCloneContainer_h__
|
||||
|
||||
#include "nsIStructuredCloneContainer.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#define NS_STRUCTUREDCLONECONTAINER_CONTRACTID \
|
||||
|
@ -8,7 +8,8 @@
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "js/Value.h"
|
||||
#include "js/Value.h" // must come before js/RootingAPI.h
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
struct JSTracer;
|
||||
class JSObject;
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "nsWrapperCache.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
inline JSObject*
|
||||
nsWrapperCache::GetWrapper() const
|
||||
|
@ -14,7 +14,8 @@
|
||||
#define mozilla_dom_BindingDeclarations_h__
|
||||
|
||||
#include "nsStringGlue.h"
|
||||
#include "jsapi.h"
|
||||
#include "js/Value.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "mozilla/Util.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMString.h"
|
||||
@ -22,6 +23,8 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h" // for nsRefPtr member variables
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
class nsWrapperCache;
|
||||
|
||||
// nsGlobalWindow implements nsWrapperCache, but doesn't always use it. Don't
|
||||
@ -72,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
JS::RootedObject mGlobalJSObject;
|
||||
JS::Rooted<JSObject*> mGlobalJSObject;
|
||||
nsISupports* mGlobalObject;
|
||||
nsCOMPtr<nsISupports> mGlobalObjectRef;
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "XPCQuickStubs.h"
|
||||
#include "XrayWrapper.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#include "mozilla/dom/HTMLObjectElement.h"
|
||||
#include "mozilla/dom/HTMLObjectElementBinding.h"
|
||||
|
@ -20,9 +20,10 @@
|
||||
# interfaces.
|
||||
# * headerFile - The file in which the nativeType is declared (defaults
|
||||
# to an educated guess).
|
||||
# * concrete - Indicates whether there exist objects with this interface as
|
||||
# their primary interface. Always False for callback interfaces.
|
||||
# defaults to True otherwise.
|
||||
# * concrete - Indicates whether there exist JS objects with this interface as
|
||||
# their primary interface (and hence whose prototype is this
|
||||
# interface's prototype object). Always False for callback
|
||||
# interfaces. Defaults to True otherwise.
|
||||
# * workers - Indicates whether the descriptor is intended to be used for
|
||||
# worker threads (defaults to false).
|
||||
# * customTrace - The native class will use a custom trace hook (defaults to
|
||||
@ -1236,6 +1237,7 @@ DOMInterfaces = {
|
||||
{
|
||||
'implicitJSContext': [ 'createObjectURL', 'revokeObjectURL' ],
|
||||
'workers': True,
|
||||
'concrete': False,
|
||||
}],
|
||||
|
||||
'WebGLActiveInfo': {
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "jsapi.h"
|
||||
#include "jswrapper.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
@ -31,7 +30,6 @@
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsLayoutStatics.h"
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -5980,12 +5980,12 @@ def getUnionTypeTemplateVars(unionType, type, descriptorProvider, isReturnValue=
|
||||
else:
|
||||
name = type.name
|
||||
|
||||
tryNextCode = """tryNext = true;
|
||||
return true;"""
|
||||
tryNextCode = ("tryNext = true;\n"
|
||||
"return true;")
|
||||
if type.isGeckoInterface():
|
||||
tryNextCode = ("""if (mUnion.mType != mUnion.eUninitialized) {
|
||||
mUnion.Destroy%s();
|
||||
}""" % name) + tryNextCode
|
||||
tryNextCode = ("if (mUnion.mType != mUnion.eUninitialized) {"
|
||||
" mUnion.Destroy%s();"
|
||||
"}" % name) + tryNextCode
|
||||
conversionInfo = getJSToNativeConversionInfo(
|
||||
type, descriptorProvider, failureCode=tryNextCode,
|
||||
isDefinitelyObject=True, isInUnionReturnValue=isReturnValue,
|
||||
@ -5999,11 +5999,14 @@ return true;"""
|
||||
externalType = getUnionAccessorSignatureType(type, descriptorProvider).define()
|
||||
|
||||
if type.isObject():
|
||||
setter = CGGeneric("void SetToObject(JSContext* cx, JSObject* obj)\n"
|
||||
"{\n"
|
||||
" mUnion.mValue.mObject.SetValue(cx, obj);\n"
|
||||
" mUnion.mType = mUnion.eObject;\n"
|
||||
"}")
|
||||
body = ("mUnion.mValue.mObject.SetValue(cx, obj);\n"
|
||||
"mUnion.mType = mUnion.eObject;")
|
||||
setter = ClassMethod("SetToObject", "void",
|
||||
[Argument("JSContext*", "cx"),
|
||||
Argument("JSObject*", "obj")],
|
||||
inline=True, bodyInHeader=True,
|
||||
body=body)
|
||||
|
||||
else:
|
||||
jsConversion = string.Template(conversionInfo.template).substitute(
|
||||
{
|
||||
@ -6014,20 +6017,22 @@ return true;"""
|
||||
}
|
||||
)
|
||||
jsConversion = CGWrapper(CGGeneric(jsConversion),
|
||||
pre="tryNext = false;\n",
|
||||
post="\n"
|
||||
"return true;")
|
||||
setter = CGWrapper(CGIndenter(jsConversion),
|
||||
pre="bool TrySetTo" + name + "(JSContext* cx, JS::Handle<JS::Value> value, JS::MutableHandle<JS::Value> pvalue, bool& tryNext)\n"
|
||||
"{\n"
|
||||
" tryNext = false;\n",
|
||||
post="\n"
|
||||
"}")
|
||||
setter = ClassMethod("TrySetTo" + name, "bool",
|
||||
[Argument("JSContext*", "cx"),
|
||||
Argument("JS::Handle<JS::Value>", "value"),
|
||||
Argument("JS::MutableHandle<JS::Value>", "pvalue"),
|
||||
Argument("bool&", "tryNext")],
|
||||
inline=True, bodyInHeader=True,
|
||||
body=jsConversion.define())
|
||||
|
||||
return {
|
||||
"name": name,
|
||||
"structType": structType,
|
||||
"externalType": externalType,
|
||||
"setter": CGIndenter(setter).define(),
|
||||
"setter": setter,
|
||||
"holderType": conversionInfo.holderType.define() if conversionInfo.holderType else None
|
||||
}
|
||||
|
||||
@ -6164,51 +6169,45 @@ class CGUnionConversionStruct(CGThing):
|
||||
self.descriptorProvider = descriptorProvider
|
||||
|
||||
def declare(self):
|
||||
setters = []
|
||||
|
||||
structName = str(self.type)
|
||||
members = [ClassMember("mUnion", structName + "&",
|
||||
body="const_cast<%s&>(aUnion)" % structName)]
|
||||
# Argument needs to be a const ref because that's all Maybe<> allows
|
||||
ctor = ClassConstructor([Argument("const %s&" % structName, "aUnion")],
|
||||
bodyInHeader=True,
|
||||
visibility="public",
|
||||
explicit=True)
|
||||
methods = []
|
||||
|
||||
if self.type.hasNullableType:
|
||||
setters.append(""" bool SetNull()
|
||||
{
|
||||
mUnion.mType = mUnion.eNull;
|
||||
return true;
|
||||
}""")
|
||||
methods.append(ClassMethod("SetNull", "bool", [],
|
||||
body=("mUnion.mType = mUnion.eNull;\n"
|
||||
"return true;"),
|
||||
inline=True, bodyInHeader=True))
|
||||
|
||||
templateVars = map(lambda t: getUnionTypeTemplateVars(self.type, t, self.descriptorProvider),
|
||||
self.type.flatMemberTypes)
|
||||
structName = self.type.__str__()
|
||||
for t in self.type.flatMemberTypes:
|
||||
vars = getUnionTypeTemplateVars(self.type,
|
||||
t, self.descriptorProvider)
|
||||
methods.append(vars["setter"])
|
||||
if vars["name"] != "Object":
|
||||
body=string.Template("mUnion.mType = mUnion.e${name};\n"
|
||||
"return mUnion.mValue.m${name}.SetValue();").substitute(vars)
|
||||
methods.append(ClassMethod("SetAs" + vars["name"],
|
||||
vars["structType"] + "&",
|
||||
[],
|
||||
bodyInHeader=True,
|
||||
body=body,
|
||||
visibility="private"))
|
||||
if vars["holderType"] is not None:
|
||||
members.append(ClassMember("m%sHolder" % vars["name"],
|
||||
vars["holderType"]))
|
||||
|
||||
setters.extend(mapTemplate("${setter}", templateVars))
|
||||
# Don't generate a SetAsObject, since we don't use it
|
||||
private = "\n".join(mapTemplate(""" ${structType}& SetAs${name}()
|
||||
{
|
||||
mUnion.mType = mUnion.e${name};
|
||||
return mUnion.mValue.m${name}.SetValue();
|
||||
}""",
|
||||
filter(lambda v: v["name"] != "Object",
|
||||
templateVars)))
|
||||
private += "\n\n"
|
||||
holders = filter(lambda v: v["holderType"] is not None, templateVars)
|
||||
if len(holders) > 0:
|
||||
private += "\n".join(mapTemplate(" ${holderType} m${name}Holder;", holders))
|
||||
private += "\n\n"
|
||||
private += " " + structName + "& mUnion;"
|
||||
return string.Template("""
|
||||
class ${structName}Argument {
|
||||
public:
|
||||
// Argument needs to be a const ref because that's all Maybe<> allows
|
||||
${structName}Argument(const ${structName}& aUnion) : mUnion(const_cast<${structName}&>(aUnion))
|
||||
{
|
||||
}
|
||||
|
||||
${setters}
|
||||
|
||||
private:
|
||||
${private}
|
||||
};
|
||||
""").substitute({"structName": structName,
|
||||
"setters": "\n\n".join(setters),
|
||||
"private": private
|
||||
})
|
||||
return CGClass(structName + "Argument",
|
||||
members=members,
|
||||
constructors=[ctor],
|
||||
methods=methods,
|
||||
disallowCopyConstruction=True).declare()
|
||||
|
||||
def define(self):
|
||||
return """
|
||||
@ -7519,7 +7518,9 @@ if (expando) {
|
||||
}
|
||||
|
||||
if (hasProp) {
|
||||
return JS_GetPropertyById(cx, expando, id, vp);
|
||||
// Forward the get to the expando object, but our receiver is whatever our
|
||||
// receiver is.
|
||||
return JS_ForwardGetPropertyTo(cx, expando, id, receiver, vp);
|
||||
}
|
||||
}"""
|
||||
|
||||
|
@ -480,11 +480,14 @@ class Descriptor(DescriptorProvider):
|
||||
def needsHeaderInclude(self):
|
||||
"""
|
||||
An interface doesn't need a header file if it is not concrete,
|
||||
not pref-controlled, and has only consts.
|
||||
not pref-controlled, has no prototype object, and has no
|
||||
static methods or attributes.
|
||||
"""
|
||||
return (self.interface.isExternal() or self.concrete or
|
||||
self.interface.getExtendedAttribute("PrefControlled") or
|
||||
self.interface.hasInterfacePrototypeObject())
|
||||
self.interface.hasInterfacePrototypeObject() or
|
||||
any((m.isAttr() or m.isMethod()) and m.isStatic() for m
|
||||
in self.interface.members))
|
||||
|
||||
def wantsQI(self):
|
||||
# If it was specified explicitly use that.
|
||||
|
@ -6,7 +6,6 @@
|
||||
#ifndef mozilla_dom_DOMJSClass_h
|
||||
#define mozilla_dom_DOMJSClass_h
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsproxy.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define mozilla_dom_TypedArray_h
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
|
||||
|
@ -76,6 +76,7 @@ MOCHITEST_FILES := \
|
||||
test_ByteString.html \
|
||||
test_exception_messages.html \
|
||||
test_bug707564.html \
|
||||
test_bug907548.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
|
29
dom/bindings/test/test_bug907548.html
Normal file
29
dom/bindings/test/test_bug907548.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=907548
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 907548</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 907548 **/
|
||||
ok(!URL.prototype,
|
||||
"URL.prototype should be undefined unless the URL API is implemented");
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=907548">Mozilla Bug 907548</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -5,7 +5,6 @@
|
||||
#ifndef DOM_CAMERA_ICAMERACONTROL_H
|
||||
#define DOM_CAMERA_ICAMERACONTROL_H
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIDOMCameraManager.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
@ -5,11 +5,6 @@
|
||||
|
||||
#include "nsIDOMHTMLElement.idl"
|
||||
|
||||
%{C++
|
||||
// for jsval
|
||||
#include "jsapi.h"
|
||||
%}
|
||||
|
||||
/**
|
||||
* The nsIDOMHTMLCanvasElement interface is the interface to a HTML
|
||||
* <canvas> element.
|
||||
|
@ -9,9 +9,13 @@ interface nsIInputStream;
|
||||
interface nsIOutputStream;
|
||||
interface nsIScriptGlobalObject;
|
||||
|
||||
[ptr] native JSValPtr(jsval);
|
||||
[ptr] native JSValPtr(JS::Value);
|
||||
[ptr] native JSContext(JSContext);
|
||||
|
||||
%{C++
|
||||
namespace JS { class Value; }
|
||||
%}
|
||||
|
||||
/**
|
||||
* Don't use this! Use JSON.parse and JSON.stringify directly.
|
||||
*/
|
||||
|
@ -7,11 +7,12 @@
|
||||
#ifndef mozilla_dom_StructuredCloneUtils_h
|
||||
#define mozilla_dom_StructuredCloneUtils_h
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIDOMFile.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct SerializedStructuredCloneBuffer;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIWindowProvider.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#include "mozilla/dom/PContentDialogParent.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "nsIDOMMozMmsMessage.h"
|
||||
#include "nsString.h"
|
||||
#include "jspubtd.h"
|
||||
#include "mozilla/dom/mobilemessage/Types.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/dom/mobilemessage/SmsTypes.h"
|
||||
#include "nsIDOMMozMobileMessageThread.h"
|
||||
#include "nsString.h"
|
||||
#include "jspubtd.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "mozilla/dom/mobilemessage/SmsTypes.h"
|
||||
#include "nsIDOMMozSmsMessage.h"
|
||||
#include "nsString.h"
|
||||
#include "jspubtd.h"
|
||||
#include "mozilla/dom/mobilemessage/Types.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define nsJSNPRuntime_h_
|
||||
|
||||
#include "nscore.h"
|
||||
#include "jsapi.h"
|
||||
#include "npapi.h"
|
||||
#include "npruntime.h"
|
||||
#include "pldhash.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "npfunctions.h"
|
||||
#include "nsPluginHost.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "mozilla/PluginLibrary.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "mozilla/plugins/PPluginScriptableObjectParent.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "npfunctions.h"
|
||||
#include "npruntime.h"
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIJSEventListener.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
#ifndef nsJSON_h__
|
||||
#define nsJSON_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsIJSON.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -5,7 +5,6 @@
|
||||
#ifndef mozilla_osfileconstants_h__
|
||||
#define mozilla_osfileconstants_h__
|
||||
|
||||
#include "jspubtd.h"
|
||||
#include "nsIOSFileConstantsService.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
|
@ -23,6 +23,9 @@ SpecialPowers.addCategoryEntry("JavaScript-global-property", "testSNSM", "@mozil
|
||||
|
||||
SimpleTest.executeSoon(function () {
|
||||
ok(window.testSNSM, "testSNSM should return an object");
|
||||
// The category entry must be removed before finishing the test,
|
||||
// otherwise it will affect all following tests in the test suite.
|
||||
SpecialPowers.deleteCategoryEntry("JavaScript-global-property", "testSNSM", false);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
|
@ -19,22 +19,79 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=641552
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.addCategoryEntry("JavaScript-global-property", "randomname", "@mozilla.org/embedcomp/prompt-service;1",
|
||||
false, true);
|
||||
var categoryEntries = [
|
||||
{category: "JavaScript-global-property", entry: "randomname", contractId: "@mozilla.org/embedcomp/prompt-service;1"},
|
||||
{category: "JavaScript-navigator-property", entry: "randomname1", contractId: "@mozilla.org/embedcomp/prompt-service;1"},
|
||||
{category: "JavaScript-navigator-property", entry: "randomname2", contractId: "@mozilla.org/embedcomp/prompt-service;1"},
|
||||
];
|
||||
|
||||
SpecialPowers.addCategoryEntry("JavaScript-navigator-property", "randomname1", "@mozilla.org/embedcomp/prompt-service;1",
|
||||
false, true);
|
||||
function addCategoryEntries(func) {
|
||||
for (var categoryEntry of categoryEntries) {
|
||||
SpecialPowers.addCategoryEntry(categoryEntry.category, categoryEntry.entry, categoryEntry.contractId,
|
||||
false, true);
|
||||
}
|
||||
SimpleTest.executeSoon(func);
|
||||
}
|
||||
|
||||
SpecialPowers.addCategoryEntry("JavaScript-navigator-property", "randomname2", "@mozilla.org/embedcomp/prompt-service;1",
|
||||
false, true);
|
||||
function removeCategoryEntries(func) {
|
||||
for (var categoryEntry of categoryEntries) {
|
||||
SpecialPowers.deleteCategoryEntry(categoryEntry.category, categoryEntry.entry, false);
|
||||
}
|
||||
SimpleTest.executeSoon(func);
|
||||
}
|
||||
|
||||
SimpleTest.executeSoon(function () {
|
||||
function checkNamesPresent() {
|
||||
ok(window.randomname, "window.randomname should return an object");
|
||||
is(typeof(window.navigator.randomname1), 'object', "navigator.randomname1 should return an object");
|
||||
is(typeof(window.navigator.randomname2), 'object', "navigator.randomname1 should return an object");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function checkNamesAbsent() {
|
||||
ok(!window.randomname, "window.randomname should return undefined");
|
||||
is(typeof(window.navigator.randomname1), 'undefined', "navigator.randomname1 should return undefined");
|
||||
is(typeof(window.navigator.randomname2), 'undefined', "navigator.randomname1 should return undefined");
|
||||
}
|
||||
|
||||
// Ensure the initial state
|
||||
checkNamesAbsent();
|
||||
|
||||
addCategoryEntries(function test1() {
|
||||
ok(window.randomname, "window.randomname should return an object");
|
||||
is(typeof(window.navigator.randomname1), 'object', "navigator.randomname1 should return an object");
|
||||
is(typeof(window.navigator.randomname2), 'object', "navigator.randomname1 should return an object");
|
||||
|
||||
delete window.randomname;
|
||||
delete window.navigator.randomname1;
|
||||
delete window.navigator.randomname2;
|
||||
|
||||
// The delete opertor should have no effect as long as the category entry is registered.
|
||||
checkNamesPresent();
|
||||
|
||||
removeCategoryEntries(test2);
|
||||
});
|
||||
|
||||
function test2() {
|
||||
// The object should be cached on the global/navigator object once accessed.
|
||||
checkNamesPresent();
|
||||
|
||||
delete window.randomname;
|
||||
delete window.navigator.randomname1;
|
||||
delete window.navigator.randomname2;
|
||||
|
||||
// Now the delete opertor should have the effect.
|
||||
checkNamesAbsent();
|
||||
|
||||
addCategoryEntries(function() {
|
||||
removeCategoryEntries(test3);
|
||||
});
|
||||
}
|
||||
|
||||
function test3() {
|
||||
// The object should not be cached until the first access.
|
||||
checkNamesAbsent();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -21,15 +21,16 @@
|
||||
var ok = window.opener.wrappedJSObject.ok;
|
||||
var complete = window.opener.wrappedJSObject.complete;
|
||||
var openerDoc = window.opener.wrappedJSObject.document;
|
||||
var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
|
||||
|
||||
window.onfocus = function () {
|
||||
SimpleTest.waitForFocus(function () {
|
||||
ok(getComputedStyle(document.getElementById("box"), "").backgroundColor, "rgb(0, 0, 255)");
|
||||
ok(getComputedStyle(openerDoc.getElementById("box"), "").backgroundColor, "rgb(0, 255, 255)");
|
||||
window.opener.focus();
|
||||
ok(getComputedStyle(document.getElementById("box"), "").backgroundColor, "rgb(0, 255, 255)");
|
||||
ok(getComputedStyle(openerDoc.getElementById("box"), "").backgroundColor, "rgb(0, 0, 255)");
|
||||
complete();
|
||||
}
|
||||
}, window);
|
||||
|
||||
]]></script>
|
||||
|
||||
|
@ -7,11 +7,12 @@
|
||||
var win = XPCNativeWrapper.unwrap(window);
|
||||
var SpecialPowers = win.SpecialPowers;
|
||||
var is = win.is;
|
||||
var todo_is = win.todo_is;
|
||||
var ok = win.ok;
|
||||
var interfaceNamesInGlobalScope = win.interfaceNamesInGlobalScope;
|
||||
var interfaceNamesInXBLScope = win.interfaceNamesInXBLScope;
|
||||
var excludedNames = win.excludedNames;
|
||||
var createInterfaceMap = win.createInterfaceMap;
|
||||
eval(win.runTest.toString());
|
||||
runTest(window, true);
|
||||
runTest(true);
|
||||
win.SimpleTest.finish();
|
||||
</constructor>
|
||||
</implementation>
|
||||
|
@ -23,26 +23,88 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=766694
|
||||
// This is a list of all interfaces that are exposed to every webpage. Please only
|
||||
// add things to this list with great care.
|
||||
|
||||
// IMPORTANT: Do not change this list without review from a JavaScript Engine peer!
|
||||
var ecmaGlobals =
|
||||
[
|
||||
"Array",
|
||||
"ArrayBuffer",
|
||||
"Boolean",
|
||||
"DataView",
|
||||
"Date",
|
||||
"Error",
|
||||
"EvalError",
|
||||
"Float32Array",
|
||||
"Float64Array",
|
||||
"Function",
|
||||
"Infinity",
|
||||
"Int16Array",
|
||||
"Int32Array",
|
||||
"Int8Array",
|
||||
"InternalError",
|
||||
"Iterator",
|
||||
"JSON",
|
||||
"Map",
|
||||
"Math",
|
||||
"NaN",
|
||||
"Number",
|
||||
"Object",
|
||||
{name: "ParallelArray", nightly: true},
|
||||
"Proxy",
|
||||
"RangeError",
|
||||
"ReferenceError",
|
||||
"RegExp",
|
||||
"Set",
|
||||
"StopIteration",
|
||||
"String",
|
||||
"SyntaxError",
|
||||
"TypeError",
|
||||
"Uint16Array",
|
||||
"Uint32Array",
|
||||
"Uint8Array",
|
||||
"Uint8ClampedArray",
|
||||
"URIError",
|
||||
"WeakMap",
|
||||
];
|
||||
// IMPORTANT: Do not change this list without review from a JavaScript Engine peer!
|
||||
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
var interfaceNamesInGlobalScope =
|
||||
[
|
||||
"AnalyserNode",
|
||||
"AnimationEvent",
|
||||
"Array",
|
||||
"ArchiveRequest",
|
||||
"AsyncScrollEventDetail",
|
||||
"Attr",
|
||||
"Audio",
|
||||
"AudioBuffer",
|
||||
"AudioContext",
|
||||
"AudioBufferSourceNode",
|
||||
"AudioDestinationNode",
|
||||
"AudioListener",
|
||||
"AudioNode",
|
||||
"AudioParam",
|
||||
"AudioProcessingEvent",
|
||||
"AudioStreamTrack",
|
||||
"BarProp",
|
||||
"BatteryManager",
|
||||
"BeforeUnloadEvent",
|
||||
"BiquadFilterNode",
|
||||
"Blob",
|
||||
"BlobEvent",
|
||||
{name: "BoxObject", xbl: true},
|
||||
{name: "BrowserFeedWriter", android: false},
|
||||
"CameraCapabilities",
|
||||
"CameraControl",
|
||||
"CameraManager",
|
||||
"CanvasGradient",
|
||||
"CanvasPattern",
|
||||
"CanvasRenderingContext2D",
|
||||
"CaretPosition",
|
||||
"CDATASection",
|
||||
"ChannelMergerNode",
|
||||
"ChannelSplitterNode",
|
||||
"CharacterData",
|
||||
{name: "ChromeWindow", xbl: true},
|
||||
"ClientRect",
|
||||
"ClientRectList",
|
||||
"ClipboardEvent",
|
||||
@ -51,17 +113,21 @@ var interfaceNamesInGlobalScope =
|
||||
"Comment",
|
||||
"CompositionEvent",
|
||||
"Controllers",
|
||||
"CRMFObject",
|
||||
"ConvolverNode",
|
||||
{name: "CRMFObject", android: false},
|
||||
"Crypto",
|
||||
"CSS",
|
||||
"CSS2Properties",
|
||||
"CSSCharsetRule",
|
||||
"CSSConditionRule",
|
||||
"CSSFontFaceRule",
|
||||
"CSSFontFeatureValuesRule",
|
||||
{name: "CSSFontFeatureValuesRule", release: false},
|
||||
"CSSGroupingRule",
|
||||
"CSSGroupRuleRuleList",
|
||||
"CSSImportRule",
|
||||
"CSSMediaRule",
|
||||
"CSSMozDocumentRule",
|
||||
"CSSNameSpaceRule",
|
||||
"CSSPageRule",
|
||||
"CSSPrimitiveValue",
|
||||
"CSSRule",
|
||||
@ -76,6 +142,7 @@ var interfaceNamesInGlobalScope =
|
||||
"DataChannel",
|
||||
"DataContainerEvent",
|
||||
"DataTransfer",
|
||||
"DelayNode",
|
||||
"DesktopNotification",
|
||||
"DesktopNotificationCenter",
|
||||
"DeviceAcceleration",
|
||||
@ -86,14 +153,16 @@ var interfaceNamesInGlobalScope =
|
||||
"DeviceRotationRate",
|
||||
"DeviceStorage",
|
||||
"DeviceStorageChangeEvent",
|
||||
"DeviceStorageCursor",
|
||||
"Document",
|
||||
"DocumentFragment",
|
||||
"DocumentType",
|
||||
{name: "DOMConstructor", xbl: true},
|
||||
"DOMCursor",
|
||||
"DOMError",
|
||||
"DOMException",
|
||||
"DOMImplementation",
|
||||
"DOMMMIError",
|
||||
"DOMParser",
|
||||
"DOMRequest",
|
||||
"DOMSettableTokenList",
|
||||
"DOMStringList",
|
||||
@ -101,9 +170,9 @@ var interfaceNamesInGlobalScope =
|
||||
"DOMTokenList",
|
||||
"DOMTransactionEvent",
|
||||
"DragEvent",
|
||||
"DynamicsCompressorNode",
|
||||
"Element",
|
||||
"ElementReplaceEvent",
|
||||
"ElementTimeControl",
|
||||
"Event",
|
||||
"EventListenerInfo",
|
||||
"EventSource",
|
||||
@ -115,10 +184,11 @@ var interfaceNamesInGlobalScope =
|
||||
"FileRequest",
|
||||
"FocusEvent",
|
||||
"FormData",
|
||||
"Gamepad",
|
||||
"GamepadAxisMoveEvent",
|
||||
"GamepadButtonEvent",
|
||||
"GamepadEvent",
|
||||
"GainNode",
|
||||
{name: "Gamepad", android: false},
|
||||
{name: "GamepadAxisMoveEvent", android: false},
|
||||
{name: "GamepadButtonEvent", android: false},
|
||||
{name: "GamepadEvent", android: false},
|
||||
"HashChangeEvent",
|
||||
"History",
|
||||
"HTMLAnchorElement",
|
||||
@ -131,7 +201,7 @@ var interfaceNamesInGlobalScope =
|
||||
"HTMLButtonElement",
|
||||
"HTMLCanvasElement",
|
||||
"HTMLCollection",
|
||||
"HTMLCommandElement",
|
||||
"HTMLDataElement",
|
||||
"HTMLDataListElement",
|
||||
"HTMLDirectoryElement",
|
||||
"HTMLDivElement",
|
||||
@ -177,6 +247,7 @@ var interfaceNamesInGlobalScope =
|
||||
"HTMLScriptElement",
|
||||
"HTMLSelectElement",
|
||||
"HTMLSourceElement",
|
||||
"HTMLSpanElement",
|
||||
"HTMLStyleElement",
|
||||
"HTMLTableCaptionElement",
|
||||
"HTMLTableCellElement",
|
||||
@ -184,7 +255,9 @@ var interfaceNamesInGlobalScope =
|
||||
"HTMLTableElement",
|
||||
"HTMLTableRowElement",
|
||||
"HTMLTableSectionElement",
|
||||
"HTMLTemplateElement",
|
||||
"HTMLTextAreaElement",
|
||||
"HTMLTimeElement",
|
||||
"HTMLTitleElement",
|
||||
"HTMLUListElement",
|
||||
"HTMLUnknownElement",
|
||||
@ -193,6 +266,7 @@ var interfaceNamesInGlobalScope =
|
||||
"IDBCursorWithValue",
|
||||
"IDBDatabase",
|
||||
"IDBFactory",
|
||||
"IDBFileHandle",
|
||||
"IDBIndex",
|
||||
"IDBKeyRange",
|
||||
"IDBObjectStore",
|
||||
@ -200,18 +274,25 @@ var interfaceNamesInGlobalScope =
|
||||
"IDBRequest",
|
||||
"IDBTransaction",
|
||||
"IDBVersionChangeEvent",
|
||||
"Image",
|
||||
"ImageData",
|
||||
"JSON",
|
||||
{name: "InstallTrigger", xbl: false},
|
||||
"KeyEvent",
|
||||
"KeyboardEvent",
|
||||
"LoadStatus",
|
||||
"LocalMediaStream",
|
||||
"Location",
|
||||
"LockedFile",
|
||||
"LSProgressEvent",
|
||||
"MediaElementAudioSourceNode",
|
||||
"MediaError",
|
||||
"MediaList",
|
||||
"MediaQueryList",
|
||||
"MediaRecorder",
|
||||
"MediaStream",
|
||||
"MediaStreamAudioDestinationNode",
|
||||
"MediaStreamAudioSourceNode",
|
||||
"MediaStreamEvent",
|
||||
"MediaStreamTrack",
|
||||
"MessageEvent",
|
||||
"MimeType",
|
||||
"MimeTypeArray",
|
||||
@ -219,31 +300,26 @@ var interfaceNamesInGlobalScope =
|
||||
"MouseEvent",
|
||||
"MouseScrollEvent",
|
||||
"MozApplicationEvent",
|
||||
"MozBlobBuilder",
|
||||
"MozCanvasPrintState",
|
||||
"MozConnection",
|
||||
"mozContact",
|
||||
"MozContactChangeEvent",
|
||||
"MozCSSKeyframeRule",
|
||||
"MozCSSKeyframesRule",
|
||||
"MozMmsEvent",
|
||||
"MozMmsMessage",
|
||||
"MozMobileCellInfo",
|
||||
"MozMobileConnectionInfo",
|
||||
"MozMobileMessageManager",
|
||||
"MozMobileMessageThread",
|
||||
"MozMobileNetworkInfo",
|
||||
"MozNamedAttrMap",
|
||||
"MozNetworkStats",
|
||||
"MozNetworkStatsData",
|
||||
"MozNetworkStatsManager",
|
||||
"MozPowerManager",
|
||||
"mozRTCIceCandidate",
|
||||
"mozRTCPeerConnection",
|
||||
"mozRTCSessionDescription",
|
||||
"MozSettingsEvent",
|
||||
"MozSmsEvent",
|
||||
"MozSmsFilter",
|
||||
"MozSmsMessage",
|
||||
"MozSmsSegmentInfo",
|
||||
"MozTimeManager",
|
||||
"MozTouchEvent",
|
||||
"MozWakeLock",
|
||||
"MutationEvent",
|
||||
"MutationObserver",
|
||||
@ -253,47 +329,54 @@ var interfaceNamesInGlobalScope =
|
||||
"NodeFilter",
|
||||
"NodeIterator",
|
||||
"NodeList",
|
||||
"NodeSelector",
|
||||
"NotifyAudioAvailableEvent",
|
||||
"Notification",
|
||||
"NotifyPaintEvent",
|
||||
"NSRGBAColor",
|
||||
"OfflineAudioCompletionEvent",
|
||||
"OfflineAudioContext",
|
||||
"OfflineResourceList",
|
||||
"OpenWindowEventDetail",
|
||||
"Option",
|
||||
"OscillatorNode",
|
||||
"PageTransitionEvent",
|
||||
"PaintRequest",
|
||||
"PaintRequestList",
|
||||
"PaymentRequestInfo",
|
||||
"PannerNode",
|
||||
"Performance",
|
||||
"PerformanceNavigation",
|
||||
"PerformanceTiming",
|
||||
"PeriodicWave",
|
||||
"PhoneNumberService",
|
||||
"Plugin",
|
||||
"PluginArray",
|
||||
"PopStateEvent",
|
||||
"PopupBlockedEvent",
|
||||
"ProcessingInstruction",
|
||||
"ProgressEvent",
|
||||
{name: "Promise", release: false},
|
||||
{name: "PromiseResolver", release: false},
|
||||
"PropertyNodeList",
|
||||
"Range",
|
||||
"RecordErrorEvent",
|
||||
"Rect",
|
||||
"RGBColor",
|
||||
"RTCIceCandidate",
|
||||
"RTCPeerConnection",
|
||||
"RTCSessionDescription",
|
||||
"RTCDataChannelEvent",
|
||||
"RTCPeerConnectionIceEvent",
|
||||
"Screen",
|
||||
"ScriptProcessorNode",
|
||||
"ScrollAreaEvent",
|
||||
"Selection",
|
||||
"SettingsLock",
|
||||
"SettingsManager",
|
||||
"SimpleGestureEvent",
|
||||
{name: "SimpleTest", xbl: false},
|
||||
"SmartCardEvent",
|
||||
"SpeechRecognitionError",
|
||||
"SpeechRecognitionEvent",
|
||||
"SpeechSynthesisEvent",
|
||||
{name: "SpecialPowers", xbl: false},
|
||||
"Storage",
|
||||
"StorageEvent",
|
||||
"StorageItem",
|
||||
"StorageObsolete",
|
||||
"StyleRuleChangeEvent",
|
||||
"StyleSheet",
|
||||
"StyleSheetApplicableStateChangeEvent",
|
||||
@ -310,8 +393,6 @@ var interfaceNamesInGlobalScope =
|
||||
"SVGAnimatedLengthList",
|
||||
"SVGAnimatedNumber",
|
||||
"SVGAnimatedNumberList",
|
||||
"SVGAnimatedPathData",
|
||||
"SVGAnimatedPoints",
|
||||
"SVGAnimatedPreserveAspectRatio",
|
||||
"SVGAnimatedRect",
|
||||
"SVGAnimatedString",
|
||||
@ -328,7 +409,6 @@ var interfaceNamesInGlobalScope =
|
||||
"SVGDocument",
|
||||
"SVGElement",
|
||||
"SVGEllipseElement",
|
||||
"SVGEvent",
|
||||
"SVGFEBlendElement",
|
||||
"SVGFEColorMatrixElement",
|
||||
"SVGFEComponentTransferElement",
|
||||
@ -354,22 +434,20 @@ var interfaceNamesInGlobalScope =
|
||||
"SVGFETileElement",
|
||||
"SVGFETurbulenceElement",
|
||||
"SVGFilterElement",
|
||||
"SVGFilterPrimitiveStandardAttributes",
|
||||
"SVGFitToViewBox",
|
||||
"SVGForeignObjectElement",
|
||||
"SVGGElement",
|
||||
"SVGGradientElement",
|
||||
"SVGGraphicsElement",
|
||||
"SVGImageElement",
|
||||
"SVGLength",
|
||||
"SVGLengthList",
|
||||
"SVGLinearGradientElement",
|
||||
"SVGLineElement",
|
||||
"SVGLocatable",
|
||||
"SVGMarkerElement",
|
||||
"SVGMaskElement",
|
||||
"SVGMatrix",
|
||||
"SVGMetadataElement",
|
||||
"SVGMpathElement",
|
||||
"SVGMPathElement",
|
||||
"SVGNumber",
|
||||
"SVGNumberList",
|
||||
"SVGPathElement",
|
||||
@ -407,31 +485,26 @@ var interfaceNamesInGlobalScope =
|
||||
"SVGSetElement",
|
||||
"SVGStopElement",
|
||||
"SVGStringList",
|
||||
"SVGStylable",
|
||||
"SVGStyleElement",
|
||||
"SVGSVGElement",
|
||||
"SVGSwitchElement",
|
||||
"SVGSymbolElement",
|
||||
"SVGTests",
|
||||
"SVGTextContentElement",
|
||||
"SVGTextElement",
|
||||
"SVGTextPathElement",
|
||||
"SVGTextPositioningElement",
|
||||
"SVGTitleElement",
|
||||
"SVGTransform",
|
||||
"SVGTransformable",
|
||||
"SVGTransformList",
|
||||
"SVGTSpanElement",
|
||||
"SVGUnitTypes",
|
||||
"SVGURIReference",
|
||||
"SVGUseElement",
|
||||
"SVGViewElement",
|
||||
"SVGViewSpec",
|
||||
"SVGZoomAndPan",
|
||||
"SVGZoomEvent",
|
||||
"TCPSocket",
|
||||
"TCPServerSocket",
|
||||
"Text",
|
||||
"TextDecoder",
|
||||
"TextEncoder",
|
||||
"TextMetrics",
|
||||
"TimeEvent",
|
||||
"TimeRanges",
|
||||
@ -439,79 +512,131 @@ var interfaceNamesInGlobalScope =
|
||||
"TouchEvent",
|
||||
"TouchList",
|
||||
"TransitionEvent",
|
||||
{name: "TreeColumn", xbl: true},
|
||||
{name: "TreeColumns", xbl: true},
|
||||
{name: "TreeContentView", xbl: true},
|
||||
{name: "TreeSelection", xbl: true},
|
||||
"TreeWalker",
|
||||
"UIEvent",
|
||||
"UndoManager",
|
||||
"URL",
|
||||
"UserDataHandler",
|
||||
"UserProximityEvent",
|
||||
"USSDReceivedEvent",
|
||||
"ValidityState",
|
||||
"VideoStreamTrack",
|
||||
"WaveShaperNode",
|
||||
"WebGLActiveInfo",
|
||||
"WebGLBuffer",
|
||||
"WebGLFramebuffer",
|
||||
"WebGLProgram",
|
||||
"WebGLRenderbuffer",
|
||||
"WebGLRenderingContext",
|
||||
"WebGLShader",
|
||||
"WebGLShaderPrecisionFormat",
|
||||
"WebGLTexture",
|
||||
"WebGLUniformLocation",
|
||||
"WebGLVertexArray",
|
||||
"WebSocket",
|
||||
"WheelEvent",
|
||||
"Window",
|
||||
"WindowUtils",
|
||||
"XMLDocument",
|
||||
"XMLHttpRequest",
|
||||
"XMLHttpRequestEventTarget",
|
||||
"XMLHttpRequestUpload",
|
||||
"XMLSerializer",
|
||||
"XMLStylesheetProcessingInstruction",
|
||||
"XPathEvaluator",
|
||||
"XPathExpression",
|
||||
"XPathNamespace",
|
||||
"XPathNSResolver",
|
||||
"XPathResult",
|
||||
"XSLTProcessor",
|
||||
"XULElement",
|
||||
{name: "XULButtonElement", xbl: true},
|
||||
{name: "XULCheckboxElement", xbl: true},
|
||||
{name: "XULCommandDispatcher", xbl: true},
|
||||
{name: "XULCommandEvent", xbl: true},
|
||||
{name: "XULControlElement", xbl: true},
|
||||
{name: "XULControllers", xbl: true},
|
||||
{name: "XULDocument", xbl: true},
|
||||
{name: "XULElement", win: true, xbl: true},
|
||||
{name: "XULLabeledControlElement", xbl: true},
|
||||
{name: "XULPopupElement", xbl: true},
|
||||
{name: "XULTemplateBuilder", xbl: true},
|
||||
{name: "XULTreeBuilder", xbl: true},
|
||||
]
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
||||
// If your interface is named nsIDOMSomeInterface and you don't mean to expose
|
||||
// it to every webpage, simply change its name to nsISomeInterface to fix this problem.
|
||||
|
||||
var interfaceNamesInXBLScope = [
|
||||
"BoxObject",
|
||||
"ChromeWindow",
|
||||
"DOMConstructor",
|
||||
"TreeColumn",
|
||||
"TreeColumns",
|
||||
"TreeContentView",
|
||||
"TreeSelection",
|
||||
"XULButtonElement",
|
||||
"XULCheckboxElement",
|
||||
"XULCommandDispatcher",
|
||||
"XULCommandEvent",
|
||||
"XULControlElement",
|
||||
"XULControllers",
|
||||
"XULDocument",
|
||||
"XULLabeledControlElement",
|
||||
"XULPopupElement",
|
||||
"XULTemplateBuilder",
|
||||
"XULTreeBuilder",
|
||||
var excludedNames = [
|
||||
"TraceMallocDisable", // debug builds only
|
||||
"TraceMallocEnable", // debug builds only
|
||||
"TraceMallocOpenLogFile", // debug builds only
|
||||
"TraceMallocChangeLogFD", // debug builds only
|
||||
"TraceMallocCloseLogFD", // debug builds only
|
||||
"TraceMallocLogTimestamp", // debug builds only
|
||||
"TraceMallocDumpAllocations", // debug builds only
|
||||
];
|
||||
|
||||
function runTest(win, isXBLScope) {
|
||||
for (var i in SpecialPowers.Components.interfaces) {
|
||||
var s = i.toString();
|
||||
var name = null;
|
||||
if (s.indexOf("nsIDOM") == 0) {
|
||||
name = s.substring("nsIDOM".length);
|
||||
} else if (s.indexOf("nsI") == 0) {
|
||||
name = s.substring("nsI".length);
|
||||
}
|
||||
if (name && (name in win)) {
|
||||
ok(interfaceNamesInGlobalScope.indexOf(name) >= 0 ||
|
||||
(isXBLScope && interfaceNamesInXBLScope.indexOf(name) >= 0),
|
||||
"If this is failing: DANGER, are you sure you want to expose the new interface " + name + " to all webpages as a property on the window?");
|
||||
function createInterfaceMap(isXBLScope) {
|
||||
var version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version;
|
||||
var isNightly = version.endsWith("a1");
|
||||
var isRelease = !version.contains("a");
|
||||
var isAndroid = navigator.userAgent.indexOf("Android") >= 0;
|
||||
var isWin = navigator.userAgent.indexOf("Windows") >= 0;
|
||||
var interfaceMap = {};
|
||||
for (var entry of ecmaGlobals) {
|
||||
if (typeof(entry) === "string") {
|
||||
// Standard ECMAScript global objects are not defined on the XBL scope.
|
||||
interfaceMap[entry] = !isXBLScope;
|
||||
} else if (entry.nightly === isNightly) {
|
||||
interfaceMap[entry.name] = !isXBLScope;
|
||||
} else {
|
||||
interfaceMap[entry.name] = false;
|
||||
}
|
||||
}
|
||||
for (var name of interfaceNamesInXBLScope) {
|
||||
is(name in win, isXBLScope,
|
||||
name + " should" + (isXBLScope ? "" : " NOT") + " be present in the global scope");
|
||||
for (var entry of interfaceNamesInGlobalScope) {
|
||||
if (typeof(entry) === "string") {
|
||||
interfaceMap[entry] = true;
|
||||
} else if (entry.xbl === isXBLScope ||
|
||||
entry.win === isWin ||
|
||||
entry.android === isAndroid ||
|
||||
entry.release === isRelease) {
|
||||
interfaceMap[entry.name] = true;
|
||||
} else {
|
||||
interfaceMap[entry.name] = false;
|
||||
}
|
||||
}
|
||||
return interfaceMap;
|
||||
}
|
||||
|
||||
function runTest(isXBLScope) {
|
||||
var interfaceMap = createInterfaceMap(isXBLScope);
|
||||
for (var name of Object.getOwnPropertyNames(window)) {
|
||||
// An interfae name should start with an upper case character.
|
||||
if (!/^(moz)?[A-Z]/.test(name) ||
|
||||
excludedNames.indexOf(name) >= 0) {
|
||||
continue;
|
||||
}
|
||||
ok(interfaceMap[name],
|
||||
"If this is failing: DANGER, are you sure you want to expose the new interface " + name + " to all webpages as a property on the window?");
|
||||
delete interfaceMap[name];
|
||||
}
|
||||
for (var name of Object.keys(interfaceMap)) {
|
||||
ok(name in window === interfaceMap[name],
|
||||
name + " should " + (interfaceMap[name] ? "" : " NOT") + " be defined on the " + (isXBLScope ? "XBL" : "global") +" scope");
|
||||
if (!interfaceMap[name]) {
|
||||
delete interfaceMap[name];
|
||||
}
|
||||
}
|
||||
if (isXBLScope) {
|
||||
todo_is(Object.keys(interfaceMap).length, 0,
|
||||
"The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", "));
|
||||
} else {
|
||||
is(Object.keys(interfaceMap).length, 0,
|
||||
"The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
runTest(window, false);
|
||||
runTest(false);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
#include "Workers.h"
|
||||
|
||||
#include "jspubtd.h"
|
||||
|
||||
// DOMException Codes.
|
||||
#define INDEX_SIZE_ERR 1
|
||||
#define DOMSTRING_SIZE_ERR 2
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
#include "Workers.h"
|
||||
|
||||
#include "jspubtd.h"
|
||||
|
||||
class nsIDOMFile;
|
||||
class nsIDOMBlob;
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include "DOMBindingBase.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
#include "jspubtd.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
class WorkerLocation MOZ_FINAL : public DOMBindingBase
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
#include "Workers.h"
|
||||
|
||||
#include "jspubtd.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
||||
JSPrincipals*
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
#include "Workers.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
class nsIURI;
|
||||
class nsIDocument;
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "Workers.h"
|
||||
|
||||
#include "jspubtd.h"
|
||||
#include "mozilla/dom/DOMJSClass.h"
|
||||
|
||||
BEGIN_WORKERS_NAMESPACE
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "nsIThreadInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/CondVar.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
{0xa21bfa01, 0xf349, 0x4394, {0xa8, 0x4c, 0x8d, 0xe5, 0xcf, 0x7, 0x37, 0xd0}}
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "jspubtd.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsIWindowCreator.h" // for stupid compilers
|
||||
#include "nsIWindowWatcher.h"
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include "BaseMargin.h"
|
||||
#include "Point.h"
|
||||
#include "Tools.h"
|
||||
#include "nsMathUtils.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
@ -108,10 +109,10 @@ typedef RectTyped<UnknownUnits> Rect;
|
||||
template<class units>
|
||||
IntRectTyped<units> RoundedToInt(const RectTyped<units>& aRect)
|
||||
{
|
||||
return IntRectTyped<units>(NS_lround(aRect.x),
|
||||
NS_lround(aRect.y),
|
||||
NS_lround(aRect.width),
|
||||
NS_lround(aRect.height));
|
||||
return IntRectTyped<units>(int32_t(floorf(aRect.x + 0.5f)),
|
||||
int32_t(floorf(aRect.y + 0.5f)),
|
||||
int32_t(floorf(aRect.width + 0.5f)),
|
||||
int32_t(floorf(aRect.height + 0.5f)));
|
||||
}
|
||||
|
||||
template<class units>
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <stdint.h> // for uint32_t, uint8_t, uint64_t
|
||||
#include <sys/types.h> // for int32_t
|
||||
#include "GeckoProfilerFunc.h" // for TimeStamp
|
||||
#include "ImageTypes.h" // for ImageFormat, etc
|
||||
#include "gfxASurface.h" // for gfxASurface, etc
|
||||
#include "gfxPoint.h" // for gfxIntSize
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <algorithm> // for max, min
|
||||
#include "AnimationCommon.h" // for ComputedTimingFunction
|
||||
#include "CompositableHost.h" // for CompositableHost
|
||||
#include "GeckoProfilerFunc.h" // for TimeStamp, TimeDuration
|
||||
#include "ImageContainer.h" // for ImageContainer, etc
|
||||
#include "ImageLayers.h" // for ImageLayer
|
||||
#include "LayerSorter.h" // for SortLayersBy3DZOrder
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user