[Pkg-mozext-commits] [greasemonkey] 04/15: Clone the responseXML.documentElement in GM_xhr callbacks.
David Prévot
taffit at moszumanska.debian.org
Sat Aug 2 12:51:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit 75372b2040426eeb36b162c4050546ee8580981e
Author: Ventero <ventero at ventero.de>
Date: Mon Jul 21 03:40:52 2014 +0200
Clone the responseXML.documentElement in GM_xhr callbacks.
Previously, the documentElement node was adopted instead of imported,
which removes it from its previous ownerDocument. Thus, trying to
adopt the node from a second callback later on would fail due to it
being null.
Creating a clone by using importNode instead ensures that the
documentElement can be used in multiple event handlers.
Fixes #1937
Fixes #1966
---
modules/xmlhttprequester.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/xmlhttprequester.js b/modules/xmlhttprequester.js
index 95ab829..69d266a 100644
--- a/modules/xmlhttprequester.js
+++ b/modules/xmlhttprequester.js
@@ -208,9 +208,10 @@ function(wrappedContentWin, req, event, details) {
}
if (req.responseXML) {
- // Adopt the XML object into a content-window-scoped document.
+ // Clone the XML object into a content-window-scoped document.
var xmlDoc = new wrappedContentWin.Document();
- xmlDoc.appendChild(xmlDoc.adoptNode(req.responseXML.documentElement));
+ var clone = xmlDoc.importNode(req.responseXML.documentElement, true);
+ xmlDoc.appendChild(clone);
responseState.responseXML = xmlDoc;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list