New issue
Advanced search Search tips

Issue 695738 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

MHTML: shadow dom is not rendered into MHTML DOM dump

Project Member Reported by dim...@chromium.org, Feb 24 2017

Issue description

While creating an MHTML snapshot of the page (WebContents::GenerateMHTML) we need to go into the shadow links in order to capture the state of the custom elements. 

Repro:
1. Go to elements.polymer-project.org. If it asks to redirect to webcomponents.org, don't agree - that page has service worker which makes it a different case.
2. select some collection of elements, then go to Demo of one of them, paper-cards for example.
3. Download the Demo page, open as offline page - observe the elements to be incorrectly laid out. Use DevTools to observe that shadow subtrees are not present.


This currently breaks Polymer-based pages.

Also, we need to remove <link rel=import> from the snapshot.

Essentially, we treat those as iframes wrt MHTML generation, by replacing with the actual DOM that renders current state of the element.

Likely part of MHTML sanitization.
 
Status: Started (was: Assigned)

Comment 2 by dim...@chromium.org, Apr 12 2017

Labels: -M-58 M-60
Project Member

Comment 4 by bugdroid1@chromium.org, Jun 15 2017

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

commit 05d415724da48cbeba542558a3ce5689ec0fee93
Author: jianli <jianli@chromium.org>
Date: Thu Jun 15 00:11:17 2017

Support serializing shadow DOM to MHTML

The content of shadow DOM tree will be serialized and put within a template element that appends to the children of the shadow host element. The template element contains a special attribute to denote the mode of the shadow dom tree.

When MHTML page is being loaded, the shadow DOM tree will be recreated by the injected script to convert the templates to the shadow DOM trees.

Please see the bug for the link to the design doc.

BUG= 695738 
TEST=new tests added

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

[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp
[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.h
[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/core/frame/FrameSerializer.h
[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/WebFrameSerializer.cpp
[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
[modify] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/tests/WebFrameSerializerSanitizationTest.cpp
[add] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/tests/data/frameserialization/shadow_dom.html
[add] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/tests/data/mhtml/.gitattributes
[add] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/tests/data/mhtml/page_with_javascript.mht
[add] https://crrev.com/05d415724da48cbeba542558a3ce5689ec0fee93/third_party/WebKit/Source/web/tests/data/mhtml/shadow.mht

Comment 5 by jianli@chromium.org, Jun 16 2017

Status: Fixed (was: Started)

Sign in to add a comment