sessionStorage variables not being copied to new tab

NEW
Unassigned

Status

()

6 years ago
3 years ago

People

(Reporter: niloy.mondal84, Unassigned)

Tracking

({testcase-wanted})

16 Branch
testcase-wanted

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

988 bytes, application/octet-stream
Details
(Reporter)

Description

6 years ago
User Agent: Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.10

Steps to reproduce:

Created a page "page1.html" with stores some values in sessionStorage.

Created a anchor link on page1.html that points to "page2.html" in the same domain.

Right click on the page2 anchor and select "open in new tab"


Actual results:

page2.html does not have any session variables that were created in page1.html


Expected results:

The session variables in page1.html should have been "copied" to page2.html as per the spec. Opera does this. This is required for web applications using sessionStorage to work correctly with "open in new tab".
Niloy, thank you for pointing this out. Could you please attach a testcase, in order to reproduce the issue?
Flags: needinfo?(niloy.mondal84)

Updated

6 years ago
Keywords: testcase-wanted
(Reporter)

Comment 2

6 years ago
Created attachment 690855 [details]
test case

Please extract the zip to a http server and open page1.html
Flags: needinfo?(niloy.mondal84)
Using the STR from the description and the provided testcase, I was able to reproduce the issue on the latest Nightly.

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:20.0) Gecko/20121210 Firefox/20.0
Build ID: 20121210030747
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Hardware: x86_64 → All
Hardware: All → x86_64
Component: Untriaged → Session Restore
This certainly doesn't belong to sessionstore. Is this still an issue?
Component: Session Restore → DOM
Product: Firefox → Core
Hardware: x86_64 → All
Honza?
Flags: needinfo?(honzab.moz)
This is a docshell or window watcher bug.  The cloning it self works, just needs to be called on when data has to be carried.

I'll take a look.

Thanks for the test case.
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Flags: needinfo?(honzab.moz)
Boris, what code paths are ran when we middle-click a link?  We are cloning data for window.open() in window watcher.  However there is no storage cloning added for middle-clicking a link.

This is not a regression from bug 600307.  I've just tested with Firefox 22 and the behavior is the same.  So, this bug is there since ever and nobody complained.
Also, I'm not able to confirm in any spec that middle-click has to clone.

Niloy, can you lead me to the exact part of a spec you talk about at comment 0?  Thanks.
Re: codepath, looks like openLinkIn -> loadOneTab -> addTab -> loadURIWithFlags -> nsIWebNavigation::LoadURI.
(Reporter)

Comment 10

6 years ago
Spec: http://www.w3.org/TR/2013/REC-webstorage-20130730/#the-sessionstorage-attribute

>When a new top-level browsing context is created by a script in an existing browsing context, 
>or by the user following a link in an existing browsing context, or in some other way related 
>to a specific Document, then the session storage area of the origin of that Document must be 
>copied into the new browsing context when it is created. From that point on, however, the two 
>session storage areas must be considered separate, not affecting each other in any way.
I'm kinda surprised that there is no big push on this bug.  I would expect much more reports on this issue, since this bug is there since ever and makes sessionStorage uses quite limiting.

It's sad we have so different code paths for opening a new windows and a new tab...

for ref, non-e10s stack for middle click on <a>:


0 _loadURIWithFlags(browser = [object XULElement], uri = "http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html", params = [object Object]) ["chrome://browser/content/browser.js":839]
    this = [object ChromeWindow]
1 loadURIWithFlags(aURI = "http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html", aFlags = [object Object]) ["chrome://browser/content/tabbrowser.xml":6642]
    this = [object XULElement]
2 addTab(aURI = "http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html", aReferrerURI = [xpconnect wrapped nsIURI @ 0x7962eb0 (native @ 0xcc8eb04)]) ["chrome://browser/content/tabbrowser.xml":1918]
    this = [object XULElement]
3 loadOneTab(aURI = "http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html", aReferrerURI = [xpconnect wrapped nsIURI @ 0x7962eb0 (native @ 0xcc8eb04)]) ["chrome://browser/content/tabbrowser.xml":1419]
    this = [object XULElement]
4 openLinkIn(url = "http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html", where = "tab", params = [object Object]) ["chrome://browser/content/utilityOverlay.js":358]
    this = [object ChromeWindow]
5 handleLinkClick(event = [object MouseEvent], href = "http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html", linkNode = http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html) ["chrome://browser/content/browser.js":5434]
    this = [object ChromeWindow]
6 contentAreaClick(event = [object MouseEvent]) ["chrome://browser/content/browser.js":5365]
    this = [object XULElement]



and e10s stack:


0 WebNavigation.loadURI(uri = "http://test.local.i7/p/sessionstorage/clone-middle-click-trg.html", flags = 0, referrer = [xpconnect wrapped nsIURI @ 0xadfcd90 (native @ 0x68fd9c4)], referrerPolicy = 0, postData = null, headers = null, baseURI = null) ["chrome://global/content/browser-child.js":293]
    this = [object Object]
1 WebNavigation.receiveMessage(message = [object Object]) ["chrome://global/content/browser-child.js":244]
    this = [object Object]



jdm, it seems like you know better this code and thus know where to put the cloning code.  We do this correctly for opening a new window:

http://hg.mozilla.org/mozilla-central/annotate/1dbe350b57b1/embedding/components/windowwatcher/nsWindowWatcher.cpp#l992

Could you help please?  At least point at the right place?
Flags: needinfo?(josh)
Correct me if I am wrong but once you right click "Page 2" and select "open in new tab" a new session is started. Correct? I tested this with localStorage and it works perfectly fine. Why not take that route? If sessionStorage is preferred, I'd recommend using Get and Post.
Josh, ping on ni.

Disassigning in the meantime.
Assignee: honzab.moz → nobody
Status: ASSIGNED → NEW
It's been three years since I spent any time looking at this. Any information I provide at this point will require me to start from scratch and re-learn everything, so I don't think there's any point in waiting for me.
Flags: needinfo?(josh)
Based on comment 9 you definitely know more than me, Josh. 

Since there is not much of a complain here from anyone else than the reporter, I'm really not going to work on this any time soon.
You need to log in before you can comment on or make changes to this bug.