Closed
Bug 440275
Opened 17 years ago
Closed 17 years ago
Permission denied to call method Element.getAttribute
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: johnjbarton, Assigned: mrbkap)
References
Details
(Keywords: verified1.9.0.2, Whiteboard: [firebug-p1])
Attachments
(3 files)
1.09 KB,
text/html
|
Details | |
37 bytes,
text/xml
|
Details | |
622 bytes,
patch
|
jst
:
review+
jst
:
superreview+
samuel.sidler+old
:
approval1.9.0.2+
|
Details | Diff | Splinter Review |
The subject error message comes out, no one knows why.
From
http://groups.google.com/group/firebug/browse_thread/thread/fa19b80dfbfb566c
this code breaks on FF3 when firebug is on.
works on FF3 with firebug off.
works on FF2 with firebug on or off.
needs two files.
1) test.html: on body load call test();
2) test.xml: some little xml doc to be loaded.
=== in test.html ===
var doc;
function test(){
doc = document.implementation.createDocument("", "", null);
doc.onload = function(e){
alert(doc.firstChild.getAttribute("id")); //<--HERE
};
doc.load("test.xml");
}
=== and in test.xml ===
<thing id="theid">
<foo/>
</thing>
Reporter | ||
Comment 1•17 years ago
|
||
See also Bug 385676, Bug 427052
Reporter | ||
Comment 2•17 years ago
|
||
Reporter | ||
Comment 3•17 years ago
|
||
Should use a data url if I knew how...
Reporter | ||
Updated•17 years ago
|
Whiteboard: [firebug-p3]
Comment 4•17 years ago
|
||
I've also seen the same error with firstChild.
Comment 5•17 years ago
|
||
I don't really know what component this belongs in, but DOM seems like a decent start. Could some of the principal-knowing sorts point us in the right direction?
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Hardware: PC → DEC
Version: Trunk → 1.9.0 Branch
Assignee | ||
Comment 6•17 years ago
|
||
As far as I can tell, the base cause for the error message here is that nobody calls SetScriptGlobalObject for documents that are created via createDocument (as opposed to those that are created for actual viewing). We do call SetScriptHandlingObject, but that doesn't set mScopeObject. This means that it's possible for us to have multiple XPCWrappedNatives for the same document. That's bad, right there, but it goes one further: because we cache the document JSObject pointer in the document, we end up with a pigeon hole: the 2nd document reset's the document's idea of what its JSObject is. Therefore, when we're wrapping the firstChild in a wn, we hit this code:
if (native_parent == doc && (*parentObj = doc->GetJSObject())) {
and wrap the first child in Firebug's (chrome!) scope. As a hack, I set mScopeObject in nsDocument::SetScriptHandlingObject and it fixed this bug (no more permission denied errors) but I'm not sure if it's correct.
![]() |
||
Comment 7•17 years ago
|
||
That's the same issue we had with XMLHttpRequest documents in terms of principals... I still think the "right" solution there is to have an XPConnect scope associated with each document, not just with some documents.
jst would know about the mScopeObject thing as a quick-fix...
Assignee | ||
Comment 8•17 years ago
|
||
Johnny, what do you think?
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #326905 -
Flags: superreview?(jst)
Attachment #326905 -
Flags: review?(jst)
Reporter | ||
Comment 9•17 years ago
|
||
Another test case on public URL:
http://www.w3schools.com/DOM/tryit.asp?filename=try_dom_attributes
click the button, example fails because of exception.
Comment 10•17 years ago
|
||
Comment on attachment 326905 [details] [diff] [review]
Possible hack or fix
Looks like this should work, and does the right thing AFAICT. r+sr=jst
Blake, please add something like this to your .hgrc:
[defaults]
diff = -p
to make your patches easier to read :)
Attachment #326905 -
Flags: superreview?(jst)
Attachment #326905 -
Flags: superreview+
Attachment #326905 -
Flags: review?(jst)
Attachment #326905 -
Flags: review+
Assignee | ||
Comment 11•17 years ago
|
||
Pushed as changeset 41acba08c036.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
![]() |
||
Comment 12•17 years ago
|
||
Should be able to write a browser/chrome test for this, no?
Flags: in-testsuite?
Comment 13•17 years ago
|
||
mrbkap: what are your thoughs on a test for this?
mrbkap/jst/bz/etc.: is this 1.9.0.x-fodder? Would be great to get rid of these spurious errors at long last!
Flags: wanted1.9.0.x?
Assignee | ||
Comment 14•17 years ago
|
||
I took a stab at this before, but ran into some trouble creating a content frame. I'll try again soon.
Comment 15•17 years ago
|
||
This fixes the test case linked from comment 9, would like to get it to 1.9.0.x to help Firebug there. mrbkap: when you have a test case, can you nom an appropriate patch for branch?
Reporter | ||
Comment 16•17 years ago
|
||
When I try the test case from comment 9 on
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
I get:
Permission denied to get property Element.attributes
http://www.w3schools.com/DOM/tryit_view.asp?filename=try_dom_attributes
Line 11
I'm confused as to whether this is:
1) correct answer, user web page is wrong
2) wrong answer, my version of Firefox does not have "this fix"
3) wrong answer, fix failed.
Comment 17•17 years ago
|
||
> 2) wrong answer, my version of Firefox does not have "this fix"
The fix was committed to the nightly trunk, and hasn't been backported to the 3.0.x series yet (that's why I asked mrbkap to nominate a patch when he had a test suite case for it).
Assignee | ||
Comment 18•17 years ago
|
||
I'm going to have to punt on this one -- I can't figure out how to write the mochitest :-/.
Reporter | ||
Comment 19•17 years ago
|
||
Rob? We probably need to track down what in Firebug sets up the problem, I can help with that if you understand mochitest.
Assignee | ||
Comment 20•17 years ago
|
||
As I recall, there is a content handler that is run after the document.load document is loaded. Firebug touches the document at that point, exposing the bug. I'll be able to provide more detail in a few days if needed.
Assignee | ||
Comment 21•17 years ago
|
||
Comment on attachment 326905 [details] [diff] [review]
Possible hack or fix
Drivers: see comments earlier in this bug about the possibility of a mochitest.
Attachment #326905 -
Flags: approval1.9.0.2?
Reporter | ||
Comment 22•17 years ago
|
||
I tested the set of Firebug bug reports that seem to be related this fix and reported the results on bug 434522. Backporting this would be great for Firebug users.
Whiteboard: [firebug-p3] → [firebug-p1]
Updated•17 years ago
|
Flags: wanted1.9.0.x? → wanted1.9.0.x+
Comment 23•17 years ago
|
||
Comment on attachment 326905 [details] [diff] [review]
Possible hack or fix
Approved for 1.9.0.2. Please land in CVS. a=ss
Attachment #326905 -
Flags: approval1.9.0.2? → approval1.9.0.2+
Comment 27•16 years ago
|
||
This already landed in the tree for 3.0.2 (comment 24, and the fixed1.9.0.2 keyword). Probably worth testing with a 3.0.2pre nightly if you haven't already, though.
Reporter | ||
Comment 28•16 years ago
|
||
A user has verified this fix in 3.0.2.
Updated•16 years ago
|
Flags: blocking1.9.0.2?
Updated•16 years ago
|
Status: RESOLVED → VERIFIED
Keywords: fixed1.9.0.2 → verified1.9.0.2
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•