diff --git a/dom/base/Document.h b/dom/base/Document.h index 46e4226adb98..011bc07e48bd 100644 --- a/dom/base/Document.h +++ b/dom/base/Document.h @@ -4759,22 +4759,11 @@ inline mozilla::dom::Document* nsINode::GetOwnerDocument() const { inline nsINode* nsINode::OwnerDocAsNode() const { return OwnerDoc(); } -// ShouldUseXBLScope is defined here as a template so that we can get the faster -// version of IsInAnonymousSubtree if we're statically known to be an -// nsIContent. we could try defining ShouldUseXBLScope separately on nsINode -// and nsIContent, but then we couldn't put its nsINode implementation here -// (because this header does not include nsIContent) and we can't put it in -// nsIContent.h, because the definition of nsIContent::IsInAnonymousSubtree is -// in nsIContentInlines.h. And then we get include hell from people trying to -// call nsINode::GetParentObject but not including nsIContentInlines.h and with -// no really good way to include it. -template -inline bool ShouldUseXBLScope(const T* aNode) { - return aNode->IsInAnonymousSubtree(); +inline bool ShouldUseNACScope(const nsINode* aNode) { + return aNode->IsInNativeAnonymousSubtree(); } -template -inline bool ShouldUseUAWidgetScope(const T* aNode) { +inline bool ShouldUseUAWidgetScope(const nsINode* aNode) { return aNode->IsInUAWidget(); } @@ -4782,8 +4771,8 @@ inline mozilla::dom::ParentObject nsINode::GetParentObject() const { mozilla::dom::ParentObject p(OwnerDoc()); // Note that mReflectionScope is a no-op for chrome, and other places // where we don't check this value. - if (ShouldUseXBLScope(this)) { - p.mReflectionScope = mozilla::dom::ReflectionScope::XBL; + if (ShouldUseNACScope(this)) { + p.mReflectionScope = mozilla::dom::ReflectionScope::NAC; } else if (ShouldUseUAWidgetScope(this)) { p.mReflectionScope = mozilla::dom::ReflectionScope::UAWidget; } diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index 42c706da721f..36b628700b75 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -1994,9 +1994,6 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument, if (aDocument != oldDoc) { JS::SetRealmPrincipals(realm, nsJSPrincipals::get(aDocument->NodePrincipal())); - // Make sure we clear out the old content XBL scope, so the new one will - // get created with a principal that subsumes our new principal. - xpc::ClearContentXBLScope(newInnerGlobal); } } else { if (aState) { diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index a62a3cb61ae1..e1d3fba87b2b 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -1194,7 +1194,7 @@ static void CheckForOutdatedParent(nsINode* aParent, nsINode* aNode, } static nsresult UpdateGlobalsInSubtree(nsIContent* aRoot) { - MOZ_ASSERT(ShouldUseXBLScope(aRoot)); + MOZ_ASSERT(ShouldUseNACScope(aRoot)); // Start off with no global so we don't fire any error events on failure. AutoJSAPI jsapi; jsapi.Init(); @@ -1272,12 +1272,13 @@ nsresult nsINode::InsertChildBefore(nsIContent* aKid, nsIContent* parent = IsContent() ? AsContent() : nullptr; - bool wasInXBLScope = ShouldUseXBLScope(aKid); + // XXXbz Do we even need this code anymore? + bool wasInNACScope = ShouldUseNACScope(aKid); nsresult rv = aKid->BindToTree(doc, parent, parent ? parent->GetBindingParent() : nullptr); - if (NS_SUCCEEDED(rv) && !wasInXBLScope && ShouldUseXBLScope(aKid)) { - MOZ_ASSERT(ShouldUseXBLScope(this), - "Why does the kid need to use an XBL scope?"); + if (NS_SUCCEEDED(rv) && !wasInNACScope && ShouldUseNACScope(aKid)) { + MOZ_ASSERT(ShouldUseNACScope(this), + "Why does the kid need to use an the anonymous content scope?"); rv = UpdateGlobalsInSubtree(aKid); } if (NS_FAILED(rv)) { @@ -2657,9 +2658,10 @@ JSObject* nsINode::WrapObject(JSContext* aCx, } JS::Rooted obj(aCx, WrapNode(aCx, aGivenProto)); - MOZ_ASSERT_IF(obj && ChromeOnlyAccess(), - xpc::IsInContentXBLScope(obj) || - !xpc::UseContentXBLScope(JS::GetObjectRealmOrNull(obj))); + MOZ_ASSERT_IF( + obj && ChromeOnlyAccess(), + JS::GetNonCCWObjectGlobal(obj) == xpc::UnprivilegedJunkScope() || + xpc::IsInUAWidgetScope(obj) || xpc::AccessCheck::isChrome(obj)); return obj; } diff --git a/dom/base/test/chrome.ini b/dom/base/test/chrome.ini index 41f09ae62eeb..fd33ed45afb3 100644 --- a/dom/base/test/chrome.ini +++ b/dom/base/test/chrome.ini @@ -19,6 +19,7 @@ support-files = [test_anonymousContent_xul_window.xul] [test_blockParsing.html] [test_blocking_image.html] +[test_bug419527.xhtml] [test_bug715041.xul] [test_bug715041_removal.xul] [test_bug945152.html] diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 8daa4265418e..f7371c4485fd 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -370,7 +370,6 @@ support-files = test_bug402150.html^headers^ [test_bug418214.html] [test_bug418986-1.html] [test_bug419132.html] -[test_bug419527.xhtml] [test_bug420609.xhtml] [test_bug420700.html] [test_bug421602.html] diff --git a/dom/base/test/test_bug419527.xhtml b/dom/base/test/test_bug419527.xhtml index c468af0aed24..8afda5b16d2b 100644 --- a/dom/base/test/test_bug419527.xhtml +++ b/dom/base/test/test_bug419527.xhtml @@ -5,8 +5,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=419527 --> Test for Bug 419527 - - + + @@ -14,14 +14,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=419527 - var win = XPCNativeWrapper.unwrap(window); + var win = window; var span = document.getAnonymousNodes(this)[0]; win.ok(span.localName == "span", "Wrong anon node!"); var range = document.createRange(); range.selectNode(span.firstChild); win.ok(range.startContainer == span, "Wrong start container!"); win.ok(range.endContainer == span, "Wrong end container!"); - var newSubTree = XPCNativeWrapper(win.newSubTree); + var newSubTree = win.newSubTree; newSubTree.appendChild(this); range.setStart(newSubTree.firstChild, 0); win.ok(range.startContainer == newSubTree.firstChild, diff --git a/dom/bindings/BindingDeclarations.h b/dom/bindings/BindingDeclarations.h index 0a719e661771..74cd5c1904db 100644 --- a/dom/bindings/BindingDeclarations.h +++ b/dom/bindings/BindingDeclarations.h @@ -420,7 +420,7 @@ inline nsWrapperCache* GetWrapperCache(const SmartPtr& aObject) { return GetWrapperCache(aObject.get()); } -enum class ReflectionScope { Content, XBL, UAWidget }; +enum class ReflectionScope { Content, NAC, UAWidget }; struct MOZ_STACK_CLASS ParentObject { template diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 8bed4d82cf26..a62a74f61af2 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -1621,18 +1621,8 @@ static inline JSObject* FindAssociatedGlobal( obj = JS::GetNonCCWObjectGlobal(obj); switch (scope) { - case mozilla::dom::ReflectionScope::XBL: { - // If scope is set to XBLScope, it means that the canonical reflector for - // this native object should live in the content XBL scope. Note that we - // never put anonymous content inside an add-on scope. - if (xpc::IsInContentXBLScope(obj)) { - return obj; - } - JS::Rooted rootedObj(cx, obj); - JSObject* xblScope = xpc::GetXBLScope(cx, rootedObj); - MOZ_ASSERT_IF(xblScope, JS_IsGlobalObject(xblScope)); - JS::AssertObjectIsNotGray(xblScope); - return xblScope; + case mozilla::dom::ReflectionScope::NAC: { + return xpc::NACScope(obj); } case mozilla::dom::ReflectionScope::UAWidget: { diff --git a/dom/events/test/chrome.ini b/dom/events/test/chrome.ini index fe4d6d33a414..09cc408628b5 100644 --- a/dom/events/test/chrome.ini +++ b/dom/events/test/chrome.ini @@ -12,6 +12,7 @@ support-files = test_bug336682.js [test_bug336682_2.xul] +[test_bug391568.xhtml] [test_bug415498.xul] [test_bug418986-3.xul] [test_bug524674.xul] diff --git a/dom/events/test/mochitest.ini b/dom/events/test/mochitest.ini index 3c9f43ad8964..0e17bcc9b8bf 100644 --- a/dom/events/test/mochitest.ini +++ b/dom/events/test/mochitest.ini @@ -36,7 +36,6 @@ support-files = support-files = test_bug336682.js [test_bug367781.html] [test_bug379120.html] -[test_bug391568.xhtml] [test_bug402089.html] [test_bug405632.html] [test_bug409604.html] diff --git a/dom/events/test/test_bug391568.xhtml b/dom/events/test/test_bug391568.xhtml index 0a35072be450..f3c2acc16262 100644 --- a/dom/events/test/test_bug391568.xhtml +++ b/dom/events/test/test_bug391568.xhtml @@ -5,8 +5,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391568 --> Test for Bug 391568 - - + + @@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391568 - var win = XPCNativeWrapper.unwrap(window); + var win = window; ++win.constructorFired; document.getAnonymousNodes(this)[0].addEventListener( "DOMCharacterDataModified", diff --git a/dom/tests/mochitest/general/file_interfaces.xml b/dom/tests/mochitest/general/file_interfaces.xml deleted file mode 100644 index 8b5aa5bfa9fe..000000000000 --- a/dom/tests/mochitest/general/file_interfaces.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - PASS - - - var win = XPCNativeWrapper.unwrap(window); - var SpecialPowers = win.SpecialPowers; - var is = win.is; - var todo_is = win.todo_is; - var ok = win.ok; - var legacyMozPrefixedInterfaces = win.legacyMozPrefixedInterfaces; - var createInterfaceMap = win.createInterfaceMap; - eval(win.runTest.toString()); - runTest(true); - win.SimpleTest.finish(); - - - - diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini index a7ee843b4f2e..fa60f86aa5ff 100644 --- a/dom/tests/mochitest/general/mochitest.ini +++ b/dom/tests/mochitest/general/mochitest.ini @@ -6,7 +6,6 @@ support-files = file_clonewrapper.html file_domWindowUtils_scrollbarSize.html file_frameElementWrapping.html - file_interfaces.xml file_moving_nodeList.html file_moving_xhr.html file_resource_timing_nocors.html diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index b1ff63b8b08c..1145be370066 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -20,7 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=766694 ok(!self.isSecureContext, "The test should not be running in a secure context"); - diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index 90fa7e0f0a00..90807ddc7023 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -15,7 +15,6 @@ // {name: "ExperimentalThing", release: false}, // {name: "ReallyExperimentalThing", nightly: true}, // {name: "DesktopOnlyThing", desktop: true}, -// {name: "FancyControl", xbl: true}, // {name: "DisabledEverywhere", disabled: true}, // ]; // @@ -175,8 +174,6 @@ var interfaceNamesInGlobalScope = {name: "Blob", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BlobEvent", insecureContext: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "BoxObject", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "BroadcastChannel", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -201,16 +198,12 @@ var interfaceNamesInGlobalScope = {name: "ChannelSplitterNode", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "CharacterData", insecureContext: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "ChromeNodeList", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "Clipboard"}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "ClipboardEvent", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "CloseEvent", insecureContext: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "CommandEvent", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "Comment", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -892,9 +885,7 @@ var interfaceNamesInGlobalScope = // IMPORTANT: Do not change this list without review from a DOM peer! {name: "SharedWorker", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "SimpleGestureEvent", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "SimpleTest", insecureContext: true, xbl: false}, + {name: "SimpleTest", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "SourceBuffer", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -910,7 +901,7 @@ var interfaceNamesInGlobalScope = // IMPORTANT: Do not change this list without review from a DOM peer! {name: "SpeechSynthesisVoice", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "SpecialPowers", insecureContext: true, xbl: false}, + {name: "SpecialPowers", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "StereoPannerNode", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -1153,12 +1144,6 @@ var interfaceNamesInGlobalScope = {name: "TrackEvent", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "TransitionEvent", insecureContext: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "TreeColumn", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "TreeColumns", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "TreeContentView", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "TreeWalker", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -1267,27 +1252,11 @@ var interfaceNamesInGlobalScope = {name: "XPathResult", insecureContext: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "XSLTProcessor", insecureContext: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULCommandEvent", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULDocument", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULElement", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULFrameElement", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULMenuElement", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULPopupElement", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULTextElement", insecureContext: true, xbl: true}, -// IMPORTANT: Do not change this list without review from a DOM peer! - {name: "XULTreeElement", insecureContext: true, xbl: true}, // IMPORTANT: Do not change this list without review from a DOM peer! ]; // IMPORTANT: Do not change the list above without review from a DOM peer! -function createInterfaceMap(isXBLScope) { +function createInterfaceMap() { var interfaceMap = {}; function addInterfaces(interfaces) @@ -1299,7 +1268,6 @@ function createInterfaceMap(isXBLScope) { ok(!("pref" in entry), "Bogus pref annotation for " + entry.name); if ((entry.nightly === !isNightly) || (entry.nightlyAndroid === !(isAndroid && isNightly) && isAndroid) || - (entry.xbl === !isXBLScope) || (entry.desktop === !isDesktop) || (entry.windows === !isWindows) || (entry.mac === !isMac) || @@ -1330,8 +1298,8 @@ function createInterfaceMap(isXBLScope) { return interfaceMap; } -function runTest(isXBLScope) { - var interfaceMap = createInterfaceMap(isXBLScope); +function runTest() { + var interfaceMap = createInterfaceMap(); for (var name of Object.getOwnPropertyNames(window)) { // An interface name should start with an upper case character. // However, we have a couple of legacy interfaces that start with 'moz', so @@ -1341,19 +1309,19 @@ function runTest(isXBLScope) { } 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 (XBL: " + isXBLScope + ")? Do not make a change to this file without a " + + " to all webpages as a property on the window? Do not make a change to this file without a " + " review from a DOM peer for that specific change!!! (or a JS peer for changes to ecmaGlobals)"); ok(name in window, - `${name} is exposed as an own property on the window but tests false for "in" in the ${isXBLScope ? "XBL" : "global"} scope`); + `${name} is exposed as an own property on the window but tests false for "in" in the global scope`); ok(Object.getOwnPropertyDescriptor(window, name), - `${name} is exposed as an own property on the window but has no property descriptor in the ${isXBLScope ? "XBL" : "global"} scope`); + `${name} is exposed as an own property on the window but has no property descriptor in the global scope`); 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"); + name + " should " + (interfaceMap[name] ? "" : " NOT") + " be defined on the global scope"); if (!interfaceMap[name]) { delete interfaceMap[name]; } @@ -1362,5 +1330,4 @@ function runTest(isXBLScope) { "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", ")); } -runTest(false); -SimpleTest.waitForExplicitFinish(); +runTest(); diff --git a/dom/tests/mochitest/general/test_interfaces_secureContext.html b/dom/tests/mochitest/general/test_interfaces_secureContext.html index 32e2d7709218..23614c822e67 100644 --- a/dom/tests/mochitest/general/test_interfaces_secureContext.html +++ b/dom/tests/mochitest/general/test_interfaces_secureContext.html @@ -20,7 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=766694 ok(self.isSecureContext, "The test should be running in a secure context"); - diff --git a/dom/xbl/nsXBLBinding.cpp b/dom/xbl/nsXBLBinding.cpp index 83b62e8b8a6c..a0905e0284de 100644 --- a/dom/xbl/nsXBLBinding.cpp +++ b/dom/xbl/nsXBLBinding.cpp @@ -218,16 +218,8 @@ void nsXBLBinding::SetBoundElement(Element* aElement) { return; } - // Compute whether we're using an XBL scope. - // - // We disable XBL scopes for remote XUL, where we care about compat more - // than security. So we need to know whether we're using an XBL scope so that - // we can decide what to do about untrusted events when "allowuntrusted" - // is not given in the handler declaration. - nsCOMPtr go = mBoundElement->OwnerDoc()->GetScopeObject(); - NS_ENSURE_TRUE_VOID(go && go->GetGlobalJSObject()); - mUsingContentXBLScope = xpc::UseContentXBLScope( - JS::GetObjectRealmOrNull(go->GetGlobalJSObject())); + // mUsingContentXBLScope can go away. See bug 1527116. + mUsingContentXBLScope = false; } bool nsXBLBinding::HasStyleSheets() const { diff --git a/dom/xbl/test/chrome.ini b/dom/xbl/test/chrome.ini index d4b5a0bb1eae..e321279043bc 100644 --- a/dom/xbl/test/chrome.ini +++ b/dom/xbl/test/chrome.ini @@ -1,6 +1,5 @@ [DEFAULT] support-files = - file_bug944407.xml file_bug950909.xml file_fieldScopeChain.xml @@ -11,6 +10,6 @@ skip-if = (verify && debug && (os == 'linux' || os == 'mac')) [test_bug721452.xul] [test_bug723676.xul] [test_bug772966.xul] -[test_bug944407.xul] [test_bug950909.xul] +[test_bug1086996.xhtml] [test_fieldScopeChain.html] diff --git a/dom/xbl/test/file_bug366770.xml b/dom/xbl/test/file_bug366770.xml index 11408ec46a5d..b90d5777d24d 100644 --- a/dom/xbl/test/file_bug366770.xml +++ b/dom/xbl/test/file_bug366770.xml @@ -4,7 +4,7 @@ PASS - var win = XPCNativeWrapper.unwrap(window); + var win = window; win.document.bindingConstructorRan = true; win.ok(true, "binding URI with no fragment applied"); win.SimpleTest.finish(); diff --git a/dom/xbl/test/file_bug821850.xhtml b/dom/xbl/test/file_bug821850.xhtml deleted file mode 100644 index cd6a5f0ee2f3..000000000000 --- a/dom/xbl/test/file_bug821850.xhtml +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - // Store a property as an expando on the bound element. - this._prop = "propVal"; - - // Wait for both constructors to fire. - window.constructorCount = (window.constructorCount + 1) || 1; - if (window.constructorCount != 3) - return; - - // Grab some basic infrastructure off the content window. - var win = XPCNativeWrapper.unwrap(window); - SpecialPowers = win.SpecialPowers; - Cu = SpecialPowers.Cu; - Ci = SpecialPowers.Ci; - is = win.is; - ok = win.ok; - SimpleTest = win.SimpleTest; - - // Stick some expandos on the content window. - window.xrayExpando = 3; - win.primitiveExpando = 11; - win.stringExpando = "stringExpando"; - win.objectExpando = { foo: 12 }; - win.globalExpando = SpecialPowers.unwrap(Cu.getGlobalForObject({})); - win.functionExpando = function() { return "called" }; - win.functionExpando.prop = 2; - - // Make sure we're Xraying. - ok(Cu.isXrayWrapper(window), "Window is Xrayed"); - ok(Cu.isXrayWrapper(document), "Document is Xrayed"); - - var bound = document.getElementById('bound'); - var bound2 = document.getElementById('bound2'); - var bound3 = document.getElementById('bound3'); - ok(bound, "bound is non-null"); - is(bound.method('baz'), "method:baz", "Xray methods work"); - is(bound.prop, "propVal", "Property Xrays work"); - is(bound.primitiveField, undefined, "Xrays don't show fields"); - is(bound.wrappedJSObject.primitiveField, 2, "Waiving Xrays show fields"); - - // Check exposure behavior. - is(typeof bound.unexposedMethod, 'function', - "Unexposed method should be visible to XBL"); - is(typeof bound.wrappedJSObject.unexposedMethod, 'undefined', - "Unexposed method should not be defined in content"); - is(typeof bound.unexposedProperty, 'number', - "Unexposed property should be visible to XBL"); - is(typeof bound.wrappedJSObject.unexposedProperty, 'undefined', - "Unexposed property should not be defined in content"); - - // Check that here HTMLImageElement.QueryInterface works - var img = document.querySelector("img"); - ok("QueryInterface" in SpecialPowers.wrap(img), - "Should have a img.QueryInterface here"); - is(SpecialPowers.unwrap(SpecialPowers.wrap(img).QueryInterface(Ci.nsIImageLoadingContent)), - img, "Should be able to QI the image"); - - // Make sure standard constructors work right in the presence of - // sandboxPrototype and Xray-resolved constructors. - is(window.Function, XPCNativeWrapper(window.wrappedJSObject.Function), - "window.Function comes from the window, not the global"); - ok(Function != window.Function, "Function constructors are distinct"); - is(Object.getPrototypeOf(Function.prototype), Object.getPrototypeOf({foo: 42}), - "Function constructor is local"); - - ok(Object.getPrototypeOf(bound.wrappedJSObject) == Object.getPrototypeOf(bound2.wrappedJSObject), - "Div and div should have the same content-side prototype"); - ok(Object.getPrototypeOf(bound.wrappedJSObject) != Object.getPrototypeOf(bound3.wrappedJSObject), - "Div and span should have different content-side prototypes"); - ok(bound.wrappedJSObject.method == bound3.wrappedJSObject.method, - "Methods should be shared"); - - // This gets invoked by an event handler. - window.finish = function() { - // Content messed with stuff. Make sure we still see the right thing. - is(bound.method('bay'), "method:bay", "Xray methods work"); - is(bound.wrappedJSObject.method('bay'), "hah", "Xray waived methods work"); - is(bound.prop, "set:someOtherVal", "Xray props work"); - is(bound.wrappedJSObject.prop, "redefined", "Xray waived props work"); - is(bound.wrappedJSObject.primitiveField, 321, "Can't do anything about redefined fields"); - - SimpleTest.finish(); - } - - // Hand things off to content. Content will call us back. - win.go(); - - 2 - - - - - - return "method:" + arg; - - - - - - is(typeof arg.prop, 'undefined', "No properties"); - is(arg.wrappedJSObject.prop, 2, "Underlying object has properties"); - is(Object.getOwnPropertyNames(arg).length, 0, "Should have no own properties"); - is(Object.getOwnPropertyNames(arg.wrappedJSObject).length, 1, "Underlying object has properties"); - arg.foo = 2; - is(arg.foo, 2, "Should place expandos"); - is(typeof arg.wrappedJSObject.foo, 'undefined', "Expandos should be invisible to content"); - - - - return this._prop; - this._prop = "set:" + val; - - - - - - - - - - - - - -Mozilla Bug 821850 -

-
-
Bound element
-
Bound element
- Bound element - -
-
-
- - diff --git a/dom/xbl/test/file_bug944407.html b/dom/xbl/test/file_bug944407.html deleted file mode 100644 index 3e4a0e80f686..000000000000 --- a/dom/xbl/test/file_bug944407.html +++ /dev/null @@ -1,8 +0,0 @@ - - - -
-
- - - diff --git a/dom/xbl/test/file_bug944407.xml b/dom/xbl/test/file_bug944407.xml deleted file mode 100644 index 5fb55dfde4b5..000000000000 --- a/dom/xbl/test/file_bug944407.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - return 3; - - - - - - - - - - - - - - - Anonymous Content - - diff --git a/dom/xbl/test/file_bug950909.xml b/dom/xbl/test/file_bug950909.xml index 1220b2e2d2ba..9116f912e958 100644 --- a/dom/xbl/test/file_bug950909.xml +++ b/dom/xbl/test/file_bug950909.xml @@ -4,12 +4,9 @@ - + @@ -29,8 +29,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1086996 Test for Bug 1086996 - - + + Mozilla Bug 1086996 diff --git a/dom/xbl/test/test_bug1098628_throw_from_construct.xhtml b/dom/xbl/test/test_bug1098628_throw_from_construct.xhtml index 22bc88798d1b..62ad0f02c2c3 100644 --- a/dom/xbl/test/test_bug1098628_throw_from_construct.xhtml +++ b/dom/xbl/test/test_bug1098628_throw_from_construct.xhtml @@ -21,6 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1098628 diff --git a/dom/xbl/test/test_bug1359859.xhtml b/dom/xbl/test/test_bug1359859.xhtml index 564c2f96d8ac..d6aed2591ceb 100644 --- a/dom/xbl/test/test_bug1359859.xhtml +++ b/dom/xbl/test/test_bug1359859.xhtml @@ -9,11 +9,15 @@ - XPCNativeWrapper.unwrap(window).running(); + window.running(); this.constructed = true; + SimpleTest.expectUncaughtException(); throw new Error("Constructor threw"); - throw new Error("field threw") + + SimpleTest.expectUncaughtException(); + throw new Error("field threw") + "hello" diff --git a/dom/xbl/test/test_bug389322.xhtml b/dom/xbl/test/test_bug389322.xhtml index c81e11143a5d..39a448e3149b 100644 --- a/dom/xbl/test/test_bug389322.xhtml +++ b/dom/xbl/test/test_bug389322.xhtml @@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=389322 var success = true; } catch (e) { success = false; } - XPCNativeWrapper.unwrap(window).report("XBL fields", success) + window.report("XBL fields", success) return "" }()) ]]> @@ -28,7 +28,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=389322 var success = true; } catch (e) { success = false; } - XPCNativeWrapper.unwrap(window).report("XBL property getters", success) + window.report("XBL property getters", success) return 1 ]]> @@ -49,7 +49,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=389322 } catch (e) { success = false; } - XPCNativeWrapper.unwrap(window).report("XBL methods", success) + window.report("XBL methods", success) ]]> - XPCNativeWrapper.unwrap(window).countera++ - XPCNativeWrapper.unwrap(window).counterb++ + window.countera++ + window.counterb++ diff --git a/dom/xbl/test/test_bug401907.xhtml b/dom/xbl/test/test_bug401907.xhtml index 0bc368e29f8d..cee7d3fd71ce 100644 --- a/dom/xbl/test/test_bug401907.xhtml +++ b/dom/xbl/test/test_bug401907.xhtml @@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=401907 - var win = XPCNativeWrapper.unwrap(window); + var win = window; win.ok(true, "First binding with ID 'binding' should be used!"); win.testRun = true; if (win.needsFinish) { @@ -23,7 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=401907 - var win = XPCNativeWrapper.unwrap(window); + var win = window; win.ok(false, "First binding with ID 'binding' should be used!"); win.testRun = true; if (win.needsFinish) { diff --git a/dom/xbl/test/test_bug403162.xhtml b/dom/xbl/test/test_bug403162.xhtml index 6c25f181bdb0..a92123735f8f 100644 --- a/dom/xbl/test/test_bug403162.xhtml +++ b/dom/xbl/test/test_bug403162.xhtml @@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=403162 - + diff --git a/dom/xbl/test/test_bug526178.xhtml b/dom/xbl/test/test_bug526178.xhtml index 602a405a1f25..5ddcdde1fc9f 100644 --- a/dom/xbl/test/test_bug526178.xhtml +++ b/dom/xbl/test/test_bug526178.xhtml @@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=526178 - var win = XPCNativeWrapper.unwrap(window); + var win = window; win.logString += this.localName; win.bindingDone(); diff --git a/dom/xbl/test/test_bug639338.xhtml b/dom/xbl/test/test_bug639338.xhtml index e88ff1abcc2b..8a1cdabf053d 100644 --- a/dom/xbl/test/test_bug639338.xhtml +++ b/dom/xbl/test/test_bug639338.xhtml @@ -9,9 +9,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=403162 - - - + + + diff --git a/dom/xbl/test/test_bug821850.html b/dom/xbl/test/test_bug821850.html deleted file mode 100644 index 9ac7cdc61a2f..000000000000 --- a/dom/xbl/test/test_bug821850.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Test for Bug 821850 - - - - - -Mozilla Bug 821850 -

-
- -
-
-
- - diff --git a/dom/xbl/test/test_bug944407.xul b/dom/xbl/test/test_bug944407.xul deleted file mode 100644 index 13ae77279b34..000000000000 --- a/dom/xbl/test/test_bug944407.xul +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -
-
- - diff --git a/layout/reftests/bugs/495385-2f.xhtml b/layout/reftests/bugs/495385-2f.xhtml deleted file mode 100644 index 3c358728c944..000000000000 --- a/layout/reftests/bugs/495385-2f.xhtml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - Hello - - - Kitty - - -
Hello
-
- -
Kitty
- - - // We used to do this in an onload handler, but getAnonymousNodes is no - // longer accessible to content, and we can't use SpecialPowers in - // reftests. So we enable XBL scopes and take advantage of the fact that XBL - // scopes can access these functions. We apply this binding - // programatically to make absolutely sure this constructor runs after all the - // other bindings have been set up. - document.body.offsetHeight; - document.getAnonymousNodes(document.getElementById("d3"))[0].style.display = 'inline'; - document.getAnonymousNodes(document.getElementById("d4"))[2].style.display = 'inline'; - - -
-
- - - - -
Kitty
-
Hello
-
Kitty
-
Hello
- - diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index c7f5ba650076..db05427d33d3 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1385,7 +1385,6 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2b.html 495385-2- random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2c.html 495385-2-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2d.html 495385-2-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2e.html 495385-2-ref.html # Bug 1392106 -pref(dom.use_xbl_scopes_for_remote_xul,true) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2f.xhtml 495385-2-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2g.html 495385-2-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2h.html 495385-2-ref.html # Bug 1392106 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 495385-2i.html 495385-2-ref.html # Bug 1392106 diff --git a/layout/xul/test/chrome.ini b/layout/xul/test/chrome.ini index 262672956220..7359200b2b75 100644 --- a/layout/xul/test/chrome.ini +++ b/layout/xul/test/chrome.ini @@ -27,6 +27,7 @@ skip-if = (verify && debug && (os == 'linux')) [test_bug703150.xul] [test_bug987230.xul] skip-if = os == 'linux' # No native mousedown event on Linux +[test_bug1197913.xul] [test_popupReflowPos.xul] [test_popupSizeTo.xul] [test_popupZoom.xul] diff --git a/layout/xul/test/mochitest.ini b/layout/xul/test/mochitest.ini index 00738b55ec59..16880b857b4f 100644 --- a/layout/xul/test/mochitest.ini +++ b/layout/xul/test/mochitest.ini @@ -6,7 +6,6 @@ support-files = [test_bug511075.html] skip-if = toolkit == 'android' #bug 798806 [test_bug563416.html] -[test_bug1197913.xul] skip-if = toolkit == 'android' [test_resizer_incontent.xul] [test_splitter.xul] diff --git a/layout/xul/test/test_bug1197913.xul b/layout/xul/test/test_bug1197913.xul index 9849a066d4c2..066d30847dc0 100644 --- a/layout/xul/test/test_bug1197913.xul +++ b/layout/xul/test/test_bug1197913.xul @@ -7,8 +7,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1197913 -