New issue
Advanced search Search tips

Issue 681434 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Feb 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 1
Type: Bug



Sign in to add a comment

iOS: SessionStorage not copied to new spawned tab

Reported by joshua.g...@gmail.com, Jan 16 2017

Issue description

Chrome Version (from "Settings > About Google Chrome"): 55.0.2883.79
Device Type: iPad Pro; iPhone 6S
URLs (if applicable): http://output.jsbin.com/lanuvudeci


Behavior in Safari (if applicable):

Works as expected (the sessionStorage item copied to new tab) on iOS 10.2 (14C92). Also works as expected on Chrome for Mac v55.0.2883.95.


Steps to reproduce:
(1) Create a page that uses the sessionStorage API to set an item, as well as a link to itself that opens in a new tab (i.e. `a` tag with attribute `target="_blank"`)
(2) Open the page, ensure the item is set, and click the link
(3) Check that the sessionStorage item has been copied to the new tab 

Expected result:

The sessionStorage item should be copied to the new tab, as per the HTML Living Standard section 11.2.2 (as of 2017-01-14): "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, and the creation is not a new start for session storage, 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." [https://html.spec.whatwg.org/multipage/webstorage.html#the-sessionstorage-attribute]


Actual result:

The sessionStorage item is not copied to the new tab.
 
fullsizeoutput_c88.jpeg
112 KB View Download
fullsizeoutput_c89.jpeg
116 KB View Download
Meant to use the permalink version to the JSBin: http://output.jsbin.com/lanuvudeci/2

Source: http://jsbin.com/lanuvudeci/2/edit?html,js
Owner: eugene...@chromium.org
eugenebut@ can you take a look?
Status: Assigned (was: Unconfirmed)
Components: Mobile>WebView>Glue
Labels: Type-Bug
Joshua, does it work in Firefox on iOS?
Hi Eugene, sorry for the delay.

I accidentally neglected to sign-in when creating the JSBin so the original has expired; I've re-posted here: http://output.jsbin.com/poyihin/1

I can confirm it works as expected on Firefox for iOS 6.0 (2), see attached.
Firefox-iOS-OriginalTab.PNG
218 KB View Download
Firefox-iOS-SpawnedTab.PNG
219 KB View Download
Cc: michaeldo@chromium.org rohitrao@chromium.org
This works correctly in stock WKWebView app, but is broken in Chrome. This link click is recognized as an ExternalRequest click and handled w/o going through normal WKWebView callbacks.

I doubt that we even need to have special handling for "ExternalRequest" in WKWebView. Rohit, do you think I can break something by removing "externalRequest" message handling from JS: 
https://cs.chromium.org/chromium/src/ios/web/web_state/js/resources/core.js?q=externalRequest&sq=package:chromium&l=561
Labels: -Pri-3 M-58 Pri-1
Project Member

Comment 8 by bugdroid1@chromium.org, Feb 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/31501962d5fe6c4e6729a6f6aa14c96170bdb6ce

commit 31501962d5fe6c4e6729a6f6aa14c96170bdb6ce
Author: eugenebut <eugenebut@chromium.org>
Date: Fri Feb 03 19:25:34 2017

EG test for sessionStorage sharing.

Newly written test reproduces  crbug.com/681434  and currently disabled
because of this bug.

BUG= 681434 

Review-Url: https://codereview.chromium.org/2672893003
Cr-Commit-Position: refs/heads/master@{#448042}

[modify] https://crrev.com/31501962d5fe6c4e6729a6f6aa14c96170bdb6ce/ios/chrome/browser/web/window_open_by_dom_egtest.mm
[modify] https://crrev.com/31501962d5fe6c4e6729a6f6aa14c96170bdb6ce/ios/testing/data/http_server_files/window_open.html

Project Member

Comment 9 by bugdroid1@chromium.org, Feb 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3652d80d4a010ce23b317bcadcf0f064c07c53e1

commit 3652d80d4a010ce23b317bcadcf0f064c07c53e1
Author: eugenebut <eugenebut@chromium.org>
Date: Tue Feb 07 19:36:08 2017

Removed externalRequest code from CRWWebController.

This code was needed for UIWebView-based app to support target="blank"
links. WKWebView natively supports opening windows by DOM and old
workaround was harmful, because it created child windows without
piping them through WKWebView callbacks which breaks sessionStorage
and cross-window scripting.

Enabled testLinkWithBlankTargetSessionStorage.
Disabled testBrowsingPreventDefaultWithLinkOpenedByJavascript because
WKWebView does not open new windows after stopPropagation() call
(crbug.com/688223).

BUG= 681434 ,579697

Review-Url: https://codereview.chromium.org/2669303004
Cr-Commit-Position: refs/heads/master@{#448696}

[modify] https://crrev.com/3652d80d4a010ce23b317bcadcf0f064c07c53e1/ios/chrome/browser/web/browsing_egtest.mm
[modify] https://crrev.com/3652d80d4a010ce23b317bcadcf0f064c07c53e1/ios/chrome/browser/web/window_open_by_dom_egtest.mm
[modify] https://crrev.com/3652d80d4a010ce23b317bcadcf0f064c07c53e1/ios/web/web_state/js/resources/core.js
[modify] https://crrev.com/3652d80d4a010ce23b317bcadcf0f064c07c53e1/ios/web/web_state/ui/crw_web_controller.h
[modify] https://crrev.com/3652d80d4a010ce23b317bcadcf0f064c07c53e1/ios/web/web_state/ui/crw_web_controller.mm

Status: Fixed (was: Assigned)
Status: Verified (was: Fixed)
Verified on iPhone 7+ iOS 10.2.1, iPad Pro iOS 10.2.1 on build 58.0.3029.76 dev
Below behavior seen.
1. Go to http://output.jsbin.com/lanuvudeci desktop site on phone
https://drive.google.com/open?id=0B6GVWQnhaMClTnZydEhpZldTQWs

2.Go to http://output.jsbin.com/poyihin/1
https://drive.google.com/open?id=0B6GVWQnhaMClX1hXdENCNXNtN2M

Sign in to add a comment