Closed Bug 872135 Opened 11 years ago Closed 11 years ago

Use the SafeJSContext in nsXPConnect::CheckForDebugMode

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(1 file)

The stuff it does right now seems pretty darn crazy, and it's not clear to me why it's necessary at all. I'll write a patch and see what try has to say.
Blocks: 855903
Last patch was infinite recursion fail. This patch passes what limited JSD
test coverage we have, so it probably isn't worth pushing to try again. Flagging
gabor for review.
Attachment #750781 - Flags: review?(gkrizsanits)
Comment on attachment 750781 [details] [diff] [review]
Use the SafeJSContext in nsXPConnect::CheckForDebugMode. v2

Review of attachment 750781 [details] [diff] [review]:
-----------------------------------------------------------------

-    if (!NS_IsMainThread()) {
-        return;
-    }
+    if (!NS_IsMainThread())
+        MOZ_CRASH();

missing {}
Attachment #750781 - Flags: review?(gkrizsanits) → review+
+    if (!JS_SetDebugModeForAllCompartments(unpushedCx, gDesiredDebugMode))
         goto fail;

{}
XPConnect uses JS style which doesn't always require braces.
(In reply to Andrew McCreight [:mccr8] from comment #5)
> XPConnect uses JS style which doesn't always require braces.

That's totally true. I would argue that mixing 2 styles in one function is wrong... but I'll let Bobby decide what he prefers.
https://hg.mozilla.org/mozilla-central/rev/6869a88c9461
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Comment on attachment 750781 [details] [diff] [review]
Use the SafeJSContext in nsXPConnect::CheckForDebugMode. v2

Review of attachment 750781 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/xpconnect/src/nsXPConnect.cpp
@@ +21,5 @@
>  #include "nsNullPrincipal.h"
>  #include "nsIURI.h"
>  #include "nsJSEnvironment.h"
>  #include "nsThreadUtils.h"
> +#include "nsContentUtils.h"

Out of interest, why?
(In reply to :Ms2ger from comment #9)
> Out of interest, why?

Must have been an artifact of the earlier iteration of the patch. Seems to build fine without it. Pushed a fix:

https://hg.mozilla.org/integration/mozilla-inbound/rev/cd114424cc86
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: