MozArchiver and scrset Topic is solved

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

ltcomdata
Moon lover
Moon lover
Posts: 83
Joined: 2015-06-28, 03:49
Location: WI

MozArchiver and scrset

Post by ltcomdata » 2026-06-20, 19:38

This is a just a Community Service Announcement to those who use MozArchiver besides me (if anyone).

Whenever there is an image in a webpage with a scrset setting, and it gets saved with MozArchiver, the following will happen:
1) The image will indeed get saved to the mht file, but
2) If you view the saved page offline, and reload it directly from the saved page by Skipping Cache, you will notice that the images with the scrset option do not get displayed. It appears that the saved webpage tries to get the images from the web instead of getting it from the saved file, and since you are offline, you do not get an image at all.

In view of (2), how do I know that the image did really get saved to the file? Because if, while still offline, you "Inspect" the image "Element", and then delete everything in the in quotation marks following scrset=, the image does indeed get displayed, even if you are still offline.

The solution: From the beginning, before saving the webpage with MozArchiver, delete the stuff in quotation marks after scrset= (from the "Inspect Element" code). Then when you view the saved webpage, it will immediately display the saved image from the saved sources instead of trying to find it online.

I am sure there is a way to write an addon or a script to delete the offending argument of srcset automatically --- or even to fix MozArchiver --- but I do not have the technical know-how just yet.

Cheers!

User avatar
adoxa
Astronaut
Astronaut
Posts: 668
Joined: 2019-03-16, 13:26
Location: Qld, Aus.

Re: MozArchiver and scrset

Post by adoxa » 2026-06-21, 07:45

Here's a patch to fix MozArchiver.

Code: Select all

diff -ru old/chrome/content/general/UrlListSourceFragment.js new/chrome/content/general/UrlListSourceFragment.js
--- old/chrome/content/general/UrlListSourceFragment.js	2015-04-12 19:58:20 +1000
+++ new/chrome/content/general/UrlListSourceFragment.js	2026-06-21 16:58:34 +1000
@@ -36,7 +36,7 @@
  * ***** END LICENSE BLOCK ***** */
 
 /**
- * Provides parsing of a space-spearated or comma-separated list of URIs into
+ * Provides parsing of a space-separated or comma-separated list of URIs into
  * significant fragments.
  *
  * This class derives from SourceFragment. See the SourceFragment documentation
@@ -55,7 +55,9 @@
   // SourceFragment
   _executeParse: function(aAddFn) {
     // Determine which regular expression to use based on the separator type.
-    var separatorRe = this._options.commaSeparated ?
+    var separatorRe = this._options.srcSet ?
+     /(\S+)(\s*(?:[\d.]+[wx])?(?:,\s*|$))/g :
+     this._options.commaSeparated ?
      /(.*?)(\s*,\s*|$)/g :
      /(.*?)(\s+|$)/g;
     // Apply the regular expression to retrieve the separated URLs.
diff -ru old/chrome/content/saving/ExactPersistParsedJob.js new/chrome/content/saving/ExactPersistParsedJob.js
--- old/chrome/content/saving/ExactPersistParsedJob.js	2018-06-29 20:34:02 +1000
+++ new/chrome/content/saving/ExactPersistParsedJob.js	2026-06-21 16:23:45 +1000
@@ -358,6 +358,21 @@
       }
     }
 
+    // Process "<img>" elements with a "srcset" attribute.
+    for (let node in this._htmlNodesGenerator("img", "srcset")) {
+      // Get the object required to process the inline attribute.
+      let fragment = new UrlListSourceFragment(node.getAttribute("srcset"), {
+        srcSet: true,
+      });
+      // Create the reference object.
+      this._createReference({
+        sourceDomNode: node,
+        sourceAttribute: "srcset",
+        targetFragment: fragment,
+      });
+      this._scanFragment(fragment, true);
+    }
+
     // Find direct references to media files that should be saved.
     for (let [, [elementName, attributeName]] in Iterator([
      ["audio",  "src"],
If you want to apply that manually, with the browser closed, extract the files from the xpi (you may need to rename to zip), replace the existing - minus lines with the + lines and update the xpi.

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1624
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: MozArchiver and scrset

Post by Lootyhoof » 2026-06-21, 08:45

Pull requests welcome. :)

User avatar
Moonchild
Project founder
Project founder
Posts: 39633
Joined: 2011-08-28, 17:27
Location: Sweden

Re: MozArchiver and scrset

Post by Moonchild » 2026-06-21, 09:11

Lootyhoof wrote:
2026-06-21, 08:45
Pull requests welcome. :)
https://repo.palemoon.org/Lootyhoof/moz ... r/pulls/14

(done entirely in Gitea, btw.)
"Sales hates anything that can't be turned into a confident sentence." - anonymous warehouse worker
"Why debate someone you fundamentally don't trust?" - Dario Amodei
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1624
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: MozArchiver and scrset

Post by Lootyhoof » 2026-06-26, 22:22

All merged and released. Thanks all.

ltcomdata
Moon lover
Moon lover
Posts: 83
Joined: 2015-06-28, 03:49
Location: WI

Re: MozArchiver and scrset

Post by ltcomdata » 2026-06-27, 01:48

Thank you everyone!

User avatar
sinfulosd
Fanatic
Fanatic
Posts: 106
Joined: 2022-07-13, 03:01

Re: MozArchiver and scrset

Post by sinfulosd » 2026-06-27, 19:08

Since we're talking about this extension, I also wanted to report the fact that when I type "moz" in the search bar, it never pops up, despite that it exists in the name - It's a lot convenient to just type "moz" for it to pop up in front of me.
Screenshot 2026-06-27 221015.png
You do not have the required permissions to view the files attached to this post.
Windows 11
Pale Moon 34.3.0, Firefox 151.0.3, Ungoogled Chromium 148.0
Developing and maintaining Greasemonkey for UXP

User avatar
Moonchild
Project founder
Project founder
Posts: 39633
Joined: 2011-08-28, 17:27
Location: Sweden

Re: MozArchiver and scrset

Post by Moonchild » 2026-06-27, 19:53

Tags aren't "partial matches". Moz is just short for Mozilla, it doesn't really mean anything.
"Sales hates anything that can't be turned into a confident sentence." - anonymous warehouse worker
"Why debate someone you fundamentally don't trust?" - Dario Amodei
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite