Closed
Bug 952840
Opened 11 years ago
Closed 11 years ago
Remove a few gotos in XPConnect
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: mccr8, Assigned: mccr8)
References
Details
Attachments
(3 files, 1 obsolete file)
2.22 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
1.16 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
2.29 KB,
patch
|
mccr8
:
checkin-
|
Details | Diff | Splinter Review |
There are a few gotos sitting around that are fairly gratuitous.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #8351206 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 2•11 years ago
|
||
arr.get() only returns null if the second argument to its constructor is null,
but here it is being infallibly allocated.
Attachment #8351207 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 3•11 years ago
|
||
Rather than checking one condition, doing a goto on failure, then checking another
condition and doing a goto on failure, just check both conditions at once.
Attachment #8351208 -
Flags: review?(bobbyholley+bmo)
Comment 4•11 years ago
|
||
Comment on attachment 8351208 [details] [diff] [review]
part 3 - Get rid of goto in nsXPConnect::CheckForDebugMode.
Review of attachment 8351208 [details] [diff] [review]:
-----------------------------------------------------------------
Would be better to swap the cases around, I think. It's not really common to have the failure case run off the end of the function.
::: js/xpconnect/src/nsXPConnect.cpp
@@ +1218,5 @@
> const char jsdServiceCtrID[] = "@mozilla.org/js/jsd/debugger-service;1";
> nsCOMPtr<jsdIDebuggerService> jsds = do_GetService(jsdServiceCtrID, &rv);
> + if (NS_SUCCEEDED(rv) && JS_SetDebugModeForAllCompartments(cx, gDesiredDebugMode)) {
> + if (gDesiredDebugMode) {
> + rv = jsds->ActivateDebugger(rt);
Dead assignment
Assignee | ||
Comment 5•11 years ago
|
||
Comment on attachment 8351208 [details] [diff] [review]
part 3 - Get rid of goto in nsXPConnect::CheckForDebugMode.
Good points.
Attachment #8351208 -
Flags: review?(bobbyholley+bmo)
Comment 6•11 years ago
|
||
Comment on attachment 8351206 [details] [diff] [review]
part 1 - Eliminate goto in XPCWrappedNative::FindTearOff.
Review of attachment 8351206 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/xpconnect/src/XPCWrappedNative.cpp
@@ +1513,5 @@
> to = newChunk->mTearOffs;
> }
>
> {
> + // Scope keeps |tearoff| from leaking across the rest of the function.
Yes, but this isn't really relevant anymore. There's not really any harm in just unscoping this AFAICT. Can you do that?
Attachment #8351206 -
Flags: review?(bobbyholley+bmo) → review+
Comment 7•11 years ago
|
||
Comment on attachment 8351207 [details] [diff] [review]
part 2 - Get rid of one goto in XPCNativeSet::GetNewOrUsed.
Review of attachment 8351207 [details] [diff] [review]:
-----------------------------------------------------------------
This makes me lol. Blame says this was either jst or jband. Let's say it was jband. ;-)
Attachment #8351207 -
Flags: review?(bobbyholley+bmo) → review+
Assignee | ||
Comment 8•11 years ago
|
||
Rather than checking one condition, doing a goto on failure, then checking another
condition and doing a goto on failure, just check both conditions at once.
Assignee | ||
Updated•11 years ago
|
Attachment #8351208 -
Attachment is obsolete: true
Assignee | ||
Comment 9•11 years ago
|
||
As noted by Ms2ger, we're ignoring failures of ActivateDebugger. Steve, should we not do that? What should happen in the case of those failures, the same stuff as we do in the other failure cases?
Flags: needinfo?(sphink)
Comment 10•11 years ago
|
||
Ignoring it looks bad. I think you need to JS_SetDebugModeForAllCompartments(cx, false) in that case, then do the rest of the current failure handling. You can ignore the return value of JS_SetDebugModeForAllCompartments when turning it off for error handling.
Flags: needinfo?(sphink)
Assignee | ||
Comment 11•11 years ago
|
||
I'll file a followup to deal with the debug stuff, as it will affect how I want to eliminate the goto.
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/2cb3e4d522cc
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/64cfe4a6eafa
Assignee | ||
Updated•11 years ago
|
Attachment #8355279 -
Flags: checkin-
Assignee | ||
Comment 12•11 years ago
|
||
Woops, forgot to unscope. Followup:
https://hg.mozilla.org/integration/mozilla-inbound/rev/99eb8a370b21
Comment 13•11 years ago
|
||
had to backout this changes for testfailures like https://tbpl.mozilla.org/php/getParsedLog.php?id=32623378&tree=Mozilla-Inbound
Comment 14•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2cb3e4d522cc
https://hg.mozilla.org/mozilla-central/rev/64cfe4a6eafa
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Assignee | ||
Updated•11 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 15•11 years ago
|
||
So it was actually only the unscoping that got backed out, it looks like:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ce408ac339c5
Somehow this was causing permaorange in B2G ICS Emulator Opt M2.
The failures are:
2050 ERROR TEST-UNEXPECTED-FAIL | /tests/content/events/test/test_bug864040.html | TEXTAREA: failed to set selection
2058 ERROR TEST-UNEXPECTED-FAIL | /tests/content/events/test/test_bug864040.html | DIV: failed to set selection
01-07 15:30:51.987 706 706 I GeckoDump: 2050 ERROR TEST-UNEXPECTED-FAIL | /tests/content/events/test/test_bug864040.html | TEXTAREA: failed to set selection
01-07 15:30:52.827 706 706 I GeckoDump: 2058 ERROR TEST-UNEXPECTED-FAIL | /tests/content/events/test/test_bug864040.html | DIV: failed to set selection
I guess the destructor for AutoMarkingWrappedNativeTearOffPtr is being called after we decide what to return, so we end up returning the wrong value. I was wondering about that, but I guess I should have looked it up before changing it.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 16•11 years ago
|
||
Filed bug 957191 for the part 3 stuff.
You need to log in
before you can comment on or make changes to this bug.
Description
•