Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: help! problems after window.open()

20 views
Skip to first unread message

Neil

unread,
Apr 3, 2012, 4:22:58 AM4/3/12
to
bootstrap wrote:

>In the firefox extension I'm creating, I create new windows by calling window.open() with the javascript portion of my extension.
>
Which features have you specified? The behaviour of window.open varies
on whether you use the chrome feature or not, for instance you would
need that in order for the opener to be able to wait for the opened
window to load. (But most of the time the opened window has its own
onload scripts that it runs.)

--
Warning: May contain traces of nuts.

bootstrap

unread,
Apr 3, 2012, 3:57:48 PM4/3/12
to
Interesting that window.open() is supposed to behave differently
with "chrome=yes" in the feature string. Can you explain why,
and what else is supposed to be different?

I will prepare a stripped down version of the code to post on the
other thread so everyone can make sure the code is conventional,
and try it out on their system. I might post my unmodified version
also, but it has dozens of extra statements to print the values of
endless event and window structure elements that don't matter.
The code should appear in the other thread within about 1 hour.

I just tried "chrome=no", "chrome=yes", and no mention of chrome
in the feature string, and nothing changed the behavior from what
I described. I am curious what differences "chrome" should make.
Please elaborate, or link me to a page that explains.

bootstrap

unread,
Apr 4, 2012, 4:19:27 AM4/4/12
to
Okay, I created a stripped-down version of the extension
that only contains statements to print-to-error-console to
show the values of relevant variables. Download the files:
http://www.iceapps.com/meanings20120402.zip .

There is a readme.txt file in there somewhere that notes
how to make the directory structure work on linux. I have
not tried working with extensions on windoze, so I have
no idea what needs to be changed to work on windoze.

Let me know if the behavior is different for you. On my
computer, no matter what I do, the event listener function
for the window load event executes *immediately* when
the window.open() function is called, before the line
after the window.open() function call executes.

You can verify all this by starting the browser, browse
to some webpage with normal HTML text, then click
on some word in the text. Inside the mousedown event
listener function the window.open() function is called,
which displays a long, thin window just below where
you clicked the mouse. Then go click on a word in
that new window too, to create a complete record in
the error window. Then display the "error console",
in the Tools => WebDeveloper menu and scroll down
through the information my meanings.js javascript
code prints out.

There you will clearly see three things:
1: window.open() invokes "load event handler".
2: can't find the window or its contents in the "load event
handler"
3: can't find the window or its contents after window.open()
returns.

The one exception to #3 is that cw.name DOES
report the correct window name as supplied in the
second argument of window.open() - namely "clarify".
However, nothing else is correct. Note, for example,
that it can't find the "clarify" ID within the tiny window,
and it can't find the <p> or <b> or <i> tags in the
tiny window either.

I put visible ENTER FUNCTION and LEAVE FUNCTION
printouts for both those event handler functions, so it is
very easy to see how the program flow goes. Everything
is started by a mousedown event (within a text node).
Inside the mousedown event handler the code calls the
window.open() function, which immediately causes the
windowload event handler to execute, then return to
the line after window.open(). You'll see that clearly.
And you'll also see that the information about the
window and its contents are WRONG, both inside
the window load event handler and also inside the
mousedown event handler after the window.load()
function is called and the windowload handler is
finished executing.

Download the files here:
http://www.iceapps.com/meanings20120402.zip

Neil

unread,
Apr 4, 2012, 7:39:02 AM4/4/12
to
bootstrap wrote:

>I am curious what differences "chrome" should make.
>
>
The difference is whether you want your content opened as a web page in
a browser or not.

However it's possible that the flag may be getting ignored in certain
circumstances.

bootstrap

unread,
Apr 4, 2012, 9:53:19 PM4/4/12
to
On Apr 4, 4:39 am, Neil <n...@parkwaycc.co.uk> wrote:
> bootstrap wrote:
>> I am curious what differences "chrome" should make.
>
> The difference is whether you want your content opened
> as a web page in a browser or not.
>
> However it's possible that the flag may be getting ignored
> in certain circumstances.

By "a browser" I guess you mean a window that also
contains an URL-address bar and other browser features.

Have you tried my extension to see whether you can
figure out why the crazy behavior? See instructions
and comments in the message 2 messages above.

http://www.iceapps.com/meanings20120402.zip
0 new messages