Closed
Bug 797043
Opened 14 years ago
Closed 14 years ago
Clean up nsObjectLoadingContent mActivated state
Categories
(Core Graveyard :: Plug-ins, defect)
Core Graveyard
Plug-ins
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla19
People
(Reporter: johns, Assigned: johns)
References
Details
Attachments
(3 files, 5 obsolete files)
GetActivated() behaves like GetShouldActivate(), and mActivated lives as long as the object such that swapping vulnerable plugin types in to a clicked-on object doesn't re-trigger a click-to-play warning.
| Assignee | ||
Comment 1•14 years ago
|
||
| Assignee | ||
Comment 2•14 years ago
|
||
| Assignee | ||
Comment 3•14 years ago
|
||
Dumb whitespace error
| Assignee | ||
Updated•14 years ago
|
Attachment #667201 -
Attachment is obsolete: true
| Assignee | ||
Comment 4•14 years ago
|
||
Comment on attachment 667200 [details] [diff] [review]
Better handling for plugin activated state for click-to-play
This should cause mActivated to reset when the effective content type changes. As a bonus, calling PlayPlugin() on a playing-plugin is now a no-op, so the front-end can use much simpler logic around it.
Attachment #667200 -
Flags: feedback?(dkeeler)
| Assignee | ||
Updated•14 years ago
|
Attachment #667206 -
Flags: feedback?(dkeeler)
| Assignee | ||
Comment 5•14 years ago
|
||
Comment 6•14 years ago
|
||
Comment on attachment 667200 [details] [diff] [review]
Better handling for plugin activated state for click-to-play
Review of attachment 667200 [details] [diff] [review]:
-----------------------------------------------------------------
Great - I think this is exactly what we want.
::: content/base/src/nsObjectLoadingContent.cpp
@@ +2518,2 @@
> mPlayPreviewCanceled = true;
> +
Looks like some whitespace here.
Attachment #667200 -
Flags: feedback?(dkeeler) → feedback+
| Assignee | ||
Updated•14 years ago
|
Attachment #667200 -
Flags: review?(joshmoz)
| Assignee | ||
Updated•14 years ago
|
Attachment #667206 -
Flags: review?(joshmoz)
Comment 7•14 years ago
|
||
Comment on attachment 667206 [details] [diff] [review]
Tests v2
Review of attachment 667206 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good - just a couple of comments.
::: browser/base/content/test/browser_pluginnotification.js
@@ +762,5 @@
> + var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
> + is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 21, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
> +
> + // Activate
> + objLoadingContent.playPlugin();
Is playPlugin synchronous? You might have to use waitForCondition (see, e.g., lines 245-6).
@@ +769,5 @@
> +
> + // Reload plugin
> + var oldVal = pluginNode.getObjectValue();
> + pluginNode.src = pluginNode.src;
> + is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 21, Plugin should have retained activated state");
should you check that pluginNode.activated is still true?
@@ +793,5 @@
> + var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
> + is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 22, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
> +
> + // Activate
> + objLoadingContent.playPlugin();
same as other playPlugin comment
@@ +803,5 @@
> + pluginNode.src = pluginNode.src; // We currently don't properly change state just on type change, bug 767631
> + is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 22, plugin should be unloaded");
> + pluginNode.type = "application/x-test";
> + pluginNode.src = pluginNode.src;
> + is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 22, Plugin should not have activated");
check pluginNode.activated is false?
Attachment #667206 -
Flags: feedback?(dkeeler) → feedback+
| Assignee | ||
Comment 8•14 years ago
|
||
(In reply to David Keeler from comment #7)
> Is playPlugin synchronous? You might have to use waitForCondition (see,
> e.g., lines 245-6).
Currently it will change object state synchronously, I added the check for the plugin-reload below it to ensure that if we change this in the future the test will break, but there's no real defined behavior yet.
> should you check that pluginNode.activated is still true?
> ...
> check pluginNode.activated is false?
Added
Attachment #667206 -
Attachment is obsolete: true
Attachment #667206 -
Flags: review?(joshmoz)
Attachment #667220 -
Flags: review?(joshmoz)
Comment 9•14 years ago
|
||
Try run for f772a3ce1bf8 is complete.
Detailed breakdown of the results available here:
https://tbpl.mozilla.org/?tree=Try&rev=f772a3ce1bf8
Results (out of 91 total builds):
success: 85
warnings: 6
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/jschoenick@mozilla.com-f772a3ce1bf8
Comment 10•14 years ago
|
||
Comment on attachment 667200 [details] [diff] [review]
Better handling for plugin activated state for click-to-play
Review of attachment 667200 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/base/src/nsObjectLoadingContent.cpp
@@ +2486,5 @@
> + }
> +
> + // If we're in a click-to-play or play preview state, we need to reload
> + if (mType == eType_Null && (mFallbackType == eFallbackPlayPreview ||
> + mFallbackType == eFallbackClickToPlay)) {
Aren't there other states we can be in where a click should lead to playing the plugin, like eFallbackVulnerableNoUpdate or eFallbackOutdated? Why only allow loading for these two types here?
| Assignee | ||
Comment 11•14 years ago
|
||
| Assignee | ||
Updated•14 years ago
|
Attachment #667200 -
Flags: review?(joshmoz)
| Assignee | ||
Comment 12•14 years ago
|
||
Comment on attachment 667743 [details] [diff] [review]
Add canActivate and track plugin-replacement types
(In reply to Josh Aas (Mozilla Corporation) from comment #10)
> Aren't there other states we can be in where a click should lead to playing
> the plugin, like eFallbackVulnerableNoUpdate or eFallbackOutdated? Why only
> allow loading for these two types here?
This is a good point, we don't really have a definitive list of what types are 'plugin-replacing' like this.
This patch explicitly denotes that all fallback types >= eFallbackClickToPlay are 'activatable' types and adds a (chrome-only) canActivate parameter, so the other patch can just gate PlayPlugin() on this
@david does this look sane?
Attachment #667743 -
Flags: feedback?(dkeeler)
Comment 13•14 years ago
|
||
Comment on attachment 667743 [details] [diff] [review]
Add canActivate and track plugin-replacement types
Review of attachment 667743 [details] [diff] [review]:
-----------------------------------------------------------------
Unfortunately, PLUGIN_PLAY_PREVIEW is handled (in browser-plugins.js) separately from PLUGIN_CLICK_TO_PLAY and friends, so I don't think it makes sense to have canActivate be all values >= PLUGIN_CLICK_TO_PLAY. Maybe we could move PLUGIN_PLAY_PREVIEW to be less than PLUGIN_CLICK_TO_PLAY?
::: content/base/public/nsIObjectLoadingContent.idl
@@ +48,5 @@
> // Suppressed by security policy
> const unsigned long PLUGIN_SUPPRESSED = 6;
> // Blocked by content policy
> const unsigned long PLUGIN_USER_DISABLED = 7;
> + /// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that
If we do go ahead with this, maybe we want to leave some space for future non-click-to-play plugin types?
Attachment #667743 -
Flags: feedback?(dkeeler)
| Assignee | ||
Comment 14•14 years ago
|
||
Attachment #667200 -
Attachment is obsolete: true
Attachment #667743 -
Attachment is obsolete: true
| Assignee | ||
Comment 15•14 years ago
|
||
Comment on attachment 668133 [details] [diff] [review]
Better handling for plugin activated state for click-to-play
Alright, lets scrap the canActivate part -- the frontend needs to be aware of the available types either way, so it's fairly superfluous. This is the same as the original patch except it adds explicit notes that types >= PLUGIN_CLICK_TO_PLAY are plugin-replacement-types so we don't need to list them.
Attachment #668133 -
Flags: review?(joshmoz)
| Assignee | ||
Comment 16•14 years ago
|
||
And now it's actually different instead of the same patch!
Attachment #668133 -
Attachment is obsolete: true
Attachment #668133 -
Flags: review?(joshmoz)
Attachment #668137 -
Flags: review?(joshmoz)
Comment 17•14 years ago
|
||
Comment on attachment 668137 [details] [diff] [review]
Better handling for plugin activated state for click-to-play
Review of attachment 668137 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/base/src/nsObjectLoadingContent.cpp
@@ +2487,5 @@
> +
> + // If we're in a click-to-play or play preview state, we need to reload
> + // Fallback types >= eFallbackClickToPlay are plugin-replacement types, see
> + // header
> + if (mType == eType_Null && mFallbackType >= eFallbackClickToPlay) {
The "mType == eType_Null" check seems fine, but is it really necessary? In what situation would we be executing ::PlayPlugin with "mType != eType_Null"?
Attachment #668137 -
Flags: review?(joshmoz) → review+
Attachment #667220 -
Flags: review?(joshmoz) → review+
| Assignee | ||
Comment 18•14 years ago
|
||
Comment on attachment 668137 [details] [diff] [review]
Better handling for plugin activated state for click-to-play
pushed:
https://hg.mozilla.org/integration/mozilla-inbound/rev/47a7448b83c6
try:
https://tbpl.mozilla.org/?tree=Try&rev=30d760e21a02
Attachment #668137 -
Flags: review+
| Assignee | ||
Updated•14 years ago
|
Attachment #667220 -
Flags: checkin+
| Assignee | ||
Updated•14 years ago
|
Attachment #668137 -
Flags: review+ → checkin+
Comment 19•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
| Assignee | ||
Comment 20•14 years ago
|
||
Argh, so, |mType != eType_Null| is wrong here, because we'd implicitly activate
type Loading, which is never inspected by CTP (as the MIME type is not yet
known). Changing this to only actually activate plugin types is much saner, and
as a bonus, if a document reloads and is suddenly handled by a plugin, we'll CTP
the plugin (since previous load was based on the assumption the type was native).
| Assignee | ||
Comment 21•14 years ago
|
||
Comment on attachment 672987 [details] [diff] [review]
Followup, only implicitly click-to-play activate actual plugin types
david, will this cause front end issues by not activating images/documents? PlayPlugin() wont reload said types, and they're never checked for CTP as is anyway, so I'd think it would be sane
Attachment #672987 -
Flags: feedback?(dkeeler)
| Assignee | ||
Updated•14 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 22•14 years ago
|
||
Comment on attachment 672987 [details] [diff] [review]
Followup, only implicitly click-to-play activate actual plugin types
Review of attachment 672987 [details] [diff] [review]:
-----------------------------------------------------------------
We only use the activated property for plugins, as far as I know, so I don't think there would be a problem with images/documents.
Attachment #672987 -
Flags: feedback?(dkeeler) → feedback+
| Assignee | ||
Updated•14 years ago
|
Attachment #672987 -
Flags: review?(joshmoz)
Comment 23•14 years ago
|
||
Try run for 2c89e09e5806 is complete.
Detailed breakdown of the results available here:
https://tbpl.mozilla.org/?tree=Try&rev=2c89e09e5806
Results (out of 49 total builds):
success: 46
warnings: 3
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/jschoenick@mozilla.com-2c89e09e5806
Attachment #672987 -
Flags: review?(joshmoz) → review+
| Assignee | ||
Comment 24•14 years ago
|
||
Comment on attachment 672987 [details] [diff] [review]
Followup, only implicitly click-to-play activate actual plugin types
https://hg.mozilla.org/integration/mozilla-inbound/rev/64c5c57132e8
Attachment #672987 -
Flags: checkin+
Comment 25•14 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Updated•4 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•