Opened 11 years ago

Closed 11 years ago

#8945 closed defect (fixed)

Dialog: first popup on Firefox 3.0.7 has an error

Reported by: Sanjay Madhavan Owned by: bill
Priority: high Milestone: 1.3
Component: Dijit Version: 1.3.0b3
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

I use a Dialog on a page to popup a help page.

The popup is displayed using javascript.

var node = dojo.doc.createElement('div');
var dialog = new dijit.Dialog({ title:"Help" },node);
dialog.startup();
dialog.setHref(url);
dialog.show();

On IE7 the dialog shows fine without any errors.

On Firefox 3.0.7 the dialog works fine but the first time i do a popup on the page i get the following javascript errors in the Firebug console.

_4 is null http://localhost:8080/testApp/web/resources/dojo-release-1.3.0b3/dojo/dojo.js Line 41

The second time onwards it works fine without any errors.

/sanjay

Change History (8)

comment:1 Changed 11 years ago by bill

Component: GeneralDijit
Owner: anonymous deleted
Summary: First popup of Dialog on Firefox 3.0.7 has an errorDialog: first popup on Firefox 3.0.7 has an error

OK, please make a small testcase and attach it here using the "Attach file" button.

Also list your OS (mac or PC).

comment:2 Changed 11 years ago by Sanjay Madhavan

I upgraded to 1.3.0.rc2 and retested. The error still occurs.

I tried to create a simple test case but the problem does not occur in my test case. Seems something related to the set of widgets on my actual page.

I replaced dojo.js with dojo.js.uncompressed.js and was able to pinpoint the error to the line 26 from dojo.js.uncompressed.js below. It seems the variable _4 getSelection() can be null sometimes and the code is not testing for it. It should be a simple fix.

/sanjay

17}else{
18return !s.createRange().length;
19}
20}else{
21var _3=dojo.global;
22var _4=_3.getSelection();
23if(dojo.isString(_4)){
24return !_4;
25}else{
26return _4.isCollapsed||!_4.toString();
27}
28}

comment:3 Changed 11 years ago by Sanjay Madhavan

Also my OS is Windows XP SP3

comment:4 Changed 11 years ago by Sanjay Madhavan

Correction the problem code is actually line 26 of focus.js

Adding the following code fixes the problem for me:

21var _3=dojo.global;
22var _4=_3.getSelection();
23if (_4==null) return null;

comment:5 Changed 11 years ago by bill

Description: modified (diff)

Hmm, strange... it seems like that error must be happening because there's no selected text, but for me on both windows and mac getSelection() always returns something, even when no text is selected (like when I show the dialog from dojo.addOnLoad()).

comment:6 Changed 11 years ago by Sanjay Madhavan

Yes. as I said when I tried to create a minimal test case i could not reproduce it.

But on my actual application it is 100% reproducible on the first dialog display of the page. Subsequent dialog display's work without an error.

Must be something to do with the combination of widgets on the page.

The fix I suggested should be safe and I hope you will integrate it into the next build.

/sanjay

comment:7 Changed 11 years ago by bill

Milestone: tbd1.3
Owner: set to bill
Status: newassigned

OK fair enough, I'll check it in.

comment:8 Changed 11 years ago by bill

Resolution: fixed
Status: assignedclosed

Fixed in [17116].

Note: See TracTickets for help on using tickets.