Closed Bug 264760 Opened 20 years ago Closed 20 years ago

JS with window statement does not set scope to another window

Categories

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

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bc, Unassigned)

Details

Attachments

(2 files)

when referencing properties/functions of another window using with (windowRef)
{...} all references are resolved with respect to the current window instead of
the other window. Similar to Bug 49213, Bug 38215, etc. Bug exists in Mozilla
1.4-1.8a+

test case coming up.
Attached file sub-window.html
This window contains function showtitle and variable id.
this window also contains function showtitle and variable id. It calls
showtitle in its own window, then attempts to call showtitle in the other
window using with win1 { showtitle() }.

Expected result: each window show a string containing the contents of its own
id variable and title. (MSIE6 does show the expected result)

Actual result: only the window-with.html window shows any output and the
showtitle in window-with.html is called each time.
wow. strangely enough, MSIE agrees with Mozilla when hosting the pages on
bugzilla, but does not when the pages are hosted locally. Maybe an https issue.
actually, the problem is the call to showtitle() occurs before the other window
has completed opening. If you change the code to 

var win1 = window.open('sub-window.html');
with (win1)
{
  setTimeout('showtitle()', 1000);
}

it works in Mozilla. -> INVALID.

Sorry for the spam.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: