Opened 6 years ago

Closed 5 years ago

#16541 closed defect (fixed)

[patch][CLA] dojo/hccss in iframes - cs is null

Reported by: Pete Smith Owned by: bill
Priority: low Milestone: 1.11
Component: General Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description

I have a dojo app that has another dojo app embedded in an iframe. I get a firebug error line 32 of hccss

TypeError?: cs is null

bkImg = cs.backgroundImage,

Some simple defense prevents this in the code. IT might have something to do with the fact that I load google analytics code in the footer, which seems to get loaded BEFORE the blank.gif graphic is pulled in.

Change History (11)

comment:1 Changed 6 years ago by bill

Owner: set to Pete Smith
Status: newpending

Please attach a test case using the "attach file" button. It should be as small as possible to still reproduce the problem, in this case I guess two HTML files, that we can load in the browser (i.e. not PHP, JSP, etc.)

Then, give exact instructions on how to reproduce the problem using your attached test file.

The test case is necessary both to confirm that there's a bug, and for us to be able to debug the problem.

Thanks!

comment:2 Changed 6 years ago by Pete Smith

Status: pendingnew

So I found the underlying widget that is including hccss, is dijit/Form and dijit/_FormWidget. If we upgraded these to use the new _WidgetBase, this problem doesn't happen. Is that a better approach instead of diving into the embedded frame which is probably an edge case?

comment:3 Changed 6 years ago by bill

Status: newpending

We might be able to change dijit/Form to extend dijit/_WidgetBase rather than dijit/_Widget, but changing dijit/_FormWidget would break backwards compatibility of any subclasses of dijit/_FormWidget that use functionality from dijit/_Widget.

Setting to pending status again since you haven't attached a test case.

comment:4 Changed 6 years ago by Pete Smith

Status: pendingnew

Bill,

I just tried to whip up a test case, and I couldn't reproduce it. All I can report solidly is that to fix my problem I removed the "./hccss" line on line 16 of _Widget and it doesn't crash for me. I know, lousy report. I don't want this hccss anyway.

comment:5 Changed 6 years ago by bill

Resolution: invalid
Status: newclosed

OK, well glad you found a workaround. If you (or someone) comes up with a testcase we'll reopen this.

comment:6 Changed 6 years ago by ractive

We're having the same issue with domStyle.getComputedStyle(div) returning null in an iframe and the resulting error. The bad thing is that all remaining "ready handlers" will not be executed any more.

Having to patch dojo to fix this is our of option. If this domStyle.getComputedStyle(div) can (under whatever circumstances) return null, I'd recommend checking for null in hccss.js. What do you think?

Is there a workaround for the moment that does not involve patching dojo? I tried to register another handler with

has.add("highcontrast", function(){
   return false;
});

... but the original handler still gets executed. Any ideas?

comment:7 in reply to:  6 Changed 6 years ago by bill

Replying to ractive:

Having to patch dojo to fix this is our of option. If this domStyle.getComputedStyle(div) can (under whatever circumstances) return null, I'd recommend checking for null in hccss.js. What do you think?

Same as I said before, I'd need to see a test case.

Is there a workaround for the moment that does not involve patching dojo? I tried to register another handler with

has.add("highcontrast", function(){
   return false;
});

... but the original handler still gets executed. Any ideas?

Yes:

  1. you must be running that command too late, after the original one has run
  2. it would work if you used the force option (see the doc, http://dojotoolkit.org/api/1.8/dojo/has)
  3. a better way is to specify has flags to dojoConfig
<script type="text/javascript" src="../../../../dojo/dojo.js"
data-dojo-config="isDebug: true, has: { 'highcontrast': false }"></script>

comment:8 Changed 5 years ago by dylan

Milestone: tbd1.11
Priority: undecidedlow
Resolution: invalid
Status: closedreopened
Summary: dojo/hccss in iframes - cs is null[patch][needs CLA] dojo/hccss in iframes - cs is null

A pretty straightforward patch was provided at https://github.com/dojo/dojo/pull/98 that is likely to make this less error prone. Waiting on CLA.

comment:9 Changed 5 years ago by dylan

Summary: [patch][needs CLA] dojo/hccss in iframes - cs is null[patch][CLA] dojo/hccss in iframes - cs is null

comment:10 Changed 5 years ago by dylan

Owner: changed from Pete Smith to bill
Status: reopenedassigned

comment:11 Changed 5 years ago by Bill Keese <bill@…>

Resolution: fixed
Status: assignedclosed

In 395cbc1cf9f4e72303268add46570aa52f0009d4/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 
Note: See TracTickets for help on using tickets.