Page 1 of 1

[FIXED] 11.0.44rc SVG problems

Posted: Sat Sep 12, 2020 8:38 am
by skriptimaahinen
NS 11.0.44rc2: Still problem with SVGs that have inline scripts but no external scripts.

FF80: Scripts fail to run on every page load.
FF81: Scripts fail to run when navigating to about:newtab and back.

Re: 11.0.44rc SVG problems

Posted: Sat Sep 12, 2020 7:22 pm
by Giorgio Maone
Cannot reproduce in latest development build, but I'm not sure whether I've accidentally fixed it or there's something "wrong" with my test case:

Code: Select all

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
   
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <script type="text/javascript"><![CDATA[
    alert("SVG!");
  ]]></script>

</svg>
v 11.0.44rc3
============================================================
x Fixed media placeholder not shown when blocking Youtube
movies
x Work around for unpredictable content script execution
order
x Ensure content of NoScript prompts is always visible

Re: 11.0.44rc SVG problems

Posted: Sun Sep 13, 2020 12:49 pm
by skriptimaahinen
Still present in rc3. It's pretty hard to reproduce on FF81, but should happen quite often on FF80.

And there doesn't seem to be anything wrong with your test case. Happens with that too.

On FF81 the code hardly ever hits the document.write() due to the suspend working. On FF80 that is where it ends up most of the time.

The console output from that on is as follows:

Code: Select all

Can't use document.write(), XML document? Error: Can't document.write() on image/svg+xml   syncFetchPolicy.js:62:23
Unfreezing file:///script.svg                                                              DocumentFreezer.js:91:15
Replaced <script type="text/javascript">                                                   syncFetchPolicy.js:94:31
sendSyncMessage finalizing                                                                 SyncMessage.js:239:19
sendSyncMessage resume #0/0 - 112ms                                                        SyncMessage.js:235:19
sendSyncMessage finalizing                                                                 SyncMessage.js:239:19
​Looks like the execution never reaches the dispatchEvents since some Promise never gets resolved.

Re: 11.0.44rc SVG problems

Posted: Sun Sep 13, 2020 10:46 pm
by Giorgio Maone
Should be fixed in latest development build, thanks.
v 11.0.44rc4
============================================================
x Fixed namespacing issues with script replacements
x Fixed typo in content script ordering work-around

Re: 11.0.44rc SVG problems

Posted: Mon Sep 14, 2020 5:35 am
by musonius
Giorgio Maone wrote: Sun Sep 13, 2020 10:46 pm Should be fixed in latest development build, thanks.
v 11.0.44rc4
src/content/syncFetchPolicy.js

Code: Select all

if (ocumentFreezer.suppressedScripts === 0 && readyState === "loading")
You killed the 'D' in this commit.

Re: 11.0.44rc SVG problems

Posted: Mon Sep 14, 2020 6:05 am
by Giorgio Maone
musonius wrote: Mon Sep 14, 2020 5:35 am src/content/syncFetchPolicy.js

Code: Select all

if (ocumentFreezer.suppressedScripts === 0 && readyState === "loading")
You killed the 'D' in this commit.
Sorry, it happened because I had suppressed that line in order to force the reproducibility of the issue.
Fixed in rc5.

Re: 11.0.44rc SVG problems

Posted: Mon Sep 14, 2020 7:10 am
by skriptimaahinen
External and inline scripts run fine now.

However, onload event attribute in <svg> does not execute. load/DOMContentLoaded added with addEventListener do fire though.

Re: 11.0.44rc SVG problems

Posted: Mon Sep 14, 2020 1:38 pm
by Giorgio Maone
skriptimaahinen wrote: Mon Sep 14, 2020 7:10 am However, onload event attribute in <svg> does not execute. load/DOMContentLoaded added with addEventListener do fire though.
Do I need to do anything special to reproduce?
I've tried both on 80 and 81b, with and without external scripts, forcing soft reload and suppressing it, but it seems to work always for me.
Test file:

Code: Select all

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
   
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="console.log('onload')">
  <script type="text/javascript"><![CDATA[
   console.log("SVG!");
  ]]></script>

</svg>


Re: 11.0.44rc SVG problems

Posted: Mon Sep 14, 2020 9:01 pm
by Giorgio Maone
Nevermind, even thought I couldn't actually reproduce essentially because my all my synchronous calls terminated in when document.readyState was still "loading", I've probably figured out what's happening to you and hopefully fixed it in latest development build rc7. Thanks.

Re: 11.0.44rc SVG problems

Posted: Tue Sep 15, 2020 8:50 am
by skriptimaahinen
Should have pointed out that this indeed happens when soft reloading and the readyState is "completed". I can achieve this by using the "navigate to about:newtab and back".

The patch does fix it for my test cases, but now your test case (the older one with alert) fires the onload twice.

When doing normal reload:

Code: Select all

Readystate: interactive, suppressedScripts = 1, canScript = true                                syncFetchPolicy.js:28:17
Can't use document.write(), XML document? Error: Can't document.write() on image/svg+xml        syncFetchPolicy.js:62:23
Unfreezing file:///script.svg                                                                   DocumentFreezer.js:91:15
onload                                                                                          script.svg:1:9
// Execution proceeds after dismissing the alert.
Resolving on  afterscriptexecute <script type="text/javascript">                                syncFetchPolicy.js:86:33
Replaced <script type="text/javascript">                                                        syncFetchPolicy.js:94:31
sendSyncMessage finalizing                                                                      SyncMessage.js:239:19
ALl scripts done, firing completion events.                                                     syncFetchPolicy.js:97:27
onload                                                                                          script.svg:1:9
sendSyncMessage resume #0/0 - 5508ms                                                            SyncMessage.js:235:19
sendSyncMessage finalizing                                                                      SyncMessage.js:239:19
If the "newtab reload" is used, the readyState is "complete" and only one onload fires.

Re: 11.0.44rc SVG problems

Posted: Tue Sep 15, 2020 10:57 pm
by Giorgio Maone
Please check latest development build, thanks.
v 11.0.45rc1
============================================================
x Better emulation of SVG events

Re: 11.0.44rc SVG problems

Posted: Wed Sep 16, 2020 8:00 am
by skriptimaahinen
Looks good. Thanks!