Closed Bug 852053 Opened 11 years ago Closed 11 years ago

Restrict the WBMP support to Firefox OS only


(Core :: Graphics: ImageLib, defect)

Gonk (Firefox OS)
Not set



blocking-b2g leo+
Tracking Status
firefox20 --- wontfix
firefox21 --- wontfix
firefox22 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- wontfix


(Reporter: schien, Assigned: schien)




(1 file, 2 obsolete files)

follow-up bug for bug 847310, WBMP should be supported only on FirefoxOS, see
Attached patch Support WBMP on FirefoxOS only (obsolete) — Splinter Review
Nexus 7 can display WBMP image in both default browser and gallery app. I suggest that we could generally support WBMP on FirefoxOS.
Test page:

try server result:
Attachment #726098 - Flags: review?(joe)
Attachment #726098 - Flags: feedback?(roc)
Attachment #726098 - Flags: review?(joe) → review+
Comment on attachment 726098 [details] [diff] [review]
Support WBMP on FirefoxOS only

We definitely shouldn't make the list of formats supported by the B2G browser different to what we support on desktop. So r- on those grounds.

As I see it our three options are:
1) Support WBMP in all circumstances on all platforms.
2) Support WBMP for FirefoxOS apps only (possibly only privileged apps, or apps with the MMS permission).
3) Don't support WBMP in Gecko at all and have the MMS app decode WBMP itself in JS.

I don't think we should take option 1 without a wider discussion in or dev.platform. Personally, I'm against it on the grounds that no-one really wants to start using WBMP on the Web --- PNG or GIF are much better and already universally supported. I prefer option 3.
Attachment #726098 - Flags: review-
Attachment #726098 - Flags: feedback?(roc)
Attachment #726098 - Flags: feedback-
I'd be fine with #2 or #3.
This patch is for option #2. 
I add nsIPrincipal check at imgRequest since I cannot get and instance of nsIPricipal in |imgLoader::GetMimeTypeFromContent| and |Image::GetDecoderType|. In this patch, if we open a URL pointed to a WBMP file in browser app on FirefoxOS, e.g., the content view will show "The image cannot be displayed because it contains errors" instead of show nothing.
@joe, do you have any suggestion on how to make it fail more gracefully?
Attachment #726098 - Attachment is obsolete: true
Attachment #727061 - Flags: review?(roc)
Attachment #727061 - Flags: review?(joe)
Comment on attachment 727061 [details] [diff] [review]
Support WBMP on FirefoxOS privileged/certified app only

Review of attachment 727061 [details] [diff] [review]:

::: image/src/imgRequest.cpp
@@ +727,5 @@
> +#ifdef MOZ_WBMP
> +    // Only support WBMP in privileged app and certified app, do not support in browser app.
> +    if (newType.EqualsLiteral(IMAGE_WBMP) &&
> +        (!mLoadingPrincipal || mLoadingPrincipal->GetAppStatus() < nsIPrincipal::APP_STATUS_PRIVILEGED)) {

It's too bad we don't get the WBMP mime type until now; it'd be really nice to refuse to load these images altogether.
Attachment #727061 - Flags: review?(joe) → review+
skip all WBMP reftest cases on B2G platform because decoding WBMP in browser app is not allowed. carry r+ since no logic change.
Attachment #727061 - Attachment is obsolete: true
Attachment #730108 - Flags: review+
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Flags: in-moztrap-
You need to log in before you can comment on or make changes to this bug.