PS: I didn't see my message appear for over a day, so I posted
a new message just a while ago (with somewhat more details).
But let me answer your specific questions below.
To test my code, I create event listeners for "window.load" and
"mousedown" events.
Inside my "mousedown" event handler function I capture the
screenX, screenY of the mouse cursor from the event structure,
then create a path string, a feature string, then call
win = window.open(pathstring, "clarify", featurestring);
Note that the pathstring refers to an HTML file on my ubuntu64
linux filesystem, so it is something like the following:
"file://home/max/firefox/extension/meanings/content/clarify.html"
Now, I have dozens of print statements in these TWO places:
#1: inside my "window load" event handler function.
#2: inside my "mousedown" event listener function.
#2 is immediately following my window.open() call.
Inside #1, I take the event argument and work through
every conceivable element to attempt to find a window
with name == "clarify" (as set by window.open()).
I am unable to find such a window, and the windows
I do find have no name, and no <p> tags or id = "clarify".
The print statements at #2 are a bit simpler, because
I have the win variable, which is supposed to be the
reference to the window created by window.open()
according to the window.open() documentation.
But I go through every possible permutation trying
to find another window that has a <p> tag or has
an id = "clarify" (which is in the loaded HTML file).
Also note this. As we would expect, since javascript
is essentially a single-thread model, my printouts
confirm that BEFORE my window.open() call returns,
my installed "window load" event handler function is
called by javascript. Therefore, the window is already
fully loaded before my printouts mentioned in #2 above.
And, in fact, the window should be fully loaded before
my printouts mentioned in #1 above too.
Therefore, you assumption is wrong. The HTML file
is fully loaded when the lines following window.open()
are executed. At least that is DEFINITELY how this
works on my ubuntu64 system works (firefox v11), as
demonstrated by the order of my printout statements.
The bottom line is, I am already doing what you
suggest IN ADDITION TO the same tests after
the window.open() function call. So that doesn't
explain what my problem is.
Any other ideas?