Page 1 of 1

double invocation of normal inclusion surrogates

Posted: Tue Sep 27, 2011 10:01 am
by al_9x
Fx 7.0, NS 2.1.3, new profile

runs the first time before the @ surrogate:

test page:

Code: Select all

<script src="http://domain.invalid/"></script>
surrogates:

Code: Select all

noscript.surrogate.normal.sources=*
noscript.surrogate.normal.replacement=console.log('normal surrogate');

noscript.surrogate.@.sources=@*
noscript.surrogate.@.replacement=console.log('@ surrogate');
console log:

Code: Select all

[05:56:03.622] normal surrogate @ chrome://noscript/content/ScriptSurrogate.js:193
[05:56:03.627] @ surrogate @ http://localhost/tests/surrogates/normal-simple.htm:10
[05:56:03.631] normal surrogate @ http://localhost/tests/surrogates/normal-simple.htm
the log seems to be indicating that the first invocation is from chrome

Re: double invocation of normal inclusion surrogates

Posted: Tue Sep 27, 2011 10:13 am
by Giorgio Maone
Looks like an artifact of Gecko's speculative loading. Investigating, thanks.

Re: double invocation of normal inclusion surrogates

Posted: Wed Sep 28, 2011 10:39 am
by Giorgio Maone

Re: double invocation of normal inclusion surrogates

Posted: Wed Sep 28, 2011 2:37 pm
by al_9x
Giorgio Maone wrote:Should be fixed in latest development build 2.1.4rc2
So what was going on there? What is this speculative parsing? Is gecko querying the policy twice about the same script? Why?

Re: double invocation of normal inclusion surrogates

Posted: Wed Sep 28, 2011 4:08 pm
by Giorgio Maone
al_9x wrote:
Giorgio Maone wrote:Should be fixed in latest development build 2.1.4rc2
So what was going on there? What is this speculative parsing?
Recent Gecko versions try to parallelize external resources preloading, starting the loads as soon as their URLs can be seen in the response stream and independently from DOM building.
al_9x wrote:Is gecko querying the policy twice about the same script? Why?
Yes, it is. Once when the load is about to start (which generally happens before the script DOM element exists - in fact, the document itself is passed as aContext) and once when the DOM element is created (even if at that time the load may have already been vetoed by the previous call).