Closed Bug 179918 Opened 22 years ago Closed 22 years ago

<script FOR="window"> elements don't load in Mozilla

Categories

(Core :: DOM: Core & HTML, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.3beta

People

(Reporter: markus.pawella, Assigned: jst)

References

()

Details

(Keywords: regression, Whiteboard: [HAVE FIX] [ Ignore Comment #1!!! ])

Attachments

(1 file)

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Build Identifier: i use a javascript which reloads the frameset of the website. in actual builds it doesn't work. if you click on a link it doesn't jump to the requested link. Instead it reloads the default frameset. Furthermore it replaces the orginal adress (http://www.pawella.com/) with the request page (http://www.pawella.com/index.html?Neulich/Neulich06Mitte.htm) instead of keeping the original adress. The site worked fine with Phoenix 0.4. Problem occurs on Phoenix build 20021111, 20021112 and Mozilla build 20021108 Reproducible: Sometimes Steps to Reproduce: 1.go to http://www.pawella.com 2. click picture "negative ...", "Neulich - 500 Euro" or any other link 3. Actual Results: reloads the original frameset. replaces adressline with requested page instead of keeping the original adressline. Expected Results: load requested page. keep adressline. here's the discussed sript: index.html // Sicheres Webseite if (self != top) { top.location.href=self.location.href; } var frameset_geladen = "okay"; function laden() { if(self.location.search.length > 0) { var Search_Laenge = self.location.search.length; var info_url = self.location.search.substring(1,Search_Laenge); //self.Mitte.location.href = "../"+info_url; self.Mitte.location.href = info_url; } }
Browser, not engine ---> Layout Confirming bug with Mozilla trunk binary 20021107xx on WinNT. When I load the site, it always comes up blank! I don't know why this is. It loads just fine in Mozilla's Tools > Web Development > DOM Inspector. In Mozilla itself, each frame at the site loads blank for me even if I load them as individual URLs: http://www.pawella.com/Start/Startmenue.htm http://www.pawella.com/Start/StartLogo.htm Once again, each of these loads fine in the DOM Inspector. Don't know what's going on here -
Assignee: rogerl → other
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → Layout
Ever confirmed: true
QA Contact: pschwartau → ian
IGNORE Comment #1; something was wrong with my Mozilla process at the time I tried the site. The site DOES load fine for me; am now looking at the links at the site and will report back -
Whiteboard: [ Ignore Comment #1!!! ]
The function shown above, laden(), is apparently not recognized in Mozilla. The function is called from the frameset onload handler. Yet when I load the site, this error appears in Mozilla's Tools > Web Development > JavaScript Console: Error: laden is not defined Does it have something to do with the <script> tag used? <script type="text/javascript" language="JavaScript" FOR="window"> I don't recognize the FOR attribute. Reassigning to DOM Level 0 for further analysis. Another idea: could this be a case of implicit document.open()'s clobbering the JS context (bug 114461)?
Assignee: other → jst
Component: Layout → DOM Level 0
QA Contact: ian → desale
More trouble: the global variable defined just above laden() is also not recognized in Mozilla: var frameset_geladen = "okay"; To see this, load the site in IE6 and in Mozilla, and enter this javascript:URL: javascript: alert(frameset_geladen); In IE6, you get "okay"; in Mozilla you get an error in the JS Console: Error: frameset_geladen is not defined This is the direct cause of the reported behavior here. To see this, use Mozilla's Tools > Web Development > JavaScript Debugger. When we click on a link in the menu at the site (e.g. "Neulich" > "500 Euro"), this function gets called in http://www.pawella.com/Scripte/Scripts.js: function sichereseite() - 47 { - 48 pfad = self.location.href; - 49 pos = pfad.lastIndexOf('/'); - 50 pfad = pfad.substring(pos+1,pfad.length); - 51 var site = "../index.html?"+verz+pfad; - 52 if (top.frameset_geladen + "" != "okay") 53 { - 54 if(document.images) - 55 top.location.replace(site); 56 else - 57 top.location.href = site ; 58 } 59 } The check at line 52 fails, since |top.frameset_geladen| == |undefined|. We fall into line 55, which resets the location. In this example, to: 055: top.location.replace(site); 0001: site $[0] = [string] "../index.html?Neulich/Neulich10Mitte.htm" In IE6 this doesn't happen, because |top.frameset_geladen| == "okay".
SUMMARY Top-level variables and function definitions are not being recognized by Mozilla at this site: e.g. the variable |frameset_geladen|. This is causing problems later on, when menu items are clicked. This top-level script is contained in a <script> tag in the <head> above the <frameset>. The tag looks like this: <script type="text/javascript" language="JavaScript" FOR="window">
Again, could this be related to bug 114461? "document.open() clobbers JS context???"
Regarding to Phils comment #3 I checked the for="window" attribute. If I delete the attribute it seems to work fine. Please check this with http://www.pawella.com/index2.html which has no for="window" attribute. http://www.pawella.com/index.html still has the attribute and it doesn't work. Index2.html works fine with Phoenix original 0.4 and build 20021112 and Mozilla 20021108. Index.html works only with Phoenix 0.4. For me it looks like that this behavior is introduced after the release of Phoenix 0.4 which is a Mozilla 1.2b build. The actual builds are from the Mozilla 1.3a trunk.
Confirming what markus.pawella@gmx.de found in Comment #7: http://www.pawella.com/index2.html, which has no for="window" attribute on its <script> tag, loads without any errors in the JavaScript Console and functions perfectly. So it is this attribute that is at issue. Resummarizing. Is this an HTML Parser instead of a DOM issue? Why don't we load scripts that have this attribute?
Summary: javascript which loads a frameset if not loaded doesn't work with act. builds → <script FOR="window"> elements don't load in Mozilla
Probably related to the recent checkin to support <script for="...">, see bug 174404.
Recall Comment #7: http://www.pawella.com/index.html still has the for="window" attribute http://www.pawella.com/index2.html which has NO for="window" attribute. With a Mozilla trunk build 2002-11-15, the latter site works, but the former doesn't (get "Error: laden is not defined" in JS Console when you load, which leads to the errors analyzed above, etc.) Note bug 174404 shows a checkin date of 2002-11-08, yet we still see this problem with today's trunk build -
*** Bug 181538 has been marked as a duplicate of this bug. ***
To rick.
Assignee: jst → rpotts
Severity: normal → major
Keywords: regression
OS: Windows XP → All
Hardware: PC → All
*** Bug 181759 has been marked as a duplicate of this bug. ***
-> jst ;-)
Assignee: rpotts → jst
Flags: blocking1.3b?
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.3beta
Regression. Let's try to get this resolved for 1.3beta. It might not be difficult.
Flags: blocking1.3b? → blocking1.3b+
Attached patch Proposed fixSplinter Review
Only treat a script tag as an event handler if it has *both* "for" and "event" attributes.
Whiteboard: [ Ignore Comment #1!!! ] → [HAVE FIX] [ Ignore Comment #1!!! ]
Attachment #112800 - Flags: superreview?(bzbarsky)
Attachment #112800 - Flags: review?(bugmail)
Attachment #112800 - Flags: superreview?(bzbarsky) → superreview+
Comment on attachment 112800 [details] [diff] [review] Proposed fix r=sicking
Attachment #112800 - Flags: review?(bugmail) → review+
Attachment #112800 - Flags: approval1.3b?
Comment on attachment 112800 [details] [diff] [review] Proposed fix a=asa (on behalf of drivers) for checkin to 1.3beta.
Attachment #112800 - Flags: approval1.3b? → approval1.3b+
Fix checked in. FIXED.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
This doesn't fully fix the problem.... see bug 191579
This fix did indeed fix the regression that was introduced by the plugin events changes, but there are still problems with <script event=onload for=window>. Those problems are however not related to this regression.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: