NS_ERROR_FAILURE when other browsers work fine when setting font on a canvas context in a display:none iframe

NEW
Unassigned

Status

()

5 years ago
11 months ago

People

(Reporter: manor.askenazi, Unassigned, NeedInfo)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

5 years ago
Created attachment 8335456 [details]
bug.png

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.48 Safari/537.36

Steps to reproduce:

Example of the bug can be generated here: http://slice.med.nyu.edu/cptac/dice/static/replicate.html 

if you click on any of the boxes at the top of the graph (e.g. the green square in the upper left part of the graph, see image called "click_here.png") -- the resulting divs open up with empty screens.

The relevant error (there are currently others that do not appear to be relevant to the bug at hand) is: 


Actual results:


NS_ERROR_FAILURE: Failure on line 1675 of jquery.flot.js

which causes graphs to appear empty (i.e. no data, clicking on the screen icon in the resulting graphs yields a similar plot that does contain data), see image called "bug.png".



Expected results:

An example of the correct output (Safari, Chrome and IE deal OK with this code, both on Windows and MacOS) can be seen in the image called "correct.png"...
(Reporter)

Comment 1

5 years ago
Created attachment 8335459 [details]
correct.png
(Reporter)

Comment 2

5 years ago
Created attachment 8335460 [details]
click_here.png

Comment 3

5 years ago
Error in the error console:

Timestamp: 2013/11/21 15:40:46
Error: ReferenceError: viewer is not defined
Source File: http://slice.med.nyu.edu/cptac/dice/static/replicate.html
Line: 1

Timestamp: 2013/11/21 15:40:58
Error: NS_ERROR_FAILURE: 
Source File: http://slice.med.nyu.edu/cptac/dice/static/js/jquery.flot.js
Line: 1675

Timestamp: 2013/11/21 15:40:59
Error: NS_ERROR_FAILURE: 
Source File: http://slice.med.nyu.edu/cptac/dice/static/js/jquery.flot.js
Line: 1675
The relevant code looks like this:

   ctx.font = '14px Arial';

where ctx is a canvas 2d context whose canvas element is in a document with no presshell (probably a display:none iframe).

What we do in that situation is:

2104   nsIPresShell* presShell = GetPresShell();
2105   if (!presShell) {
2106     error.Throw(NS_ERROR_FAILURE);
2107     return;
2108   }

presumably because of all the styleset/inheritance stuff we have to do here.

We should either silently no-op the call in this case or skip the inheritance bits or something instead of throwing.

Or alternately, decouple the CSS inheritance machinery from having a presshell.
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → Canvas: 2D
Ever confirmed: true
Flags: needinfo?(dbaron)
Summary: NS_ERROR_FAILURE when other browsers work fine! → NS_ERROR_FAILURE when other browsers work fine when setting font on a canvas context in a display:none iframe

Comment 5

4 years ago
This bug seems to be a duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=733698
Duplicate of this bug: 733698

Comment 7

2 years ago
This bug is still unresolved, but works in all other browsers. If you have a hidden iframe that contains a canvas, then all operations on the context of that canvas will fail. I can provide a testcase if needed.

Comment 8

11 months ago
I think I am seeing this behavior when running Firefox 56.0.2 headlessly in a Travis CI environment.

Miklos, do you have that testcase? I can try to run it in the same environment
You need to log in before you can comment on or make changes to this bug.