Last Comment Bug 126309 - (@importSave) save page does not save @import -ed CSS
(@importSave)
: save page does not save @import -ed CSS
Status: NEW
:
Product: Firefox
Classification: Client Software
Component: File Handling (show other bugs)
: unspecified
: All All
: -- normal with 113 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
http://www.nypl.org/styleguide/
: 162108 202737 223406 224586 225009 235791 236069 237106 252392 263600 267662 271626 273091 278895 281478 287525 294724 297180 309632 309737 314665 321349 326131 337114 343627 355366 370152 388565 398839 428046 431605 498472 524301 1106261 (view as bug list)
Depends on: 115107
Blocks: 115634
  Show dependency treegraph
 
Reported: 2002-02-18 16:51 PST by Mrten
Modified: 2016-06-22 11:36 PDT (History)
96 users (show)
benjamin: blocking‑aviary1.5-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Mrten 2002-02-18 16:51:50 PST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.8+) Gecko/20020217
BuildID:    2002021708

if you save a page completely, you'd expect to see all the CSS that is used to
be saved. however, when saving this URL, there is a snippet of code

<style type="text/css" media="all">@import "styles/sophisto.css";</style>

which the file 'sophisto.css' is never to be found in the directory with files.


Reproducible: Always
Steps to Reproduce:
save the page
go to directory
miss file
Comment 1 Boris Zbarsky [:bz] 2002-02-18 18:15:14 PST
To adam.  This is not a duplicate, I think, but bug 115107 needs to get fixed
first.
Comment 2 Jean-Marc Desperrier 2002-03-29 06:35:30 PST
Another page with the same problem :
http://webnouveau.net/
Comment 3 Adam Lock 2002-03-29 10:47:18 PST
.
Comment 4 Alfonso Martinez 2002-08-10 16:00:05 PDT
*** Bug 162108 has been marked as a duplicate of this bug. ***
Comment 5 Felix Miata 2002-12-20 18:47:22 PST
Hasn't the future arrived by now? How hard would this be to fix? Can we please
have some attention to this soon?
Comment 6 Felix Miata 2003-04-20 19:37:15 PDT
*** Bug 202737 has been marked as a duplicate of this bug. ***
Comment 7 Bill Mason 2003-10-23 08:17:23 PDT
*** Bug 223406 has been marked as a duplicate of this bug. ***
Comment 8 Olivier Cahagne 2003-11-03 10:00:07 PST
*** Bug 224586 has been marked as a duplicate of this bug. ***
Comment 9 Bill Mason 2003-11-07 12:06:34 PST
*** Bug 225009 has been marked as a duplicate of this bug. ***
Comment 10 José Jeria 2004-02-27 06:36:26 PST
*** Bug 235791 has been marked as a duplicate of this bug. ***
Comment 11 Bill Mason 2004-02-29 20:14:57 PST
*** Bug 236069 has been marked as a duplicate of this bug. ***
Comment 12 Rick Beton 2004-03-03 04:11:55 PST
Also Save Page As does not flatten the url() items in the CSS file(s). 

In the HTML, an image element is correctly flattened, e.g.
    <img src="http://www.somewhere.com/logo.png">
becomes
    <img src="saveasfolder/logo.png">

In CSS, images should also be flattened - but are not. E.g.
    body { background-image: url(http://www.somewhere.com/background.png); }
should become 
    body { background-image: url(saveasfolder/background.png); }

The same applies for the other syntactic variants of the same thing (i.e. with
or without ' quote marks, with or without the url() lexical token.

Rick :-)
Comment 13 timeless 2004-03-03 08:55:34 PST
rick: that's bug 115107, which oddly enough is listed in the dependencies. in
the future, please at least check depencies before you comment about something
which you think might be related. ideally you'd do a normal bug search....
Comment 14 José Jeria 2004-03-11 02:05:01 PST
*** Bug 237106 has been marked as a duplicate of this bug. ***
Comment 15 Philipp 2004-05-22 16:19:12 PDT
This page is an example of the problem:

http://weblogs.mozillazine.org/hyatt/ 

In that case, it is exacerbated by the fact that a JavaScript script selects the
css file to use (after user action). These alternate css files are not saved.
Comment 16 tomByrer 2004-06-07 10:50:39 PDT
similar to not saving CSS images:
CSS not fixed up by webbrowserpersist (background images not saved)
http://bugzilla.mozilla.org/show_bug.cgi?id=115107

there is a work in progress patch there, but hasn't been rolled into nightly
build as of last month (may2004)
Comment 17 José Jeria 2004-07-21 02:09:30 PDT
*** Bug 252392 has been marked as a duplicate of this bug. ***
Comment 18 a_geek 2004-08-25 09:00:29 PDT
please see also http://bugzilla.mozilla.org/show_bug.cgi?id=115107#c67

voting for both bugs

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803
MultiZilla/1.6.4.0b Mnenhy/0.6.0.104
Comment 19 Bill Mason 2004-10-09 07:43:47 PDT
*** Bug 263600 has been marked as a duplicate of this bug. ***
Comment 20 Francois Ingelrest 2004-10-29 00:17:07 PDT
Sorry for spamming, but would this be really hard to fix?

It's really annoying when you want to save a page to:
 - Open the file
 - Find where the css file is located
 - Open the css file and save it
 - Modify the page to use the local version of the css file

'Save page' does this perfectly when the css file is not @imported, so is it so
hard to include the support for the @import tag? It seems so, since this bug was
opened more than 2.5 years ago... 
Comment 21 Bill Mason 2004-11-04 23:29:39 PST
*** Bug 267662 has been marked as a duplicate of this bug. ***
Comment 22 Bill Mason 2004-11-24 15:07:03 PST
*** Bug 271626 has been marked as a duplicate of this bug. ***
Comment 23 Bill Mason 2004-12-04 01:13:55 PST
*** Bug 273091 has been marked as a duplicate of this bug. ***
Comment 24 :Gavin Sharp [email: gavin@gavinsharp.com] 2005-01-18 14:49:00 PST
*** Bug 278895 has been marked as a duplicate of this bug. ***
Comment 25 Ion Chalmers Freeman 2005-01-18 22:12:24 PST
Sorry for rereporting this bug, but it didn't come up in response to my query. Anyway, it is nigh on 
three years old, and is simply a matter of resolving the @import tags. Can you fix it?
Comment 26 timeless 2005-01-18 23:50:30 PST
you can fix it.
Comment 27 OstGote! 2005-01-19 00:04:33 PST
Please calm down. 
http://bugzilla.mozilla.org/page.cgi?id=etiquette.html


Comment 28 Erik Fabert 2005-02-08 01:26:49 PST
*** Bug 281478 has been marked as a duplicate of this bug. ***
Comment 29 :Gavin Sharp [email: gavin@gavinsharp.com] 2005-02-24 15:51:36 PST
Please don't set blocking flags, other than to request them (?).
Comment 30 simon annear 2005-03-24 02:55:14 PST
*** Bug 287525 has been marked as a duplicate of this bug. ***
Comment 31 Josh Birnbaum 2005-05-18 20:21:08 PDT
*** Bug 294724 has been marked as a duplicate of this bug. ***
Comment 32 Matthias Versen [:Matti] 2005-06-09 04:03:17 PDT
*** Bug 297180 has been marked as a duplicate of this bug. ***
Comment 33 Phil Ringnalda (:philor, back in August) 2005-09-22 09:03:22 PDT
*** Bug 309632 has been marked as a duplicate of this bug. ***
Comment 34 Martijn Wargers [:mwargers] (not working for Mozilla) 2005-09-23 04:24:11 PDT
*** Bug 309737 has been marked as a duplicate of this bug. ***
Comment 35 José Jeria 2005-11-01 14:41:50 PST
*** Bug 314665 has been marked as a duplicate of this bug. ***
Comment 36 Brendon Crawford 2005-12-12 11:33:58 PST
I am putting up a $25 bounty for this bug. This is very basic fdunctionality from an end-users standpoint -- something that people should expect to just work. The average joe isn't going to be able to manually download and modify the css files.

Anybody else want to contribute to this?

PS: If anybody does fix it, email me your paypal information.
Comment 37 Christian :Biesinger (don't email me, ping me on IRC) 2005-12-23 08:45:49 PST
*** Bug 321349 has been marked as a duplicate of this bug. ***
Comment 38 cignangulo 2006-02-06 13:33:06 PST
*** Bug 326131 has been marked as a duplicate of this bug. ***
Comment 39 Stephen Augenstein 2006-03-20 11:48:56 PST
Here's the problem that I've found, and correct me if I'm wrong because I'm not intimately familiar with the code:

At the moment, nsWebBrowserPersist.cpp uses a Tree Walker (line 1581) to go through each and every "tag set" (node) and find references to external objects. Since the CSS is not parsed in the DOM, the Tree Walker doesn't find these images and stuff. Therefore, the style sheets also need to be parsed or stuff inside import() and url() would need to be collected as well.
Comment 40 Uri Bernstein (Google) 2006-05-08 04:37:02 PDT
*** Bug 337114 has been marked as a duplicate of this bug. ***
Comment 41 Brian Polidoro 2006-07-05 07:45:06 PDT
*** Bug 343627 has been marked as a duplicate of this bug. ***
Comment 42 Stephen Augenstein 2006-07-15 07:39:27 PDT
For those of you still interested, I've created an extension to serve as a temporary fix to the problem. < https://addons.mozilla.org/firefox/2925/ >
Until I or someone else has the time to re-write nsWebBrowserPersist however, this is the best solution.
Comment 43 Phil Ringnalda (:philor, back in August) 2006-10-04 22:13:34 PDT
*** Bug 355366 has been marked as a duplicate of this bug. ***
Comment 44 ski 2006-10-05 10:47:19 PDT
I'll throw $25 in to that bounty. It's the kind of thing that we need to make "just work".

(In reply to comment #36)
> I am putting up a $25 bounty for this bug. This is very basic fdunctionality
> from an end-users standpoint -- something that people should expect to just
> work. The average joe isn't going to be able to manually download and modify
> the css files.
> 
> Anybody else want to contribute to this?
> 
> PS: If anybody does fix it, email me your paypal information.
> 
Comment 45 Ria Klaassen (not reading all bugmail) 2007-02-12 06:29:29 PST
*** Bug 370152 has been marked as a duplicate of this bug. ***
Comment 46 John Vandenberg 2007-04-02 18:46:10 PDT
I tried to use the "Save Complete" extension mentioned in comment 42, but it garbled the web page on disk in FF 2.0.0.3.  I have found that ScrapBook (https://addons.mozilla.org/en-US/firefox/addon/427) works well, and "Mozilla Archive Format" (https://addons.mozilla.org/en-US/firefox/addon/212) looks interesting for Firefox 1.5.x users.
Comment 47 Stephen Augenstein 2007-06-07 10:13:54 PDT
The issue (and I don't know where I saw this comment in the first place) is that, for this problem to be corrected, either the CSS parser needs to be rewritten to allow its usage by nsWebBrowserPersist for properly parsing and replacing urls in stylesheets, or a simplified CSS parser must be written for nsWebBrowserPersist, which would result in duplicated code. The best solution seems to be a full rewrite of the CSS parser to allow proper search-and-replace for urls in stylesheets, although this will take a lot of work. If someone is willing to mentor me, I have done enough research that I am pretty sure I know what needs to be done.

As a side note, the issue in comment 46 with the "Save Complete" extension has been fixed, and although it has problems with a specific time of @import rule, it is a lot better than the save functionality provided by nsWebBrowserPersist. The extension can be found at <https://addons.mozilla.org/en-US/firefox/addon/4723>.
Comment 48 Nickolay_Ponomarev 2007-06-07 10:23:15 PDT
Stephen: see bug 115107 comment 88 (that suggestion also applies to this bug - the suggested fixup interface could collect the URLs it fixes up and pass them to StoreURI, thus causing the URIs referenced from @import to be saved). I actually half-implemented that suggestion and it seemed to work fine before it fell off my plate :(

I can help you with the easier things, as time permits, if you take that approach.
Comment 49 Stephen Augenstein 2007-06-07 11:34:16 PDT
The issue that I have with working through the DOM is that, currently, anything modified by Firefox before being saved is "corrected". If the page had html like <a href=http://www.google.com>google.com</a>, the address is now enclosed in quotes. Although this is perfectly acceptable for those simply trying to save a page for later, it is not acceptable for web-developers, who would prefer that nothing was changed in their code before being saved. This is why I prefer the, albeit less effective, method of using regular expressions. The URLs can be easily collected through the DOM interfaces (see code in extension mentioned in comment 47 for example). However replacing only those URLs that need to be replaced is difficult, as a regular expression cannot ever beat a full parser for shear flexibility.
Comment 50 Nickolay_Ponomarev 2007-06-07 13:58:58 PDT
Web developers have lots of ways to get the exact source of the page.. that's not an issue in my opinion. Regular expressions are a no-go, since you can't parse HTML properly using them, plus we already have a working parser - why would we write and maintain another, regexp-based one? For a single questionable web developer use-case?
Comment 51 dolphinling 2007-07-18 07:16:30 PDT
*** Bug 388565 has been marked as a duplicate of this bug. ***
Comment 52 Jesse Ruderman 2007-10-06 05:47:30 PDT
*** Bug 398839 has been marked as a duplicate of this bug. ***
Comment 53 Aiko 2008-04-09 14:25:20 PDT
*** Bug 428046 has been marked as a duplicate of this bug. ***
Comment 54 Brian Polidoro 2008-04-30 20:01:45 PDT
*** Bug 431605 has been marked as a duplicate of this bug. ***
Comment 55 sweb 2008-07-14 13:48:01 PDT
firefox 3 has been release but this bug not be cleared. look at the starting bug date, why?
Comment 56 Mike Frysinger 2008-10-07 20:30:39 PDT
the original *simple* example may be "questionable", but there are plenty of recursive usage out there where one .css imports others via @import() ... i'm not suggesting that creating a dedicated parser is a good idea, just that the idea of writing off css @import() as questionable is ridiculousness.
Comment 57 Tom Geompse 2008-10-08 10:47:34 PDT
I'm not getting your point. You expect your saved page to look like the original. Actually Firefox is not saving all files. There is no discussion here.
Comment 58 Mike Frysinger 2008-10-18 23:57:33 PDT
my comment was a specific reply to Comment #50.  take a chill pill.
Comment 59 Ludovic 2008-10-19 14:46:43 PDT
#57: then why does it save the images and re-write the paths to them? What's wrong with expecting to be able to have a saved page look the same as the original one? Or am I misunderstanding your comment?
Comment 60 Devoti Paolo 2008-10-20 00:18:35 PDT
For most people the aim is to make a local copy of the page view some strongly appreciate a copy of the files structure.

Both are unhappy because a part of the css is lost.
Comment 61 Tom Geompse 2008-10-20 07:33:37 PDT
Nop.
For people who wants files from the serveur, they'll need the css file linked in the @import directive.
For people who needs a copy (sort of screenshot), they'll want the same style to be applied, including those imported.

Not conflictual. Yes, the @import url should be rewritten locally for this to work properly.

(ps->Mike Frysinger=>i'm not so fluent, what's a chill pill? bad medicine probably...)
Comment 62 Kevin Brosnan 2009-06-15 14:43:20 PDT
*** Bug 498472 has been marked as a duplicate of this bug. ***
Comment 63 Jo Hermans 2009-10-24 12:02:15 PDT
*** Bug 524301 has been marked as a duplicate of this bug. ***
Comment 64 Vincent Lefevre 2011-12-31 11:34:31 PST
Until this bug is fixed, couldn't Firefox display a warning saying that some CSS files are missing when doing the "Save Page As" / "Web Page, complete"? (I don't know the Firefox internals, but since the page is already displayed, I suppose that Firefox could have this information quite easily.)

This would avoid to make the user wonder why a saved page looks wrong when opened, because Firefox doesn't display any error when a CSS file is not found.
Comment 65 Lil B 2012-06-19 21:42:20 PDT
Please ficks this bug. I am dying. I can't wait any longer. I want to see this bug ficked before I pass away. I want to enjoy my life. Please
Comment 66 chrizoo 2012-06-20 05:49:03 PDT
@ Lil B: Others are not responsible for your life. Suggestion: Why don't you use the maff add-on ?? It not only saves an identical, faithful copy of the web page, it also saves disk space due to zip compression!
Comment 67 Tom Geompse 2012-06-20 06:52:02 PDT
@chrizoo : You have no humor.
@lilb : I am only waiting since 2008, take the queue :)
@mozilla : This is a bug, please fix
Comment 68 Сергій 2012-08-30 06:54:43 PDT
A reminder: there's 50$ bounty for fixing this bug from https://bugzilla.mozilla.org/show_bug.cgi?id=126309#c36 and https://bugzilla.mozilla.org/show_bug.cgi?id=126309#c44.
Please hurry up while they are still alive. Are they?
P.S. The future in now.
Comment 69 sjw 2013-10-20 07:17:33 PDT
Wow, no patch since 11 years for this annoying bug :o
Comment 70 :Gijs Kruitbosch (Gone July 28 - Aug 11) 2015-01-08 02:21:34 PST
*** Bug 1106261 has been marked as a duplicate of this bug. ***
Comment 71 Tom Geompse 2015-01-08 03:13:42 PST
Happy New Year, bug !
Comment 72 Lil B 2015-01-10 19:52:54 PST
Remember bug when we used to play? Let's get together again some time and work it out again, like we used to again, let's again. Merry new year to yours and of course your others. Promise, Lil B
Comment 73 Lil B 2015-01-10 19:56:13 PST
The bounty should be adjusted for inflation, in fact I'll throw all my gold nuggets into a new river. I am going to invest in this bug instead. Promise, Lil B
Comment 74 Hraban 2015-01-26 07:31:52 PST
If you are serious about the bounty, please consider putting it up at https://www.bountysource.com/issues/3508687-save-page-does-not-save-import-ed-css to streamline the process.

Note You need to log in before you can comment on or make changes to this bug.