Opened 10 years ago
Closed 10 years ago
#10252 closed defect (worksforme)
'undefined' is null - hostenv_browser.js
Reported by: | Pete Smith | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit | Version: | 1.4.0b |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
In IE8 /7 /6, when my page unloads, I get:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0) Timestamp: Mon, 2 Nov 2009 15:44:41 UTC
Message: 'undefined' is null or not an object Line: 301 Char: 5 Code: 0 URI: http://192.168.5.101/js/dojo-1.4.0b2/dojo/_base/_loader/hostenv_browser.js
Attachments (2)
Change History (15)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Jburke,
No there are no calls to addOnWindowUnload, or addOnUnload in my app. Strangely, if I remove one part of a template that I have, it doesn't bark. This worked great on 1.3.2.
comment:3 Changed 10 years ago by
httpete: can you share the part of the template that seems to tickle the error? Maybe we can construct a simple use case that demonstrates the problem.
comment:4 Changed 10 years ago by
jburke I am working on it. It is really tricky to isolate. I will get back to you with a positive test case. I think this might be related to the widgetsInTemplate = true not working bug. The code that tickles the problem has a widget in another widget's html template.
comment:5 Changed 10 years ago by
Jburke, thanks for your attention on this. I have attached a case, load it in IE8, then refresh the page. You will notice that, there is no menu within the dropdownbutton on line 47. If I put one in, the page does not die. Note, my drop down menu that is in my template does have a simple menu in it, but dies similarly on page unload. It is related to it being a widgetInTemplate, and seems to be around the dijit.form.DropDownButton?.
comment:6 Changed 10 years ago by
Owner: | changed from anonymous to bill |
---|
Bill, any ideas on this, seems more related to the recent dijit work than with the windowunload handling in core.
comment:7 Changed 10 years ago by
Well, the page has an error in it. A DropDownButton needs to have a Menu. It's getting an error trying to find the Menu. I don't see any error on page unload. Looks like a user error?
comment:8 Changed 10 years ago by
However bill, my dropDownButton does have a menu, and dies on pageUnload. Are you using IE8 with errors enabled?
Gents I can show this bug to you with a remote session if you'd like. I can tell you with high confidence that this didn't occur in 1.3.2, and started in 1.4. It is IE only (6,7,8) and is related to widgetsInTemplate and the DD button. My DD button has a menu with submenus just fine.
comment:10 Changed 10 years ago by
In order to fix this, I removed two widgets in my template. Somehow, when they were together, IE croaked. I ripped them out of the template, and it does not complain now.
comment:11 Changed 10 years ago by
Component: | General → Dijit |
---|
OK, well glad you got it to work. You said that:
my dropDownButton does have a menu
But in your example attachment test_DD_Button.html there is no menu. You need to attach a test case that reproduces the problem.
Are you using IE8 with errors enabled?
Yes
comment:12 Changed 10 years ago by
The real thing I am trying to show is - when a DDButton with no menu is in a widget's template (with widgetsInTemplate = true) IE dies on page unload. When it is in the page normally (straight in the page's html) it does not. Why is it different?
comment:13 Changed 10 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I'm not seeing errors on page unload, I'm seeing an error on page load when it tries to find the Menu. And I'm not seeing any difference between widgetsInTemplate or plain markup; they both fail (see attached testcase).
But anyway I'm not sure what the point of your question is, you need to fix the error in your code.
Changed 10 years ago by
Attachment: | test_DD_Button_simple.html added |
---|
any DropDown? button w/out a menu fails
Looks like you are using a source build of 1.4b2, and line 301 is in the dojo.windowUnloaded function.
I just tried the dijit themeTester.html in IE 8, and went to another page and I did not see an error, so my first thought is that it is not in the Dojo/Dijit? code.
Does your app call dojo.addOnWindowUnload to do any work on page unload? If the function that is registered with dojo.addOnWindowUnload tries to access the DOM in any way, that will be a problem. In those cases, you should use dojo.addOnUnload() instead. Note however that dojo.addOnUnload is fired onbeforeunload in the browser, which can be triggered by plain download links that do not actually unload the page.