Loading accessible/tests/mochitest/aom/test_general.html +1 −1 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ is(anode, node.accessibleNode, "an AccessibleNode is properly cached"); // Adopting node to another document doesn't change .accessibleNode let anotherDoc = document.implementation.createDocument("", "", null); let anotherDoc = ifrDoc.implementation.createDocument("", "", null); let adopted_node = anotherDoc.adoptNode(node); is(anode, adopted_node.accessibleNode, "adopting node to another document doesn't change node.accessibleNode"); Loading accessible/tests/mochitest/treeupdate/test_ariaowns.html +1 −1 Original line number Diff line number Diff line Loading @@ -597,7 +597,7 @@ this.invoke = () => { // trigger a tree update. let doc = getNode("t9_container").contentDocument; doc.body.appendChild(document.createElement("p")); doc.body.appendChild(doc.createElement("p")); }; this.finalCheck = () => { Loading browser/base/content/browser.js +2 −2 Original line number Diff line number Diff line Loading @@ -9949,10 +9949,10 @@ TabModalPromptBox.prototype = { }, appendPrompt(args, onCloseCallback) { let newPrompt = new TabModalPrompt(window); let browser = this.browser; let newPrompt = new TabModalPrompt(browser.ownerGlobal); this.prompts.set(newPrompt.element, newPrompt); let browser = this.browser; browser.parentNode.insertBefore( newPrompt.element, browser.nextElementSibling Loading devtools/server/actors/inspector/walker.js +13 −1 Original line number Diff line number Diff line Loading @@ -1622,8 +1622,20 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, { return; } const parsedDOM = new DOMParser().parseFromString(value, "text/html"); const rawNode = node.rawNode; const doc = nodeDocument(rawNode); const win = doc.defaultView; let parser; if (!win) { throw new Error("The window object shouldn't be null"); } else { // We create DOMParser under window object because we want a content // DOMParser, which means all the DOM objects created by this DOMParser // will be in the same DocGroup as rawNode.parentNode. Then the newly // created nodes can be adopted into rawNode.parentNode. parser = new win.DOMParser(); } const parsedDOM = parser.parseFromString(value, "text/html"); const parentNode = rawNode.parentNode; // Special case for head and body. Setting document.body.outerHTML Loading dom/base/DOMParser.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ #include "nsNetUtil.h" #include "nsDOMString.h" #include "MainThreadUtils.h" #include "SystemPrincipal.h" #include "nsIStreamListener.h" #include "nsStringStream.h" #include "nsIScriptError.h" Loading Loading @@ -103,6 +104,22 @@ already_AddRefed<Document> DOMParser::ParseFromString(const nsAString& aStr, aType, aRv); } already_AddRefed<Document> DOMParser::ParseFromSafeString(const nsAString& aStr, SupportedType aType, ErrorResult& aRv) { // Since we disable cross docGroup node adoption, it is safe to create // new document with the system principal, then the new document will be // placed in the same docGroup as the chrome document. nsCOMPtr<nsIPrincipal> docPrincipal = mPrincipal; if (!nsContentUtils::IsSystemPrincipal(mPrincipal)) { mPrincipal = SystemPrincipal::Create(); } RefPtr<Document> ret = ParseFromString(aStr, aType, aRv); mPrincipal = docPrincipal; return ret.forget(); } already_AddRefed<Document> DOMParser::ParseFromBuffer(const Uint8Array& aBuf, SupportedType aType, ErrorResult& aRv) { Loading Loading
accessible/tests/mochitest/aom/test_general.html +1 −1 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ is(anode, node.accessibleNode, "an AccessibleNode is properly cached"); // Adopting node to another document doesn't change .accessibleNode let anotherDoc = document.implementation.createDocument("", "", null); let anotherDoc = ifrDoc.implementation.createDocument("", "", null); let adopted_node = anotherDoc.adoptNode(node); is(anode, adopted_node.accessibleNode, "adopting node to another document doesn't change node.accessibleNode"); Loading
accessible/tests/mochitest/treeupdate/test_ariaowns.html +1 −1 Original line number Diff line number Diff line Loading @@ -597,7 +597,7 @@ this.invoke = () => { // trigger a tree update. let doc = getNode("t9_container").contentDocument; doc.body.appendChild(document.createElement("p")); doc.body.appendChild(doc.createElement("p")); }; this.finalCheck = () => { Loading
browser/base/content/browser.js +2 −2 Original line number Diff line number Diff line Loading @@ -9949,10 +9949,10 @@ TabModalPromptBox.prototype = { }, appendPrompt(args, onCloseCallback) { let newPrompt = new TabModalPrompt(window); let browser = this.browser; let newPrompt = new TabModalPrompt(browser.ownerGlobal); this.prompts.set(newPrompt.element, newPrompt); let browser = this.browser; browser.parentNode.insertBefore( newPrompt.element, browser.nextElementSibling Loading
devtools/server/actors/inspector/walker.js +13 −1 Original line number Diff line number Diff line Loading @@ -1622,8 +1622,20 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, { return; } const parsedDOM = new DOMParser().parseFromString(value, "text/html"); const rawNode = node.rawNode; const doc = nodeDocument(rawNode); const win = doc.defaultView; let parser; if (!win) { throw new Error("The window object shouldn't be null"); } else { // We create DOMParser under window object because we want a content // DOMParser, which means all the DOM objects created by this DOMParser // will be in the same DocGroup as rawNode.parentNode. Then the newly // created nodes can be adopted into rawNode.parentNode. parser = new win.DOMParser(); } const parsedDOM = parser.parseFromString(value, "text/html"); const parentNode = rawNode.parentNode; // Special case for head and body. Setting document.body.outerHTML Loading
dom/base/DOMParser.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ #include "nsNetUtil.h" #include "nsDOMString.h" #include "MainThreadUtils.h" #include "SystemPrincipal.h" #include "nsIStreamListener.h" #include "nsStringStream.h" #include "nsIScriptError.h" Loading Loading @@ -103,6 +104,22 @@ already_AddRefed<Document> DOMParser::ParseFromString(const nsAString& aStr, aType, aRv); } already_AddRefed<Document> DOMParser::ParseFromSafeString(const nsAString& aStr, SupportedType aType, ErrorResult& aRv) { // Since we disable cross docGroup node adoption, it is safe to create // new document with the system principal, then the new document will be // placed in the same docGroup as the chrome document. nsCOMPtr<nsIPrincipal> docPrincipal = mPrincipal; if (!nsContentUtils::IsSystemPrincipal(mPrincipal)) { mPrincipal = SystemPrincipal::Create(); } RefPtr<Document> ret = ParseFromString(aStr, aType, aRv); mPrincipal = docPrincipal; return ret.forget(); } already_AddRefed<Document> DOMParser::ParseFromBuffer(const Uint8Array& aBuf, SupportedType aType, ErrorResult& aRv) { Loading