Uzbl

Tasklist

FS#209 - iframe: LOAD_START != LOAD_FINISH

Attached to Project: Uzbl
Opened by James Campos (aeosynth) - 2010-02-20 07:26:33 AM
Last edited by Anonymous Submitter - 2010-03-21 03:00:27 PM
Task Type Bug Report
Category uzbl-core
Status New
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

When creating an iframe, LOAD_START is set to the current page, while LOAD_FINISH is set to about:blank. Now, it's possible that this is a 'feature', but if so, it's a dangerous one - when combined with a userscript manager, this results in an infinite loop.

Save the following as test.js:
// ==UserScript==
// @include http://*
// ==/UserScript==
var iframe = document.createElement('iframe')
document.body.appendChild(iframe);

run it in the uzbl terminal:
script /path/to/test.js

EVENT [30494-5] LOAD_START http://www.google.com/
EVENT [30494-5] LOAD_PROGRESS 100
EVENT [30494-5] LOAD_FINISH about:blank

note that LOAD_START != LOAD_FINISH.

To see the infinite loop, use with userscript.sh - http://github.com/singpolyma/singpolyma/blob/master/uzbl/data/scripts/userscript.sh.

A workaround would be to wait until LOAD_FINISH to start scripts, but that's arbitrarily limiting.
This task depends upon

Comment by James Campos (aeosynth) - 2010-02-20 07:57:30 AM
Nevermind, I was already using <code>@on_event LOAD_FINISH spawn @scripts_dir/userscript.sh</code> - any userscript that adds iframes to the page will cause an infinite loop.
Comment by James Campos (aeosynth) - 2010-02-25 11:34:15 AM
Ok, so the readme states that the LOAD_START uri "is the current URI; the one being departed." So let me rephrase this bug:

The LOAD_FINISH uri passed to iframes is not the LOAD_FINISH uri reported in the terminal; it is in fact the LOAD_START uri.

To see this, add the following line to your uzbl config:
@on_event LOAD_FINISH sh 'echo ==LOAD_FINISH== $6 > $4'

Create iframe.js:
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);

Open up any page, eg, http://www.google.com. Note that the LOAD_FINISH uri reported by uzbl is the same as the LOAD_FINISH uri reported by the script.

Now execute iframe.js, ie, :script /path/to/iframe.js. Note that the LOAD_FINISH uri reported by uzbl is NOT the same as the LOAD_FINISH uri reported by the script.
Comment by Dieter Plaetinck (Dieter_be) - 2010-02-27 06:34:57 PM
does this also work with iframes which are not created by js?
Comment by James Campos (aeosynth) - 2010-02-28 04:49:42 AM
Iframes present in the original html don't set off LOAD_START / LOAD_FINISH events (which is slightly curious in and of itself), so it seems this bug only affects js created iframes.

I've created an example page[1] which loads two iframes (to show that original iframes don't set off LOAD events), and which has a button to create new iframes via js (which do set off LOAD events).

[1]: http://aeos.hostzi.com/iframe.html

Loading...