Closed
Bug 870553
Opened 12 years ago
Closed 11 years ago
A blocklist/whitelist for Shumway
Categories
(Firefox Graveyard :: Shumway, defect, P1)
Firefox Graveyard
Shumway
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 38
People
(Reporter: gbrown, Assigned: yury)
References
Details
Attachments
(1 file, 7 obsolete files)
|
18.60 KB,
patch
|
Details | Diff | Splinter Review |
The initial Shumway release will likely use a built-in, fixed list of supported sites: Sites serving Flash content that is known to be compatible with that version of Shumway. Over time, the list of supported sites will grow; a flexible, scalable solution is desired for determining which sites are, or perhaps which sites are not, supported. Ideally, the list could be updated independent of browser releases/updates.
| Reporter | ||
Comment 1•12 years ago
|
||
:jet -- Can you comment further on requirements?
Flags: needinfo?(bugs)
Whiteboard: [shumway]
Comment 2•12 years ago
|
||
The list may include domains/sites and SWF file URL's.
Flags: needinfo?(bugs)
| Reporter | ||
Comment 3•12 years ago
|
||
I think we can leverage nsBlocklistService.js and extend blocklist.xml to do this, similar to how bug 625160 extended the blocklist for graphics.
| Reporter | ||
Comment 4•12 years ago
|
||
This patch extends nsBlocklistService to support a list of sites supported by Shumway. In the short-term, the Shumway project needs a "white-list" -- a relatively concise list of known web locations serving flash content that Shumway can successfully decode and display. In the long-term, a "blocklist" will likely be more appropriate: all content will be supported, with hopefully just a few exceptions.
The patch allows for a new section -- <shumItems> -- in the blocklist.xml. Each <shumItem> should contain a "uri" attribute which may be a simple string or a Javascript regular expression. By default, a match against a <shumItem> uri means that the site is blocked. To allow for convenient specification of a white-list, a "type" attribute may be present; if type="allow", a match indicates that the site is not blocked (supported by Shumway).
The patch adds a single method to nsIBlocklistService -- getShumwayBlocklistState(in AString uri). If the specified uri does not match any Shumway blocklist entries or matches an explicit "allow" entry, STATE_NOT_BLOCKED is returned, indicating that the site is supported by Shumway; if the specified uri matches a "deny" Shumway blocklist entry, STATE_BLOCKED is returned and Shumway should not attempt to decode swf files at this location.
Assignee: nobody → gbrown
| Reporter | ||
Comment 5•12 years ago
|
||
Adds xpcshell tests to exercise the new api. Includes sample blocklist files demonstrating both a whitelist and a blocklist approach.
| Reporter | ||
Comment 6•12 years ago
|
||
Comment on attachment 761482 [details] [diff] [review]
(1) Extend nsBlocklistService for Shumway
:yury -- Does this seem reasonable? Any missing features? (Also have a look at the xml files in the test patch to see blocklist examples.)
Attachment #761482 -
Flags: feedback?(ydelendik)
| Assignee | ||
Comment 8•12 years ago
|
||
Comment on attachment 761482 [details] [diff] [review]
(1) Extend nsBlocklistService for Shumway
Review of attachment 761482 [details] [diff] [review]:
-----------------------------------------------------------------
In overall the solution looks good.
I would introduce third state 'probably' for sites without information. So returned states will be:
- whitelisted (STATE_NOT_BLOCKED)
- blacklisted (STATE_BLOCKED)
- no info/probably (? STATE_SOFTBLOCKED)
There is missing functionality mentioned in comment 2. That will require adding second parameter (pageUrl?) to the getShumwayBlocklistState method.
Few drive-by notes below.
::: toolkit/mozapps/extensions/nsBlocklistService.js
@@ +390,5 @@
> + this._loadBlocklist();
> + return this._getShumwayBlocklistState(uri, this._shumwayEntries);
> + },
> +
> + _getShumwayBlocklistState: function Blocklist_getShumwayBlocklistState(uri, shumwayEntries) {
This function can be inlined into getShumwayBlocklistState
@@ +411,5 @@
> + var closest = null;
> + for (let entry of aShumwayEntries) {
> + if (entry.matches instanceof RegExp &&
> + entry.matches.test(aUri) &&
> + (closest == null ||
Nit: spaces at the end
@@ +685,5 @@
> # </pluginItems>
> +# <shumwayItems>
> +# <shumwayItem uri="some uri regex" type="allow">
> +# </shumwayItem>
> +# </shumwayItems>
Incorrect example: shumItems and shumItem must be used (I would prefer shumwayItems and shumayItem though)
@@ +836,5 @@
> },
>
> + _handleShumwayItemNode: function Blocklist_handleShumwayItemNode(blocklistElement, result) {
> + var blockEntry = {
> + matches: {},
Avoid construction of the empty object since the field will be assigned below, e.g. by using |matches: null,|
::: xpcom/system/nsIBlocklistService.idl
@@ +92,5 @@
> + * A URI under consideration for Shumway redirection.
> + * @returns The STATE constant.
> + * STATE_NOT_BLOCKED means that Shumway should decode this swf.
> + */
> + unsigned long getShumwayBlocklistState(in AString uri);
Update the uuid() class attribute above
Attachment #761482 -
Flags: feedback?(ydelendik)
| Assignee | ||
Updated•12 years ago
|
Flags: needinfo?(ydelendik)
| Reporter | ||
Comment 9•12 years ago
|
||
Updated for :yury's feedback, except for:
> There is missing functionality mentioned in comment 2. That will require
> adding second parameter (pageUrl?) to the getShumwayBlocklistState method.
I had interpreted comment 2 differently. After discussing with yury on irc, I agree that a change is required -- another patch on the way.
Attachment #761482 -
Attachment is obsolete: true
| Reporter | ||
Comment 10•12 years ago
|
||
Attachment #761483 -
Attachment is obsolete: true
| Reporter | ||
Comment 11•12 years ago
|
||
In this version, each blocklist entry has 2 urls (which may be regular expressions): a host and a swf. nsIBlocklistService.getShumwayBlocklistState(host, swf) returns the blocked/soft-blocked/not-blocked state associated with the closest matching blocklist entry.
:yury -- Is this what you had in mind? Does Shumway still need this functionality?
Attachment #771438 -
Attachment is obsolete: true
Attachment #779886 -
Flags: feedback?(ydelendik)
| Reporter | ||
Comment 12•12 years ago
|
||
Attachment #771440 -
Attachment is obsolete: true
| Reporter | ||
Comment 13•12 years ago
|
||
| Reporter | ||
Comment 14•12 years ago
|
||
Just tidying my dashboard -- happy to take this back if needed.
Assignee: gbrown → nobody
| Reporter | ||
Updated•12 years ago
|
Attachment #779886 -
Flags: feedback?(ydelendik)
Updated•11 years ago
|
Blocks: shumway-m3
Component: General → Shumway
OS: Mac OS X → All
Product: Core → Firefox
Hardware: x86 → All
Updated•11 years ago
|
Assignee: nobody → dchan
Status: NEW → ASSIGNED
Comment 15•11 years ago
|
||
From irc discussions with till and yury, there are 3 states to handle for the blocklist service
STATE_BLOCKED
Run default flashplayer if installed
STATE_NOT_BLOCKED
Run Shumway
STATE_SOFTBLOCKED
Run heuristics from bug 1038444 to determine whether to use Shumway or not
There is an open question on how to handle click-to-play. We can provide buttons for running either Flash or Shumway. Alternatively we could check against the service to see if any of the above states are true.
I will have to research how the blocklist service handles redirects. AFAIK the service has only been used on "static" items, plugins / extensions which can't easily mutate. A redirect from a whitelisted URL to another site for flash content may result in unexpected results. However the worst case should be that the SWF doesn't work.
Updated•11 years ago
|
Priority: -- → P1
Updated•11 years ago
|
Updated•11 years ago
|
Whiteboard: [shumway] → [shumway:fb2?]
Comment 16•11 years ago
|
||
We need whitelist support to identify the Facebook video player.
Whiteboard: [shumway:fb2?] → [shumway:fb1]
Updated•11 years ago
|
Whiteboard: [shumway:fb1]
| Assignee | ||
Updated•11 years ago
|
Assignee: dchanm+bugzilla → ydelendik
| Assignee | ||
Comment 17•11 years ago
|
||
Extends functionality of the bug 839714: adds a whitelist of the page/object URIs. PlayPreview will be replaced soon, but this functionality is essential for first stages of the Shumway project. In the future this will be replaced.
The idea is to bypass PlayPreview (and Shumway) logic completely for page and object URLs that are not in the list. This will allow Shumway to not affect the performance of the sites it cannot handle yet.
The patch contains code that passes whitelist that is stored in "shumway.swf.whitelist" configuration variable and currently requires shumway/firefox to be restarted to be updated in PlayPreview (adding functionality to observe the changes in the configuration considered is out of scope of this bug and could be addressed later is necessary).
Attachment #779886 -
Attachment is obsolete: true
Attachment #779890 -
Attachment is obsolete: true
Attachment #8558140 -
Flags: review?(joshmoz)
Comment 18•11 years ago
|
||
Comment on attachment 8558140 [details] [diff] [review]
Adds whitelist to PlayPreview API
Review of attachment 8558140 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsObjectLoadingContent.cpp
@@ +3175,5 @@
> + mBaseURI->GetSpec(baseSpec);
> + }
> + bool whitelisted;
> + playPreviewInfo->CheckWhitelist(baseSpec, uriSpec, &whitelisted);
> + isPlayPreviewSpecified = whitelisted;
Why don't you just put the result into isPlayPreviewSpecified in the first place, skip "whitelisted"?
::: dom/plugins/base/nsPluginPlayPreviewInfo.cpp
@@ +73,5 @@
> +
> + // Parses whitelist as comma separated entries of
> + // [@page_url object_url|@page_url|object_url]
> + // where page_url and object_url pattern matches for aPageURI
> + // and aObjectURI, and performs matching as the same time.
Is there really no code we can re-use instead of adding more C++ string parsing?
@@ +80,5 @@
> + mWhitelist.EndReading(end);
> +
> + nsAutoCString pageURI(aPageURI);
> + nsAutoCString objectURI(aObjectURI);
> + nsACString::const_iterator p = start, q, r;
Better names for these variables would make this code easier to read. The brevity of a single character isn't worth it here, IMHO.
@@ +83,5 @@
> + nsAutoCString objectURI(aObjectURI);
> + nsACString::const_iterator p = start, q, r;
> + int matchResult;
> + while (p != end) {
> + bool matched = true;
Surprises me to see matched equal true by default for a whitelist.
Attachment #8558140 -
Flags: review?(joshmoz) → review+
| Assignee | ||
Comment 19•11 years ago
|
||
(In reply to Josh Aas (Mozilla Corporation) from comment #18)
> Comment on attachment 8558140 [details] [diff] [review]
> Adds whitelist to PlayPreview API
>
> Review of attachment 8558140 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/base/nsObjectLoadingContent.cpp
> @@ +3175,5 @@
> > + mBaseURI->GetSpec(baseSpec);
> > + }
> > + bool whitelisted;
> > + playPreviewInfo->CheckWhitelist(baseSpec, uriSpec, &whitelisted);
> > + isPlayPreviewSpecified = whitelisted;
>
> Why don't you just put the result into isPlayPreviewSpecified in the first
> place, skip "whitelisted"?
Fixed.
>
> ::: dom/plugins/base/nsPluginPlayPreviewInfo.cpp
> @@ +73,5 @@
> > +
> > + // Parses whitelist as comma separated entries of
> > + // [@page_url object_url|@page_url|object_url]
> > + // where page_url and object_url pattern matches for aPageURI
> > + // and aObjectURI, and performs matching as the same time.
>
> Is there really no code we can re-use instead of adding more C++ string
> parsing?
>
Pattern has a custom syntax, and I could not find anything like in the m-c yet. Also it will give us better used memory control this way.
> @@ +80,5 @@
> > + mWhitelist.EndReading(end);
> > +
> > + nsAutoCString pageURI(aPageURI);
> > + nsAutoCString objectURI(aObjectURI);
> > + nsACString::const_iterator p = start, q, r;
>
> Better names for these variables would make this code easier to read. The
> brevity of a single character isn't worth it here, IMHO.
>
Better names added/changed.
> @@ +83,5 @@
> > + nsAutoCString objectURI(aObjectURI);
> > + nsACString::const_iterator p = start, q, r;
> > + int matchResult;
> > + while (p != end) {
> > + bool matched = true;
>
> Surprises me to see matched equal true by default for a whitelist.
Changed to ignore empty match entries.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=997e95f2767b
Attachment #8558140 -
Attachment is obsolete: true
| Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
And a followup to bump some UUIDs to hopefully fix all of the mass failed tests:
https://hg.mozilla.org/integration/fx-team/rev/19e519d72708
Comment 22•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6ffcd3990378
https://hg.mozilla.org/mozilla-central/rev/19e519d72708
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 38
Updated•10 years ago
|
Product: Firefox → Firefox Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•