Closed Bug 663823 Opened 9 years ago Closed 8 years ago

Cross-domain textures generate NS_ERROR_FAILURE instead of NS_ERROR_DOM_SECURITY_ERR

Categories

(Core :: Canvas: WebGL, defect)

5 Branch
x86
Windows 7
defect
Not set

Tracking

()

VERIFIED FIXED
mozilla7
Tracking Status
firefox5 - ---
firefox6 - fixed

People

(Reporter: scoobidiver, Unassigned)

References

()

Details

(Keywords: regression)

Attachments

(1 file)

The Color Adjust demo is blue in Firefox 5.0b5. It is OK in 4.0.1.

The Web Console shows an infinite loop of the following error:
uncaught exception: [Exception... "Failure arg 6 [nsIDOMWebGLRenderingContext.texSubImage2D]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: http://webglsamples.googlecode.com/hg/color-adjust/color-adjust.html :: render :: line 437"  data: no]
Just before the exception, I get this in the JS console:

Warning: WebGL: It is forbidden to load a WebGL texture from a cross-domain element. See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures
Source File: http://webglsamples.googlecode.com/hg/color-adjust/color-adjust.html
Line: 437

So this is just another demo broken by bug 656277. A tracking bug for such demos has been opened: bug 662570.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 656277
Duplicate of bug: 662570
...though, you should have gotten a DOM_SECURITY_ERR error here... investigating.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Summary: Color Adjust Demo is blue: Infinite Failure arg 6 [nsIDOMWebGLRenderingContext.texSubImage2D] (NS_ERROR_FAILURE) → Cross-domain textures generate NS_ERROR_FAILURE instead of NS_ERROR_DOM_SECURITY_ERR
Attached patch patchSplinter Review
This is a quite stupid patch in already stupid code; the reason why it's so dumb is that it has to determine whether the argument is a DOMElement or ImageData and we don't have a real ImageData interface, see bug 637077, so it has to use duck typing. We should revisit this whole code once bug 637077 is fixed.
Attachment #538928 - Flags: review?(jmuizelaar)
We'll live with the incorrect error for Firefox 5, tracking-firefox5:-
(In reply to comment #5)
> We'll live with the incorrect error for Firefox 5, tracking-firefox5:-
The main issue is not about an incorrect error but about a non-working Google demo (regression from 4.0.1).
(In reply to comment #6)
> (In reply to comment #5)
> > We'll live with the incorrect error for Firefox 5, tracking-firefox5:-
> The main issue is not about an incorrect error but about a non-working
> Google demo (regression from 4.0.1).

This is a known unavoidable problem, see bug 662570 and 
http://hacks.mozilla.org/2011/06/cross-domain-webgl-textures-disabled-in-firefox-5/
Attachment #538928 - Flags: review?(jmuizelaar) → review+
We will not track this one specifically for Firefox 6 but we'd likely take a patch if it was nominated. Please do so.
Attachment #538928 - Flags: approval-mozilla-aurora?
Comment on attachment 538928 [details] [diff] [review]
patch

Approved for mozilla-aurora. Please land on mozilla-central as well.
Attachment #538928 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Landed on central:
http://hg.mozilla.org/mozilla-central/rev/baa619406bea
Status: REOPENED → RESOLVED
Closed: 9 years ago8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0

Marking VERIFIED because if I visit the page in Firefox 7 i get the correct error [18:30:45.840] uncaught exception: 
[Exception... "Security error"  code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)"  location: "http://webglsamples.googlecode.com/hg/color-adjust/color-adjust.html Line: 437"]
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.