Closed
Bug 674436
Opened 13 years ago
Closed 13 years ago
NS_ENSURE_TRUE(JS_GetProperty(ctx, object, "receiveMessage", &funval) with message manager and sandboxes
Categories
(Core :: IPC, defect)
Tracking
()
RESOLVED
FIXED
mozilla8
People
(Reporter: Felipe, Assigned: jdm)
References
Details
Attachments
(1 file, 1 obsolete file)
2.17 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
I've been trying to add mm listeners using the Scratchpad, but whenever a message is received, I get the following error and the listener is not called: WARNING: NS_ENSURE_TRUE(JS_GetProperty(ctx, object, "receiveMessage", &funval) && JSVAL_IS_OBJECT(funval) && !JSVAL_IS_NULL(funval)) failed: file c:/moz/mozilla -central/ff-debug/content/base/src/../../../../mozilla/content/base/src/nsFrameMessageManager.cpp, line 436 How to reproduce: ----------------- set the pref devtools.chrome.enabled = true Open Scratchpad (Shift + F4) and set Environment -> Browser type this code in the text area, select all the text and choose Execute -> Run: /***** begin *****/ gBrowser.selectedBrowser.messageManager.addMessageListener("z", function(o) { alert(o.json.q); }); gBrowser.selectedBrowser.messageManager.loadFrameScript('data:,sendAsyncMessage("z", {q: "bar"})', false); /***** end *****/ ########### What causes it is that the Scratchpad runs the code through a sandbox prototyped with the browser window. The actual code boils down to: /*** begin ***/ var mm = gBrowser.selectedBrowser.messageManager; var win = Services.wm.getMostRecentWindow("navigator:browser"); var sand = new Cu.Sandbox(win, {sandboxPrototype:win}); var sandboxscript = "gBrowser.selectedBrowser.messageManager.addMessageListener('z', function(o) { alert(o.json.q);});" Cu.evalInSandbox(sandboxscript, sand); mm.loadFrameScript('data:,sendAsyncMessage("z", {q: "bar"})', false); /*** end ***/
Assignee | ||
Comment 1•13 years ago
|
||
Attachment #548678 -
Flags: review?(Olli.Pettay)
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → josh
Assignee | ||
Comment 2•13 years ago
|
||
Comment on attachment 548678 [details] [diff] [review] Relax message listener restrictions to allow callable proxies. There's nothing wrong with this patch, but I just noticed the other call to JS_IsObjectFunction in the other branch. We should probably nix that too, because I suspect that the current testcase with an object that has receiveMessage would probably fail similarly.
Attachment #548678 -
Attachment is obsolete: true
Attachment #548678 -
Flags: review?(Olli.Pettay)
Assignee | ||
Comment 3•13 years ago
|
||
Attachment #548880 -
Flags: review?(Olli.Pettay)
Updated•13 years ago
|
Attachment #548880 -
Flags: review?(Olli.Pettay) → review+
Reporter | ||
Comment 4•13 years ago
|
||
thanks Josh! http://hg.mozilla.org/integration/mozilla-inbound/rev/3d3f25a67e24
Whiteboard: [inbound]
Comment 6•13 years ago
|
||
I think it has nothing to do with those failures, my suspect is that the Android ndk changes are causing them (mozilla central has same failures)
Comment 7•13 years ago
|
||
relanded http://hg.mozilla.org/integration/mozilla-inbound/rev/c2ab7a1d1350
Whiteboard: [inbound]
Comment 9•13 years ago
|
||
it was not, I relanded it :) http://hg.mozilla.org/mozilla-central/rev/c2ab7a1d1350
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
You need to log in
before you can comment on or make changes to this bug.
Description
•