[FIXED] 11.0.44rc SVG problems

Bug reports and enhancement requests
Post Reply
skriptimaahinen
Senior Member
Posts: 215
Joined: Wed Jan 10, 2018 7:37 am

[FIXED] 11.0.44rc SVG problems

Post by skriptimaahinen » Sat Sep 12, 2020 8:38 am

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.
Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0

User avatar
Giorgio Maone
Site Admin
Posts: 8972
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: 11.0.44rc SVG problems

Post by Giorgio Maone » Sat Sep 12, 2020 7:22 pm

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
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

skriptimaahinen
Senior Member
Posts: 215
Joined: Wed Jan 10, 2018 7:37 am

Re: 11.0.44rc SVG problems

Post by skriptimaahinen » Sun Sep 13, 2020 12:49 pm

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.
Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0

User avatar
Giorgio Maone
Site Admin
Posts: 8972
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: 11.0.44rc SVG problems

Post by Giorgio Maone » Sun Sep 13, 2020 10:46 pm

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
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

musonius
Senior Member
Posts: 139
Joined: Sun Jul 08, 2018 5:38 pm

Re: 11.0.44rc SVG problems

Post by musonius » Mon Sep 14, 2020 5:35 am

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.
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0

User avatar
Giorgio Maone
Site Admin
Posts: 8972
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: 11.0.44rc SVG problems

Post by Giorgio Maone » Mon Sep 14, 2020 6:05 am

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.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

skriptimaahinen
Senior Member
Posts: 215
Joined: Wed Jan 10, 2018 7:37 am

Re: 11.0.44rc SVG problems

Post by skriptimaahinen » Mon Sep 14, 2020 7:10 am

External and inline scripts run fine now.

However, onload event attribute in <svg> does not execute. load/DOMContentLoaded added with addEventListener do fire though.
Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0

User avatar
Giorgio Maone
Site Admin
Posts: 8972
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: 11.0.44rc SVG problems

Post by Giorgio Maone » Mon Sep 14, 2020 1:38 pm

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>

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

User avatar
Giorgio Maone
Site Admin
Posts: 8972
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: 11.0.44rc SVG problems

Post by Giorgio Maone » Mon Sep 14, 2020 9:01 pm

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.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

skriptimaahinen
Senior Member
Posts: 215
Joined: Wed Jan 10, 2018 7:37 am

Re: 11.0.44rc SVG problems

Post by skriptimaahinen » Tue Sep 15, 2020 8:50 am

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.
Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0

User avatar
Giorgio Maone
Site Admin
Posts: 8972
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: 11.0.44rc SVG problems

Post by Giorgio Maone » Tue Sep 15, 2020 10:57 pm

Please check latest development build, thanks.
v 11.0.45rc1
============================================================
x Better emulation of SVG events
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

skriptimaahinen
Senior Member
Posts: 215
Joined: Wed Jan 10, 2018 7:37 am

Re: 11.0.44rc SVG problems

Post by skriptimaahinen » Wed Sep 16, 2020 8:00 am

Looks good. Thanks!
Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0

Post Reply