Closed Bug 69712 Opened 24 years ago Closed 23 years ago

JS Error: focusedWindow.location has no properties

Categories

(Core :: XUL, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: aogun, Assigned: danm.moz)

References

Details

(Keywords: dom0)

Here we have a frameset, and one frame has a button which, when clicked, 
replaces the location of that frame with yahoo.com.

The frame replaces OK, but on both Netscape 6 and the latest Mozilla milestone, 
an error pops up in the JavaScript console: "focusedWindow.location has no 
properties"

This consists of 3 files in the same folder  . View File 1, then click to 
produce the bug.

----------------- File 1: ns6frameset.html ----------------
<html>
<head>
</head>
<frameset name="mainframeset" cols="50%,50%">
	<frame name="nothingframe" src="detail.html" scrolling="auto">
	<frameset name="rightframeset" id="rightframeset" rows="77%,*">';
		<frame name="top" src="ns6test.html" scrolling="auto">
		<frame name="DCS" src="detail.html" scrolling="auto">
	</frameset>
</frameset>
</html>

----------------------- File 2: detail.html ----------------------
<html>
</html>

----------------- File 3: ns6test.html -------------------
<HTML>
<HEAD>
<SCRIPT>
function mouseClick()
{
	window.location.replace("http://www.yahoo.com")
}
</SCRIPT>
</HEAD>
<BODY>
<A href="javascript:mouseClick()">Click to cause bug</A>
</BODY>
</HTML>
over to DOM
Assignee: asa → jst
Status: UNCONFIRMED → NEW
Component: Browser-General → DOM Level 0
Ever confirmed: true
QA Contact: doronr → desale
Summary: Exception thrown when frame location is replaced in handler → Exception thrown when frame location is replaced in handler
Keywords: dom0
The exception you see is from the mozilla application code, it's not something
that happens because of something you did on the page, reassigning to XPToolkit.
Assignee: jst → trudelle
Component: DOM Level 0 → XP Toolkit/Widgets
QA Contact: desale → jrgm
why toolkit?  ->danm for triage since it is a window call, cc saari for possible
focus involvement
Assignee: trudelle → danm
->future
Summary: Exception thrown when frame location is replaced in handler → JS Error: focusedWindow.location has no properties
Target Milestone: --- → Future
The error is coming in function contentAreaFrameFocus in navigator.js,
said function being set up as a capturing focus event listener on the
'appcontent' element.


// When a content area frame is focused, update the focused frame URL
function contentAreaFrameFocus()
{
  var focusedWindow = document.commandDispatcher.focusedWindow;
  if (isDocumentFrame(focusedWindow)) {
      gFocusedURL = focusedWindow.location.href;
      var saveFrameItem = document.getElementById("savepage");
      saveFrameItem.removeAttribute("hidden");
  }
}

If you load any page with a frameset, and then do a right click, and reload a
frame, you will get this error. Any attempt to refer to the location property
of the window will fail. (Maybe it "doesn't have" a location at that point in
the reload???). Offhand, wrapping that block in a try has no ill effects, since
there are more focus events that follow, which do succeed in updating the UI.

Blake, Jag : is this a known problem? (I think it is ...)

See also bug 65963, which reports a similar error in the JS console and also
involves frames.
Either this bug should be a dup of bug 65963 or vice versa.

*** Bug 65963 has been marked as a duplicate of this bug. ***
works for me
20020117
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.