Closed Bug 268036 Opened 21 years ago Closed 21 years ago

ID in global scope doesn't work if page is loaded in a background tab

Categories

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

x86
All
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: bugzilla, Unassigned)

References

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041103 Firefox/1.0RC2 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041103 Firefox/1.0RC2 ID/Name in global scope was introduced in bug 256932. If a page is loaded in a background tab then any references to elements using global scope gives an error in the JS console. Reproducible: Always Steps to Reproduce: 1. Load the attached testcase in the foreground by clicking with the first mouse button. Click the 'find foo' button. 2. Load the attached testcase in a background tab by middle clicking. Wait until it has loaded before switching to it and clicking 'find foo'. Actual Results: In the first case alert(foo) displays [object HTMLDivElement] In the second case the JS console reports 'foo is not defined'. Expected Results: foo is found in in both cases.
Attached file Testcase
This also happens with the latest seamonkey nightly (2004111106)
OS: Windows XP → All
Confirming. This is pretty weird....
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8a5?
Johnny, can you take a look at this?
Blocks: 269341
Flags: blocking1.8a5? → blocking1.8a5+
Doesn't look like jst is going to have this debugged in time for a5.
Flags: blocking1.8a5+ → blocking1.8a5-
This was silly. The code that installs the global scope polluter wasn't run on the first document load, which normally isn't a problem since we pretty much always end up loading about:blank into every new window before the real document is inserted into the window, so the real document got the global scope polluter, but not the initial about:blank document. This makes the global scope polluter be installed for the first document too.
Attachment #166805 - Flags: superreview?(brendan)
Attachment #166805 - Flags: review?(shaver)
Comment on attachment 166805 [details] [diff] [review] Install the global scope polluter on first load too. Man, that's nowhere near as interesting as the crazy docshell-walking theories I concocted! r=shaver.
Attachment #166805 - Flags: review?(shaver) → review+
Comment on attachment 166805 [details] [diff] [review] Install the global scope polluter on first load too. Hmm, forgot about the first-document-load special case.... /be
Attachment #166805 - Flags: superreview?(brendan) → superreview+
Fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Both times loading the testcase https://bugzilla.mozilla.org/attachment.cgi?id=164808&action=view, [object HTMLDivElement] is alert()ed just fine now, using build 2004-11-28-06 on Windows XP, Seamonkey trunk.
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: