Closed
Bug 1207512
Opened 9 years ago
Closed 9 years ago
Remove the JS_IsRunning call in nsObjectLoadingContent::ScriptRequestPluginInstance
Categories
(Core Graveyard :: Plug-ins, defect)
Core Graveyard
Plug-ins
Tracking
(firefox44 fixed)
RESOLVED
FIXED
mozilla44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: Ms2ger, Assigned: Ms2ger)
References
Details
Attachments
(1 file)
(deleted),
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
It's on the chopping block because its semantics are bogus (or so I'm told). This call was added in bug 810082 (as js::IsContextRunningJS(cx)). If anyone involved there could explain what it's supposed to mean, that'd be great.
Comment 1•9 years ago
|
||
The reason is because plugins are awful and expect to be fully transparent to JS -- if you create an object, set its type to flash, then call <object>.someFlashFunction() it is expected to immediately succeed. So, when this call asks for the plugin instance, we take special care to spawn it *right then* if not yet done.
However, this is a huge jank, as plugins suck and spawn slowly. So, the callerIsContentJS check allows this behavior to only be invoked when we're access the prototype as part of a content JS call, and be non-complaint at other times.
When that call was added it was the result of talking to several XPC/JS people, so I'm not sure what the replacement is or what purpose it serves in that conditional.
Comment 2•9 years ago
|
||
Ideally, the triggered-by-content and triggered-by-native-code cases would have orthogonal API entry points. Could you elaborate on the set of situations comprising each case?
If we can't fix it that way, replacing this with !!nsContentUtils::GetCurrentJSContext() is a better way to check whether the JS engine is active at this time.
Flags: needinfo?(john)
Comment 3•9 years ago
|
||
(Also, you should take the :johns out of your Ancient Account name, because it makes it an ambiguous match :P )
Comment 4•9 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #2)
> Ideally, the triggered-by-content and triggered-by-native-code cases would
> have orthogonal API entry points. Could you elaborate on the set of
> situations comprising each case?
>
> If we can't fix it that way, replacing this with
> !!nsContentUtils::GetCurrentJSContext() is a better way to check whether the
> JS engine is active at this time.
The cases are roughly:
[var obj = the <object>]
A) Random chrome click-to-play code
OnPluginConfigured(obj) {
pluginObjects.append( obj );
/* Do things with obj that run serious risk of requiring its prototype */
}
B) Random webpage code
obj.Hi();
...
Whenever the JS prototype is built (what used to be called DoNewResolve but I don't know the current state of things) we used to ensure the plugin was spawned if applicable so it could expose its functions on the prototype chain. This was janky, since everything touches the object all the time in chrome, essentially forcing a blocking flash-spawn nearly immediately after the <object> was created/configured. Avoiding this happening accidentally was whack-a-mole, since the chrome click-to-play code really needs to know about/touch the <object> in JS.
The fix was:
DoNewResolve() { if ( !isChromeDoingThis ) { SpawnPluginNow() } }
And evolved into the current thing. I certainly don't know enough about JS object lifetimes to say if there's a better way to do this -- the current code was the result asking someone (It might've been you!) how best to accomplish this.
Flags: needinfo?(john)
Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(bobbyholley)
Comment 5•9 years ago
|
||
Ok. If comment 4 is the motivation, I think we can just remove the JS_IsRunning call. Checking that aCx is non-null a and that the subject principal is non-system should be enough.
Flags: needinfo?(bobbyholley)
Comment 7•9 years ago
|
||
(In reply to :Ms2ger from comment #6)
> You want to do that or should I?
It's a one-line patch, but I'm guessing that johns doesn't have a recent checkout of the code, so it would be nice if you could do it. :-)
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8676830 -
Flags: review?(bobbyholley)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
Comment 9•9 years ago
|
||
Comment on attachment 8676830 [details] [diff] [review]
Remove the JS_IsRunning call in nsObjectLoadingContent::ScriptRequestPluginInstance
Review of attachment 8676830 [details] [diff] [review]:
-----------------------------------------------------------------
For reference, it looks like this was added in bug 810082.
Attachment #8676830 -
Flags: review?(bobbyholley) → review+
Comment 11•9 years ago
|
||
Comment 12•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•