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
Opened by James Campos (aeosynth) - 2010-02-20 07:26:33 AM
Last edited by Anonymous Submitter - 2010-03-21 03:00:27 PM
|
DetailsWhen 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
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.
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