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)
        Core
          
        
        
      
        
    
        DOM: Core & HTML
          
        
        
      
        
    Tracking
()
        RESOLVED
        FIXED
        
    
  
        
            mozilla25
        
    
  
People
(Reporter: mak, Assigned: mak)
References
Details
Attachments
(3 files, 2 obsolete files)
| 1.59 KB,
          patch         | mayhemer
:
              
              review+ | Details | Diff | Splinter Review | 
| 2.76 KB,
          patch         | ttaubert
:
              
              review+ | Details | Diff | Splinter Review | 
| 8.27 KB,
          patch         | ttaubert
:
              
              review+ | Details | Diff | Splinter Review | 
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 | ||
| Updated•12 years ago
           | 
Assignee: nobody → mak77
Status: NEW → ASSIGNED
| Assignee | ||
| Comment 1•12 years ago
           | ||
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".
| Assignee | ||
| Updated•12 years ago
           | 
Blocks: aboutPagesDOMStorage
No longer depends on: aboutPagesDOMStorage
| Assignee | ||
| Comment 2•12 years ago
           | ||
        Attachment #770869 -
        Flags: review?(honzab.moz)
| Assignee | ||
| Comment 3•12 years ago
           | ||
I will now push to try, just in case.
        Attachment #770871 -
        Flags: review?(ttaubert)
| Assignee | ||
| Comment 4•12 years ago
           | ||
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)
| Assignee | ||
| Updated•12 years ago
           | 
        Attachment #770873 -
        Attachment is patch: true
        Attachment #770873 -
        Attachment mime type: text/x-patch → text/plain
| Assignee | ||
| Comment 5•12 years ago
           | ||
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.
| Assignee | ||
| Comment 6•12 years ago
           | ||
|   | ||
| Comment 7•12 years ago
           | ||
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+
| Assignee | ||
| Comment 8•12 years ago
           | ||
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.
| Assignee | ||
| Comment 9•12 years ago
           | ||
        Attachment #770880 -
        Flags: review?(ttaubert)
| Assignee | ||
| Comment 10•12 years ago
           | ||
Comment on attachment 770880 [details] [diff] [review]
remove newTab migration
ugh, not ready
        Attachment #770880 -
        Flags: review?(ttaubert)
|   | ||
| Comment 11•12 years ago
           | ||
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.
|   | ||
| Updated•12 years ago
           | 
        Attachment #770869 -
        Flags: review?(honzab.moz) → review+
| Assignee | ||
| Comment 12•12 years ago
           | ||
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 13•12 years ago
           | ||
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+
| Assignee | ||
| Comment 14•12 years ago
           | ||
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.
|   | ||
| Comment 15•12 years ago
           | ||
Ok, feel free to ignore my comment then. I don't think this is something worth thinking too much about :)
| Assignee | ||
| Comment 16•12 years ago
           | ||
https://hg.mozilla.org/integration/mozilla-inbound/rev/330f0e58a4ad
https://hg.mozilla.org/integration/mozilla-inbound/rev/056f0e496643
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d4efb0f8d7e
Target Milestone: --- → mozilla25
Depends on: 890089
Backed out for breaking Jetpack tests (see bug 890089):
https://hg.mozilla.org/integration/mozilla-inbound/rev/681e4730cb6b
Looks like browser-chrome tests got broken too? https://tbpl.mozilla.org/php/getParsedLog.php?id=24911878&tree=Mozilla-Inbound#error0
| Assignee | ||
| Comment 19•12 years ago
           | ||
(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.
| Assignee | ||
| Comment 20•12 years ago
           | ||
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.
| Assignee | ||
| Comment 21•12 years ago
           | ||
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.
| Assignee | ||
| Comment 22•12 years ago
           | ||
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)
| Comment 23•12 years ago
           | ||
(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)
| Assignee | ||
| Comment 25•12 years ago
           | ||
retesting on Try, now that all dependencies should have been fixed
https://tbpl.mozilla.org/?tree=Try&rev=b3af6deac557
| Assignee | ||
| Comment 26•12 years ago
           | ||
| Comment 27•12 years ago
           | ||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
| Comment 28•12 years ago
           | ||
"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
| Assignee | ||
| Comment 29•12 years ago
           | ||
as I replied in the other bug, it's the snippets, there's no localStorage usage in about:home
| Updated•6 years ago
           | 
Component: DOM → DOM: Core & HTML
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•