Closed
Bug 1067574
Opened 10 years ago
Closed 10 years ago
Error in content script leads to "Error: Permission denied to access property 'toString'"
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: billm, Unassigned)
References
Details
Attachments
(2 files)
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
I'm attaching the stack when the exception is generated. The problem seems to be that nsJSUtils::ReportPendingException is entering some sandbox scope when trying to report the exception. Consequently, the exception is wrapped in a filtering wrapper. Could this be a problem similar to bug 1066340? Does nsFrameScriptExecutor::LoadFrameScriptInternal need to use AutoEntryScript?
Flags: needinfo?(bobbyholley)
Comment 1•10 years ago
|
||
Yes, that should fix this bug. Add a patch and flag me for review?
Jimb - note that more of the AutoEntryScripts are being added, which will need fixing up in your patch in bug 971673.
Flags: needinfo?(bobbyholley)
Reporter | ||
Comment 2•10 years ago
|
||
Are you sure? I tried this patch and it doesn't work. Looking more closely, nsJSUtils::ReportPendingException is calling GetScriptContextFromJSContext, which is here:
http://mxr.mozilla.org/mozilla-central/source/dom/base/nsDOMJSUtils.h#16
That code is checking if the JSContext private is an nsISupports. Looking at JS_SetContextPrivate, it looks like we only set that for nsJSContext. And I'm guessing we just use the safe JS context here. So isn't this code bound to fail?
Flags: needinfo?(bobbyholley)
Comment 3•10 years ago
|
||
Oh I see. I'd been assuming that the JSObject we'd be using to init the AutoEntryScript was associated with a DOM window, but I guess that's not the case with frame scripts.
Given that, the problem is more that nsJSUtils::ReportPendingException is broken. So we need to fix bug 981187 to make progress here. Setting the dep.
Depends on: 981187
Flags: needinfo?(bobbyholley)
Reporter | ||
Comment 4•10 years ago
|
||
Is there any way we can fix this sooner? Bug 981187 sounds like a pretty big task. I'd really like to have a fix for this in the next few days.
In https://bugzilla.mozilla.org/show_bug.cgi?id=1048164#c14 the author of Greasemonkey is trying to convert his code to e10s using content scripts and is getting this message. If add-on authors can't convert their code, that's a really serious problem.
Comment 5•10 years ago
|
||
The current error reporting machinery is basically broken. There's not a great way to spot fix it.
I've been hacking on this, and I think I can get us to where we need to be with a relatively defined amount of work. Give me a day or two.
Comment 6•10 years ago
|
||
I think we might actually be able to spot-fix this after all. Let me investigate.
Comment 7•10 years ago
|
||
Oh, looks like there isn't actually a testcase in this bug.
Bill, what happens if you take your existing patch and also replace the call to nsJSUtils::ReportPendingException with a direct call to JS_ReportPendingException?
Updated•10 years ago
|
Flags: needinfo?(wmccloskey)
Reporter | ||
Comment 8•10 years ago
|
||
The original testcase I had for this was something weird, and now I don't have it anymore. I haven't had much luck writing a new testcase.
Flags: needinfo?(wmccloskey)
Comment 9•10 years ago
|
||
Ok. Bug 1070842 is also not far from landing anyway.
Comment 10•10 years ago
|
||
Bill, can you verify that any issues here are now resolved?
Flags: needinfo?(wmccloskey)
Reporter | ||
Comment 11•10 years ago
|
||
Yeah, let's close this. I'll file something if anything else pops up. Thanks.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(wmccloskey)
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•