Closed Bug 604736 Opened 14 years ago Closed 14 years ago

document.adoptNode() no longer works across domains

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 601803

People

(Reporter: jwkbugzilla, Unassigned)

References

Details

(Keywords: regression)

Attachments

(1 file)

This broke Element Hiding Helper in Minefield. It seems that document.adaptNode() only works when moving nodes between documents in the same domain, for documents in different domains the error NS_ERROR_DOM_NOT_SUPPORTED_ERR is thrown. The node is being removed from its original document however so it must be this exception:

http://hg.mozilla.org/mozilla-central/file/00e90d9720c8/content/base/src/nsDocument.cpp#l6139

Testcase is attached, it needs to be opened from a chrome location. It contains two frames, one from google.com and the other from yahoo.com. Clicking "Adopt node" button should move the document body from first frame into the second. This works fine in Firefox 3.6.10 but fails with NS_ERROR_DOM_NOT_SUPPORTED_ERR exception in Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101013 Firefox/4.0b8pre.
Summary: document.adaptNode() no longer works across domains → document.adoptNode() no longer works across domains
I assume this is a regression from the compartments work.
I guess that web content is also affected if document.domain is used so bug 604612 is probably the same issue.
Summary: document.adoptNode() no longer works across domains → document.adaptNode() no longer works across domains
We probably do need to make this work for the document.domain case.  For the other case...  I don't know.  It's a serious footgun.  :(
blocking2.0: --- → ?
Summary: document.adaptNode() no longer works across domains → document.adoptNode() no longer works across domains
Regression range is 20101013 to 20101014 so this is quite certainly compartments (the user agent in bug description is wrong, I was definitely testing with 20101014 - not sure why troubleshooting info claimed otherwise).

(In reply to comment #3)
> We probably do need to make this work for the document.domain case.  For the
> other case...  I don't know.  It's a serious footgun.  :(

Footgun as in "prone to security issues"? In case of Element Hiding Helper it is simply a slight performance optimization, the nodes were created by the extensions and adoptNode allows reusing them in different documents. I can use importNode as well, no problem with that.
Blocks: compartments
blocking2.0: ? → ---
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
> Footgun as in "prone to security issues"? 

Yes.
I already though so which is why Element Hiding Helper is no longer using the same nodes in different documents (https://hg.adblockplus.org/elemhidehelper/rev/6c7400d85891).
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: