Open Bug 1332920 Opened 7 years ago Updated 8 months ago

Allow MAF (Mozilla Archive Format) to be a WebExtension

Categories

(WebExtensions :: Compatibility, task, P5)

52 Branch
task

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: danny0838, Unassigned)

References

()

Details

(Whiteboard: triaged[awe:{7f57cf46-4467-4c2d-adfa-0cba7c507e54}])

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161208153507




Expected results:

"We want to reiterate our commitment to our add-on development community, and will work with you in porting extensions, designing new APIs, and creating innovative new add-ons that make Firefox great." (Kev Needham,https://blog.mozilla.org/addons/2015/08/21/the-future-of-developing-firefox-add-ons/).

MAF (https://addons.mozilla.org/en-US/firefox/addon/mozilla-archive-format/) is an addon that can save a web page into a zip pack as .maff and allows Firefox to read them. Currently it cannot be implemented via WebExtension.
APIs we need (and current WebExtension can't do):

1. An API that supports full frame/iframe DOM access (so that MAF can save the current page, including the current DOM content in their frames and/or iframes)

2. An API that can manipulate a zip file (add, update, extract, etc)

3. An API that can save a file to the local disk.

4. An API that can load a file from the local disk.
Component: WebExtensions: General → WebExtensions: Compatibility
Priority: -- → P5
Summary: Allow MAF to be WebExtension → [META] Allow MAF to be WebExtension
1. Sounds like bug 1214373
2. There are various JS libraries that support zip files, I don't think we need an API for that
3. Either download.downloads or something like https://stackoverflow.com/questions/36139329/how-do-i-programmatically-download-a-file-created-on-the-file-with-a-firefox-web/36151977#36151977
4. <input type=file>
Or also bug 1246236.
Whiteboard: triaged
Wouldn't just implementing https://developer.chrome.com/extensions/pageCapture be the way to go?
(In reply to Tom Schuster [:evilpie] from comment #2)

What you mentioned does not fit the requirement of MAF.

What MAF works is that:
(1) The user opens a .maff file via Firefox, so that the maff file's location is appeared in the address bar and Firefox knows it.
(2) Firefox blocks the normal file loading flow so that there is not a "Open via" dialog prompt.
(3) Firefox unzips it to a temporarily local disk directory (e.g. the "%temp%" directory in Windows)
(4) Firefox goes in the directory, walk in each sub-directory, and opens the index file defined in the index.rdf.
(5) When the maff tab was closed or when Firefox is shut off, delete the temporarily directory created by (3).
We need a local disk saving at (3) and (4) and a local disk loading at (3) and (5). 

The 4. (or likely, drag and drop API) only allows Firefox to read a file that is specifically picked by the user via <input type=file> or via drag and drop. It cannot programmatically read a specific local file given its "file:" URL address. AJAX approach is also not available since Firefox addons are not allowed to read local files via AJAX.

Likewise, the 3. does not allow Firefox to access the temporarily directory on the filesystem. The saving process of a download via download.downloads is shown in the download bar, and could be interrupted by the user, which are not desired for MAF which attempts to save temp files programmatically and uninterruptibally. As for the approach in the link, it does not work for multiple files.
Blocks: 1346513
(In reply to Danny Lin from comment #5)
The saving process of a download via download.downloads
> is shown in the download bar, and could be interrupted by the user, which
> are not desired for MAF which attempts to save temp files programmatically
> and uninterruptibally. 

Actually this is how it works now and how it always worked as far as I know. If you save a large enough page you can simply interrupt it, because it takes several seconds.

Though I don't think this is an issue. It might even come handy if you decide you don't want the page.
(In reply to Danny Lin from comment #5)
> (In reply to Tom Schuster [:evilpie] from comment #2)
> 
> What you mentioned does not fit the requirement of MAF.
> 
> What MAF works is that:
> (1) The user opens a .maff file via Firefox, so that the maff file's
> location is appeared in the address bar and Firefox knows it.
> (2) Firefox blocks the normal file loading flow so that there is not a "Open
> via" dialog prompt.
> (3) Firefox unzips it to a temporarily local disk directory (e.g. the
> "%temp%" directory in Windows)
> (4) Firefox goes in the directory, walk in each sub-directory, and opens the
> index file defined in the index.rdf.
> (5) When the maff tab was closed or when Firefox is shut off, delete the
> temporarily directory created by (3).
> We need a local disk saving at (3) and (4) and a local disk loading at (3)
> and (5). 
> 
> The 4. (or likely, drag and drop API) only allows Firefox to read a file
> that is specifically picked by the user via <input type=file> or via drag
> and drop. It cannot programmatically read a specific local file given its
> "file:" URL address. AJAX approach is also not available since Firefox
> addons are not allowed to read local files via AJAX.
> 
> Likewise, the 3. does not allow Firefox to access the temporarily directory
> on the filesystem. The saving process of a download via download.downloads
> is shown in the download bar, and could be interrupted by the user, which
> are not desired for MAF which attempts to save temp files programmatically
> and uninterruptibally. As for the approach in the link, it does not work for
> multiple files.

So all of this doesn't seem to be happening. So is there any chance of native support off MAFF/MHTML? ( Bug 1346513 )
(In reply to Andy McKay [:andym] from comment #4)
> Wouldn't just implementing
> https://developer.chrome.com/extensions/pageCapture be the way to go?

Firefox doesn't even support viewing MHTML files. So saving them wouldn't help much.

(Used to be the only major browser to lack MHTML support, but now Edge also lacks it, for the time being)
Adding tag so this bug appears on https://arewewebextensionsyet.com/
Summary: [META] Allow MAF to be WebExtension → [META] Allow MAF (Mozilla Archive Format) to be a WebExtension
Whiteboard: triaged → triaged[awe:{7f57cf46-4467-4c2d-adfa-0cba7c507e54}]
If this can't be implemented as a Web Extension, then why not bake the functionality back into Firefox proper? This is a feature that a fair number of people want.  So what does it take to move this "feature" to the other side of the API "wall" and become a feature of Firefox itself?
More precisely:  Can this bug's Product or Component be updated to make this a feature request for Firefox, or does a separate bug need to be opened to make the request?
(In reply to timlepes from comment #10)
> If this can't be implemented as a Web Extension, then why not bake the
> functionality back into Firefox proper? This is a feature that a fair number
> of people want.  So what does it take to move this "feature" to the other
> side of the API "wall" and become a feature of Firefox itself?

Priority: -- → P5 = the lowest priority, no resources to implement it, unless the community to make a patch.

> If this can't be implemented as a Web Extension, then why not bake the functionality back into Firefox proper? 

This is Bug 1346513.
(In reply to Andy McKay [:andym] from comment #4)
> Wouldn't just implementing
> https://developer.chrome.com/extensions/pageCapture be the way to go?

So, is this happening in the realm of possibility in the near future?
Because one thing's for sure: we'll, be left without the possibility to view save or even view saved archives when FF57 hits.

(BTW it's called page capture. Hopefully that doesn't mean you could only save pages and have to view them in another browser...)
Flags: needinfo?(amckay)
It's not currently on the roadmap for the WebExtensions development team, but contributors patches would be more than welcome.
Flags: needinfo?(amckay)
The addon Web ScrapBook can already capture a web page and save it as a maff file, and view a maff file. However, due to the restriction of WebExt it currently cannot view a local maff file directly (you have to open the viewer page and  pick the maff file), and some feature would not work fine in the viewer.
(In reply to Danny Lin from comment #15)
> The addon Web ScrapBook can already capture a web page and save it as a maff
> file, and view a maff file.

Thanks for the tip! Sounds interesting.

> However, due to the restriction of WebExt it
> currently cannot view a local maff file directly (you have to open the
> viewer page and  pick the maff file), and some feature would not work fine
> in the viewer.

That's too bad. Sadly there's nothing for Viewing (much less saving) webpage archives for ff <57 and with multi-process enabled.
Neither of the addons I know of (MAF, UnMHT) were upgraded to work with e10s.
Product: Toolkit → WebExtensions
Type: defect → task

The meta keyword is there, the bug doesn't depend on other bugs and there is no activity for 12 months.
:mixedpuppy, maybe it's time to close this bug?

Flags: needinfo?(mixedpuppy)
Severity: normal → N/A
Flags: needinfo?(mixedpuppy)
Keywords: meta
Summary: [META] Allow MAF (Mozilla Archive Format) to be a WebExtension → Allow MAF (Mozilla Archive Format) to be a WebExtension
See Also: → 40873
You need to log in before you can comment on or make changes to this bug.