Closed
Bug 549682
Opened 16 years ago
Closed 15 years ago
Port the message-manager API to mozilla-central
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: benjamin, Assigned: smaug)
References
(Depends on 2 open bugs)
Details
(Keywords: dev-doc-complete)
Attachments
(4 files, 4 obsolete files)
61.16 KB,
patch
|
Details | Diff | Splinter Review | |
10.32 KB,
patch
|
Details | Diff | Splinter Review | |
89.94 KB,
patch
|
jst
:
review+
|
Details | Diff | Splinter Review |
89.98 KB,
patch
|
Details | Diff | Splinter Review |
As soon as the message-manager API is reasonably stable-seeming, we should port it to mozilla-central so that code can start transitioning to it without having e10s ifdefs.
Assignee | ||
Comment 1•16 years ago
|
||
This is a dup of bug 534254, but I'll mark that to be a dup of this.
And yes, I plan to do this once the API is reasonable stable.
Assignee | ||
Comment 3•15 years ago
|
||
Assignee | ||
Comment 4•15 years ago
|
||
This has basically all the same tests as for e10s mm, but without CPOW
(which is something in-process-mm won't support, since CPOWs will be removed
from e10s too)
Assignee | ||
Comment 5•15 years ago
|
||
This should behave pretty closely like e10s-mm.
Attachment #443869 -
Flags: review?(jst)
Assignee | ||
Comment 6•15 years ago
|
||
When merging e10s to m-c, some of the code duplication can be removed.
Assignee | ||
Comment 7•15 years ago
|
||
Doug, would be great if this could be tested with Fennec.
Assignee | ||
Comment 8•15 years ago
|
||
Seem like the patch may not apply quite clean with trunk, at least not without
some --fuzz
Assignee | ||
Comment 9•15 years ago
|
||
updated patch coming..
Assignee | ||
Comment 10•15 years ago
|
||
Attachment #443869 -
Attachment is obsolete: true
Attachment #443872 -
Flags: review?(jst)
Attachment #443869 -
Flags: review?(jst)
Assignee | ||
Comment 11•15 years ago
|
||
One thing I may need to change, and which would work differently than in
E10s is script loading.
In E10s it happens asynchronously, but I think in non-E10s it should
happen sync so that scripts are ready when the page is being loaded.
The change would be trivial; just don't use nsAsyncScriptLoader,
but call LoadRemoteScript in LoadScript.
Assignee | ||
Comment 12•15 years ago
|
||
And to clarify, the patch is for m-c, not for e10s branch.
Assignee | ||
Comment 13•15 years ago
|
||
Hmm, tryserver doesn't seem to like the patch.
I need to look at the failures.
But I think it is still ok to review the patch.
Assignee | ||
Comment 14•15 years ago
|
||
(In reply to comment #13)
> Hmm, tryserver doesn't seem to like the patch.
...which is not very surprising. Changing how events are propagated is
rather regression risky.
![]() |
||
Comment 15•15 years ago
|
||
Tried this patch out with e10s Fennec, and this gets us a long way towards the goal of working with remote and non-remote browsers. Great work!
Assignee | ||
Comment 16•15 years ago
|
||
Thanks for testing. I'll try to fix the tryserver failures today/tomorrow and
I'll probably change the script loading to happen synchronously.
Assignee | ||
Comment 17•15 years ago
|
||
The previous patch was missing the case where frameloaders are swapped.
I think that is a case which isn't handled at all in E10s atm.
Attachment #443872 -
Attachment is obsolete: true
Attachment #444389 -
Flags: review?(jst)
Attachment #443872 -
Flags: review?(jst)
Assignee | ||
Comment 18•15 years ago
|
||
Locally chrome tests pass now, but I posted the patch anyway to tryserver.
Assignee | ||
Comment 19•15 years ago
|
||
Uh, tryserver doesn't like the patch. Investigating.
Assignee | ||
Comment 20•15 years ago
|
||
Yet another patch. Crossing fingers, maybe tryserver likes this.
At least testing this locally looks promising.
The previous patch was actually unlinking too much in some cases.
Attachment #444389 -
Attachment is obsolete: true
Attachment #444478 -
Flags: review?(jst)
Attachment #444389 -
Flags: review?(jst)
Assignee | ||
Comment 21•15 years ago
|
||
The latest patch seems to have passed tests on tryserver, though
some random looking orange in some builds.
Assignee | ||
Comment 22•15 years ago
|
||
Comment on attachment 444478 [details] [diff] [review]
patch
Bah, I found still something to fix. And chrome tests are coming too.
Attachment #444478 -
Flags: review?(jst)
Assignee | ||
Comment 23•15 years ago
|
||
JSPrincipal handling is extremely ugly, and not documented at all.
This patch doesn't leak principals anymore. I'll fix E10s in bug 565175
(if the problem is also in E10s).
Attachment #444478 -
Attachment is obsolete: true
Assignee | ||
Updated•15 years ago
|
Attachment #444767 -
Flags: review?(jst)
Assignee | ||
Comment 24•15 years ago
|
||
Comment on attachment 444767 [details] [diff] [review]
v7
Tryserver liked this better :)
Comment 25•15 years ago
|
||
Comment on attachment 444767 [details] [diff] [review]
v7
Looks good.
Attachment #444767 -
Flags: review?(jst) → review+
Assignee | ||
Comment 26•15 years ago
|
||
Landed http://hg.mozilla.org/mozilla-central/rev/b62ac40565f2
But let's see if that works before marking this fixed.
Comment 27•15 years ago
|
||
In nsContentUtils.cpp:
7.38 - if (!aDoc->GetWindow()->GetChromeEventHandler())
7.39 +
7.40 + nsPIDOMEventTarget* piTarget = aDoc->GetWindow()->GetChromeEventHandler();
7.41 + if (!target)
7.42 return NS_ERROR_INVALID_ARG;
Shouldn't this check for piTarget instead?
Assignee | ||
Comment 28•15 years ago
|
||
Indeed. Thanks!
I'll fix in a followup hg push, if the patch keeps tbox green.
Assignee | ||
Comment 29•15 years ago
|
||
Backed out. There is some crash.
http://hg.mozilla.org/mozilla-central/rev/5127e4bfa127
Assignee | ||
Comment 30•15 years ago
|
||
This fixes also the piTarget thing.
I'll push this. At least locally I can't reproduce the problem tbox showed.
Assignee | ||
Comment 31•15 years ago
|
||
Only known oranges. Marking fixed.
Please open new bugs for issues and feature requests.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
smaug, these changes make for a tricky merge of m-c to e10s. Do you mind doing it?
Comment 33•15 years ago
|
||
I was looking at this checkin while merging TM, and it looks there are a lot of JSAPI calls with unchecked return values. What's up with that?
Assignee | ||
Comment 34•15 years ago
|
||
What *a lot calls* with unchecked return values?
It is ok, IMO, if JS_DefineProperty fails in this case, and in other cases the
return value is checked.
There is also no need to check the return value of JS_EvaluateUCScriptForPrincipals, as far as I see.
And about merging, yes, I guess I need to do that.
Before starting to write the patch I was arguing that it should be written
for e10s, not m-c, but others didn't agree.
![]() |
||
Comment 35•15 years ago
|
||
(In reply to comment #34)
> What *a lot calls* with unchecked return values?
> It is ok, IMO, if JS_DefineProperty fails in this case, and in other cases the
> return value is checked.
> There is also no need to check the return value of
> JS_EvaluateUCScriptForPrincipals, as far as I see.
It's not ok to fail to report an uncaught exception. Is this API call guaranteed to be happening when cx has no active frames on it (!JS_IsActive(cx))?
If so, ok; the engine will report uncaught exceptions as this API unwinds (there is a JS context option, JSOPTION_DONT_REPORT_UNCAUGHT, that you can set to avoid this default behavior).
If not, then you are adding hard-to-find bugs by suppressing failure (exception, error) instead of propagating it.
/be
Assignee | ||
Comment 36•15 years ago
|
||
MDC documentation doesn't say anything about handling uncaught exceptions.
It says just "On success, JS_DefineProperty returns JS_TRUE. If the property already exists or cannot be created, JS_DefineProperty returns JS_FALSE."
And for JS_EvaluateUCScriptForPrincipals, the code comes from e10s content
process, where there isn't any place to report any exceptions (currently).
And MDC says just "If the script compiles and executes successfully, *rval receives the value from the last-executed expression statement processed in the script, and JS_EvaluateScriptForPrincipals or JS_EvaluateUCScriptForPrincipals returns JS_TRUE. Otherwise it returns JS_FALSE, and the value left in *rval is undefined. "
Nothing about exceptions. Based on that how could API user know that
one should handle the return value?
(jsapi.h is even more scarce than MDC)
Assignee | ||
Comment 37•15 years ago
|
||
And how does the exception propagate from JS_EvaluateUCScriptForPrincipals?
Does it propagate to caller? (Which should be JS). That would be
pretty reasonable behavior for loadFrameScript().
![]() |
||
Comment 38•15 years ago
|
||
jsapi.h docs are on MDC, not in the .h file itself; see specifically
https://developer.mozilla.org/En/SpiderMonkey/JSAPI_User_Guide#Errors_and_exceptions
See also
https://developer.mozilla.org/En/SpiderMonkey/JSAPI_Phrasebook
jst and mrbkap know the drill; so do others.
/be
Comment 39•15 years ago
|
||
This is what I spotted:
179 JS_Stringify(ctx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
(unchecked)
213 for (PRUint32 i = 0; i < len; ++i) {
214 jsval ret = JSVAL_VOID;
215 nsAutoGCRoot root(&ret, &rv);
216 NS_ENSURE_SUCCESS(rv, rv);
217 JSONParser* parser = JS_BeginJSONParse(ctx, &ret);
(needs null check)
218 JSBool ok = JS_ConsumeJSONText(ctx, parser, (jschar*)retval[i].get(),
219 (uint32)retval[i].Length());
220 ok = JS_FinishJSONParse(ctx, parser, JSVAL_NULL) && ok;
221 if (ok) {
222 dest[i] = ret;
223 }
(loop continues after failure)
224 }
403 JS_CallFunctionValue(mContext, thisObject,
404 funval, 1, argv, &rval);
(unchecked)
408 JS_Stringify(mContext, &rval, nsnull, JSVAL_NULL,
409 JSONCreator, &json)) {
(unchecked)
Comment 40•15 years ago
|
||
+ nsCOMPtr<nsIContentFrameMessageManager> mm = mChildManagers[i];
This needs to become
+ nsCOMPtr<nsIContentFrameMessageManager> mm = do_QueryInterface(mChildManagers[i]);
probably due to a recent change in e10s? .... want a new bug for this?
Comment 41•15 years ago
|
||
dev-doc-needed: https://wiki.mozilla.org/Content_Process_Event_Handlers
Keywords: dev-doc-needed
Comment 42•15 years ago
|
||
I have written this up. Due to its deeply technical nature, I would appreciate it if someone would give it a thorough reading-over to ensure there's nothing painfully misleading here.
Added this page:
https://developer.mozilla.org/en/Content_process_event_handling
Also added the following reference pages:
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIFrameLoader
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIChromeFrameMessageManager
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIFrameMessageListener
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIContentFrameMessageManager
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIInProcessContentFrameMessageManager
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsISyncMessageSender
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIFrameLoaderOwner
Keywords: dev-doc-needed → dev-doc-complete
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•