Closed Bug 1257725 Opened 8 years ago Closed 8 years ago

Try to eliminate uses of ThreadsafeAutoJSContext

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(6 files)

It behaves differently on workers and mainthread if not called from JS, or will once I land the fix for bug 1255817.  So we need to either make that case MOZ_CRASH/assert, or we should just nix this class.

We'll see if I can pass around enough JSContexts....
Depends on: 1257919
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #8733069 - Flags: review?(bobbyholley)
Attachment #8733065 - Flags: review?(amarchesini) → review+
Comment on attachment 8733064 [details] [diff] [review]
part 1.  Get rid of ThreadsafeAutoJSContext usage in JSEventHandler::HandleEvent

>         for m in descriptor.interface.members:
>             if m.isAttr():
>+                if m.type.isAny():
>+                    # Add a getter that doesn't need a JSContext
>+                    extraMethods.append(
>+                        ClassMethod(
>+                            CGSpecializedGetter.makeNativeName(descriptor, m),
>+                            "void",
>+                            [Argument("JS::MutableHandle<JS::Value>",
>+                                      "aRetVal")],
>+                            const=True,
>+                            body=fill(
>+                                """
>+                                JS::ExposeValueToActiveJS(${memberName});
>+                                aRetVal.set(${memberName});
>+                                """,
>+                                memberName=CGDictionary.makeMemberName(m.identifier.name))))
>                 if getattr(m, "originatingInterface",
>                            descriptor.interface) != descriptor.interface:
>                     continue
originatingInterface stuff should be before the new stuff.
with that r+
Attachment #8733064 - Flags: review?(bugs) → review+
Attachment #8733066 - Flags: review?(bobbyholley) → review+
Comment on attachment 8733069 [details] [diff] [review]
part 6.  Get rid of ThreadsafeAutoJSContext

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

\o/
Attachment #8733069 - Flags: review?(bobbyholley) → review+
> originatingInterface stuff should be before the new stuff.

Good catch, done.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.