Closed Bug 889442 Opened 12 years ago Closed 12 years ago

Remove special about: pages code from DOM Storage

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: mak, Assigned: mak)

References

Details

Attachments

(3 files, 2 obsolete files)

Once bug 729777 is fixed, we want to remove any code that allows DOM Storage to specially handle about pages, so that there's not risk of abuses. I think this is the only relevant code, IIRC there is no test, but I will probably do a try run just to be sure. http://mxr.mozilla.org/mozilla-central/source/dom/src/storage/DOMStorageManager.cpp#153
Assignee: nobody → mak77
Status: NEW → ASSIGNED
and while there, we should probably run some migration to remove chromeappsstore.sqlite I guess a simple migration UI step in browser code would satisfy this requirement, I don't have better ideas on where to put it, since we don't have a "profile maintenance component".
No longer depends on: aboutPagesDOMStorage
Attachment #770869 - Flags: review?(honzab.moz)
Attached patch remove chromeappsstore.sqlite (obsolete) — Splinter Review
I will now push to try, just in case.
Attachment #770871 - Flags: review?(ttaubert)
I guess I should not try/catch OS.File since it's async!
Attachment #770871 - Attachment is obsolete: true
Attachment #770871 - Flags: review?(ttaubert)
Attachment #770873 - Flags: review?(ttaubert)
Attachment #770873 - Attachment is patch: true
Attachment #770873 - Attachment mime type: text/x-patch → text/plain
Just a couple words regarding chromeappsstore.sqlite removal, we stopped using it in Firefox 20, from that version on we supported migrating newtab page entries from it to the new storage, we are now 5 versions and 30 weeks later, so I feel like it's ok to proceed with the removal.
Depends on: 789348
Comment on attachment 770873 [details] [diff] [review] remove chromeappsstore.sqlite v2 Review of attachment 770873 [details] [diff] [review]: ----------------------------------------------------------------- I don't know of any policies of how long to keep legacy code but 5 versions feels okay to me as this is really non-critical data. If we're removing it we can also get rid of the migration code in NewTabUtils.jsm.
Attachment #770873 - Flags: review?(ttaubert) → review+
Right, for some reason I was thinking we may still need the migration code, but actually we don't. Will make a separate patch for that.
Attached patch remove newTab migration (obsolete) — Splinter Review
Attachment #770880 - Flags: review?(ttaubert)
Comment on attachment 770880 [details] [diff] [review] remove newTab migration ugh, not ready
Attachment #770880 - Flags: review?(ttaubert)
Comment on attachment 770880 [details] [diff] [review] remove newTab migration Review of attachment 770880 [details] [diff] [review]: ----------------------------------------------------------------- We can also get rid of the FileUtils.jsm import at the top. We should remove toolkit/modules/tests/xpcshell/test_newtab-migrate-v1.js. ::: toolkit/modules/NewTabUtils.jsm @@ +79,5 @@ > if (this._storedVersion < this._version) { > // This is either an upgrade, or version information is missing. > if (this._storedVersion < 1) { > + // Version 1 moved data from DOM Storage to prefs. No more supported. > + throw new Error("Unsupported newTab storage version"); We'll lose data here but I don't think we should throw. I think we should just silently update the version number.
Attachment #770869 - Flags: review?(honzab.moz) → review+
So, the only problematic case is what to do when version information is missing, that's hard to solve when it's not stored in the same store, luckily prefs are used for both now and we only have one supported version, so it's not that important. I defaulted setting pref to the first supported version, so new profiles will go through migration steps if we add more migrations, the alternative would have been to default to latest version, but then if versioning info gets lost apart from store, the store may be broken. There's some downsides both ways, but as I said for now we probably don't care much.
Attachment #770880 - Attachment is obsolete: true
Attachment #770915 - Flags: review?(ttaubert)
Comment on attachment 770915 [details] [diff] [review] remove newTab migration v2 Review of attachment 770915 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/modules/NewTabUtils.jsm @@ +121,5 @@ > + // - it's a profile where versioning information got lost > + // In this case we still run through all of the valid migrations, > + // starting from 1, as if it was a downgrade. As previously stated the > + // migrations should already support running on an updated store. > + this.__storedVersion = 1; I wonder, can't we have the same by just setting the default value of 'browser.newtabpage.storageVersion' to 1? And get rid of all the try-catch stuff?
Attachment #770915 - Flags: review?(ttaubert) → review+
Even if I move to a pref, I should still have a comment explaining that it's the first supported version and so on, the comment would end up being detached in all.js since otherwise I should still try catch if we'd stick the pref only in firefox.js. Personally I'd prefer to keep it in the module, so all comments stick together and the logic is better explained, but I don't have strong feelings about that.
Ok, feel free to ignore my comment then. I don't think this is something worth thinking too much about :)
(In reply to Wes Kocher (:KWierso) from comment #18) > Looks like browser-chrome tests got broken too? > https://tbpl.mozilla.org/php/getParsedLog.php?id=24911878&tree=Mozilla- > Inbound#error0 ah, Mac only failure. Not sure what the test is doing but sounds like it may be testing localstorage of about blank, I can try reproducing locally.
I tried debugging the social test on Win (where it passes), and looks like the FrameWorker object is "stealing" the localStorage property from the window containing "resource://gre-resources/hiddenWindow.html", that has a valid scope in localStorage:"secruoser-erg.:resource". Not sure if that is the expected behavior, but it's unclear what the FrameWorker is expected to use as source for the functionality it injects in the sandbox, since it doesn't load anything in the hidden frame before stealing its functionality. So far I'm not sure why on Mac it ends up trying to copy the localStorage from about:blank, but the global behavior of this thing looks a bit fragile. while investigating I also found this optimization in the DOM Storage Manager that can likely be removed if we stop supporting about pages: http://mxr.mozilla.org/mozilla-central/source/dom/src/storage/DOMStorageManager.cpp#353 we would indeed fail earlier by not founding a valid scope key.
apparently also indexedDB would fail in this case, it works in the next test in browser_frameworker only cause the worker is defined as https://example.com/browser/toolkit/components/social/test/browser/worker_social.js rather than a data uri.
If I load hiddenWindow.html in the iframe (and wait for its load) before proceeding, everything works on Mac as well, so it's apparently fixable, though it's very hairy and I can't still tell why it differs. Gavin, I see you worked on some of the social FrameWorker stuff, any idea?
Flags: needinfo?(gavin.sharp)
(In reply to Marco Bonardo [:mak] from comment #20) > I tried debugging the social test on Win (where it passes), and looks like > the FrameWorker object is "stealing" the localStorage property from the > window containing "resource://gre-resources/hiddenWindow.html", that has a > valid scope in localStorage:"secruoser-erg.:resource". Not sure if that is > the expected behavior, but it's unclear what the FrameWorker is expected to > use as source for the functionality it injects in the sandbox, since it > doesn't load anything in the hidden frame before stealing its functionality. It should be loading the FrameWorker's URI in the iframe before stealing the property. That doesn't sound like the expected behavior - I suppose in the tests we use data: URIs that might end up inheriting the principal of the previously-loaded page, but that should be about:blank of the frameworker's iframe rather than hiddenWindow.html. > So far I'm not sure why on Mac it ends up trying to copy the localStorage > from about:blank, but the global behavior of this thing looks a bit fragile. I guess there might be a race condition - the iframe is inserted into the document (via the call to makeHiddenFrame() in the FrameWorker constructor), then we add a document-element-inserted listener (via the call to load()), and then we load the FrameWorker URL (by setting the "src" attribute on the frame). If the document-element-inserted listener is fired for the initial about:blank load, then we're probably doing the wrong thing here.
Flags: needinfo?(gavin.sharp)
No longer depends on: 890089
Depends on: 890089
Depends on: 891516
retesting on Try, now that all dependencies should have been fixed https://tbpl.mozilla.org/?tree=Try&rev=b3af6deac557
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
"JavaScript error: about:home, line 101: NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMWindow.localStorage]" With a recent nightly
as I replied in the other bug, it's the snippets, there's no localStorage usage in about:home
Depends on: 900918
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: