Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Issue 240592 Implement HTML Imports
Starred by 41 users Project Member Reported by morrita@google.com, May 14 2013 Back to list
Status: Fixed
Owner:
User never visited
Closed: Jul 2014
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Launch-OWP
Launch-Accessibility: ----
Launch-Legal: ----
Launch-M-Approved: ----
Launch-M-Target: ----
Launch-Privacy: ----
Launch-Security: ----
Launch-Status: ----
Launch-Test: ----
Launch-UI: ----


Sign in to add a comment
(See go/owp-launch-guide for an overview)

Change description:
Tracking bug to HTML Imports implementation: https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html

Changes to API surface:
- HTMLLinkElement
- new Import object

Public standards discussion: public-webapps

Support in other browsers: current (expected)
Internet Explorer: N/A
Firefox: Likely: https://hacks.mozilla.org/2013/05/speed-up-app-development-with-x-tag-and-web-components/
Safari: N/A


 
Comment 1 by morrita@google.com, May 14 2013
Owner: morrita@chromium.org
A rough plan is
- to implement bare-bone import which just load a document without having any side effect to the master,
- help implementing custom element declarative part,
- use it in imports
- add external resource loading like CSS and JS and
- add sub-import once its de-dup semantics is settled.
 
Big fan of the plan. We need to make sure that at every step, we can give Web developers something to try out, measure, and provide feedback. For example, the spec as defined is not very useful for custom elements, but it already should have better performance characteristics than any polyfill, since the import document could be parsed on a separate thread.
Comment 3 by morrita@google.com, May 20 2013
Labels: Cr-Blink-WebComponents
Project Member Comment 4 by bugdroid1@chromium.org, May 20 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=150645

------------------------------------------------------------------------
r150645 | morrita@chromium.org | 2013-05-20T05:00:33.647026Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/scripts/make_runtime_features.py?r1=150645&r2=150644&pathrev=150645
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/RuntimeEnabledFeatures.in?r1=150645&r2=150644&pathrev=150645

Add HTMLImports features flag.

TEST=none
BUG= 240592 

Review URL: https://chromiumcodereview.appspot.com/15436002
------------------------------------------------------------------------
Project Member Comment 5 by bugdroid1@chromium.org, May 20 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=150658

------------------------------------------------------------------------
r150658 | morrita@chromium.org | 2013-05-20T09:13:40.995705Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.h?r1=150658&r2=150657&pathrev=150658
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.cpp?r1=150658&r2=150657&pathrev=150658

Refactoring: Make LinkStyle instantiation lazy

This change makes LinkStyle instantiation lazy so that
we can identify exactly when we need LinkStyle.
In following changes, I'll introduce another Link object
which will be LinkImport. LinkStyle and LinkImport is mutually
exclusive, and linkStyleToProcess() will become kind of
factdory method.

BUG= 240592 
TEST=none

Review URL: https://chromiumcodereview.appspot.com/15415004
------------------------------------------------------------------------
Labels: hotlist-toolkit
Project Member Comment 7 by bugdroid1@chromium.org, May 22 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=150857

------------------------------------------------------------------------
r150857 | morrita@chromium.org | 2013-05-22T04:07:20.900698Z

Changed paths:
   D http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedSVGDocument.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/WebKitCSSSVGDocumentValue.cpp?r1=150857&r2=150856&pathrev=150857
   D http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedSVGDocument.h?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/accessibility/AccessibilityRenderObject.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/FilterEffectRenderer.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/WebKitCSSSVGDocumentValue.h?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/resolver/StyleResolver.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/RenderLayerFilterInfo.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=150857&r2=150856&pathrev=150857
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedDocument.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/rendering/RenderLayerFilterInfo.h?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedSVGDocumentReference.h?r1=150857&r2=150856&pathrev=150857
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedDocument.h?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.h?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGUseElement.cpp?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGUseElement.h?r1=150857&r2=150856&pathrev=150857
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceClient.h?r1=150857&r2=150856&pathrev=150857

Refactoring: Generalize CachedSVGDocument for non-SVG use.

This change generalizes CachedSVGDocument to CachedDocument,
which manages Document instead of Document.
Currently, CachedDocument implementation accepts only SVG.
Further changes will follow.

This is a preparation for HTML Imports implementation.

BUG= 240592 
TEST=none
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/15556002
------------------------------------------------------------------------
Comment 8 by saroop@chromium.org, May 23 2013
Cc: saroop@chromium.org
Status: Started
Cc: gregsimon@chromium.org
Project Member Comment 11 by bugdroid1@chromium.org, May 31 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=151523

------------------------------------------------------------------------
r151523 | morrita@chromium.org | 2013-05-31T05:09:45.700102Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptElement.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.h?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-owner-expected.txt?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/bye.css?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.h?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/same-origin.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-remove-expected.txt?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkResource.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/rel-style-to-import-expected.txt?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/rel-import-to-style-expected.txt?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/cookie.cgi?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-insert-expected.txt?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLDocumentParser.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/block-cookies.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/bye.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-success-fail.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/import-helpers.js?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/placeholder.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/cors-same-origin-expected.txt?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/cross-origin-expected.txt?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/tests/LinkRelAttribute.cpp?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.idl?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLScriptRunner.h?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptableDocumentParser.h?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/hello.css?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-owner.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/cors-basic.cgi?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkRelAttribute.h?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-remove.html?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-same-url-expected.txt?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/StyleSheetContents.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/rel-import-to-style.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/rel-style-to-import.html?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-insert.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/hello.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/hello.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/cors-same-origin.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/cross-origin.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkResource.h?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/same-origin-expected.txt?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLScriptRunner.cpp?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLDocumentParser.h?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-same-url.html?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports?r1=151523&r2=151522&pathrev=151523
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkRelAttribute.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-success-fail-expected.txt?r1=151523&r2=151522&pathrev=151523
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/block-cookies-expected.txt?r1=151523&r2=151522&pathrev=151523

Implement bare-bones of HTMLImports

This CL includes following parts of HTMLImports

- HTMLLinkElement.import property
- Single-level imports loading
- Duplication management - Imports of same URL point same DocumentFragment
- Proper CORS control

But it doesn't have:

- Sub-import loading,
- Anything more than DOM tree construction (like running script, etc.),
- Reasonable performance: No progressive HTML parsing, no prefetching.

This change introduces two major classes:
HTMLImportsController and LinkImport:

- The controller is a per-master-document registry of imports. It tracks
  all imports in the master document.
- LinkImport is a dual of LinkStyle. It manages per-element states
  like imported document fragment. LinkImport is a client of
  CachedResource.

Several parts of the core module are extended to adopt HTMLImports:

- HTMLScriptRunner and StyleElement becomes aware of blocking imports.
  They pauses until all imports, not only stylesheets, are loaded before execution.
- HTMLLinkElement adopts rel=import attribute and create
  a LinkImport instance instead of one of LinkStyle for the attribute.
- LinkResource superclass is pulled out from LinkStyle
  and new LinkImport derives from it.

BUG= 240592 
TEST=fast/html/imports/, http/tests/htmlimports/
R=dglazkov@chromium.org

Review URL: https://codereview.chromium.org/15856002
------------------------------------------------------------------------
Project Member Comment 12 by bugdroid1@chromium.org, Jun 3 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=151624

------------------------------------------------------------------------
r151624 | yoshinori.sano@gmail.com | 2013-06-03T02:14:31.397080Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkRelAttribute.cpp?r1=151624&r2=151623&pathrev=151624

Remove duplicated else if "dns-prefetch" branch

In the LinkRelAttribute constructor, else if "dns-prefetch" branch is
duplicated. This is harmless but meaningless. The duplication is
introduced by r151523.

BUG= 240592 

Review URL: https://chromiumcodereview.appspot.com/16294006
------------------------------------------------------------------------
Blocking: chromium:245358
Project Member Comment 14 by bugdroid1@chromium.org, Jun 18 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=152614

------------------------------------------------------------------------
r152614 | morrita@chromium.org | 2013-06-18T07:29:52.315974Z

Changed paths:
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-owner.html?r1=152614&r2=152613&pathrev=152614
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=152614&r2=152613&pathrev=152614
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/imported-document.html?r1=152614&r2=152613&pathrev=152614
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/resources/testharness.css?r1=152614&r2=152613&pathrev=152614
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/resources/testharnessreport.js?r1=152614&r2=152613&pathrev=152614
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=152614&r2=152613&pathrev=152614
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/resources/testharness.js?r1=152614&r2=152613&pathrev=152614
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.cpp?r1=152614&r2=152613&pathrev=152614
   D http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-owner-expected.txt?r1=152614&r2=152613&pathrev=152614
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.h?r1=152614&r2=152613&pathrev=152614
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/imported-document-expected.txt?r1=152614&r2=152613&pathrev=152614
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.idl?r1=152614&r2=152613&pathrev=152614

[HTML Imports] Make HTMLLinkElement.import a Document.

This follows spec change on https://www.w3.org/Bugs/Public/show_bug.cgi?id=22305
which asks imported fragment should be imported "document" to allow it to have
URL and other APIs.

BUG= 240592 
TEST=imported-document.html
R=dglazkov@chromium.org

Review URL: https://codereview.chromium.org/16936002
------------------------------------------------------------------------
Project Member Comment 15 by bugdroid1@chromium.org, Jun 19 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=152698

------------------------------------------------------------------------
r152698 | morrita@chromium.org | 2013-06-19T05:36:20.933780Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=152698&r2=152697&pathrev=152698
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-shared-remove-expected.txt?r1=152698&r2=152697&pathrev=152698
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=152698&r2=152697&pathrev=152698
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-shared-remove.html?r1=152698&r2=152697&pathrev=152698

Extract HTMLImportLoader from LinkImport

This change extract loading facility and ownership of imported document
from LinkImport to HTMLImportLoader, by doing this, sharing import
between <link>s can be represented in straightforward way.

Before this change, all shared imports of an URL become unavailable once
the first <link> is removed from tree. This extraction fixes the problem.

BUG= 240592 
TEST=import-shared-remove.html
R=dglazkov
R=dominicc

Review URL: https://chromiumcodereview.appspot.com/17137008
------------------------------------------------------------------------
Project Member Comment 16 by bugdroid1@chromium.org, Jun 20 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=152755

------------------------------------------------------------------------
r152755 | morrita@chromium.org | 2013-06-20T06:23:23.451014Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/no-browsing-context.html?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/sub-imports-loop.html?r1=152755&r2=152754&pathrev=152755
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-same-url.html?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/root.html?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/sub-imports-expected.txt?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/no-browsing-context-expected.txt?r1=152755&r2=152754&pathrev=152755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-master.html?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/loop-child.html?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/loop-root.html?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/sub-imports-loop-expected.txt?r1=152755&r2=152754&pathrev=152755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.cpp?r1=152755&r2=152754&pathrev=152755
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-same-url-expected.txt?r1=152755&r2=152754&pathrev=152755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=152755&r2=152754&pathrev=152755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.h?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-master-expected.txt?r1=152755&r2=152754&pathrev=152755
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/sub-imports.html?r1=152755&r2=152754&pathrev=152755

[HTML Imports] Implement sub-imports processing.

s change introduces sub-imports processing.
Before this change, a placeholder document for imported document is
plain frame-less document and it didn't load any external resources.

This change lets imported documents share HTMLImportsController with the master document,
so that the document can do (sub)-import processing using the shared controller.

Each <link> in a document sees if the owner document has an import controller,
and starts loading import if there is the controller available.

BUG= 240592 
TEST=import-master.html, no-browsing-context.html, sub-imports.html, sub-imports-loop.html
R=dglazkov@chromium.org

Review URL: https://codereview.chromium.org/17419007
------------------------------------------------------------------------
Comment 17 by morrita@google.com, Jun 20 2013
Next step:
- Make parsing incremental. 
- Enable script execution during parsing. (https://www.w3.org/Bugs/Public/show_bug.cgi?id=22413)
Comment 18 by morrita@google.com, Jun 20 2013
Blockedon: chromium:252104
Comment 19 by morrita@google.com, Jun 24 2013
Spec side bug for script execution: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22413

Comment 20 by morrita@google.com, Jun 24 2013
Issue 252104 has been merged into this issue.
Project Member Comment 21 by bugdroid1@chromium.org, Jul 3 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=153471

------------------------------------------------------------------------
r153471 | morrita@chromium.org | 2013-07-03T05:22:37.403561Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceRequest.h?r1=153471&r2=153470&pathrev=153471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptElement.cpp?r1=153471&r2=153470&pathrev=153471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResource.h?r1=153471&r2=153470&pathrev=153471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.cpp?r1=153471&r2=153470&pathrev=153471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceRequest.cpp?r1=153471&r2=153470&pathrev=153471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptElement.h?r1=153471&r2=153470&pathrev=153471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.h?r1=153471&r2=153470&pathrev=153471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoaderOptions.h?r1=153471&r2=153470&pathrev=153471

[Refactoring] Extract CachedResourceLoader::canAccess()

This moves origin-based access control decision from ScriptElement to
CachedResourceLoader. Now the flag from the CORS-setting attribute
@crossorigin is stored as an ResourceLoaderOption instead of ScriptElement::m_usesRequestControl
and the decision is made by CachedResouceLoader::canAccess() instead of ScriptElement::notifyDone().
As a result, direct dependency to ResoruceRequest from ScriptElement is also fade away.

This abstraction will be used by HTML Imports as well.

TEST=none
BUG= 240592 
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/18497002
------------------------------------------------------------------------
Project Member Comment 22 by bugdroid1@chromium.org, Jul 4 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=153546

------------------------------------------------------------------------
r153546 | morrita@chromium.org | 2013-07-04T01:58:52.238193Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=153546&r2=153545&pathrev=153546
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/redirect.html?r1=153546&r2=153545&pathrev=153546
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=153546&r2=153545&pathrev=153546
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.cpp?r1=153546&r2=153545&pathrev=153546
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/DocumentWriter.cpp?r1=153546&r2=153545&pathrev=153546
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/cross-origin-expected.txt?r1=153546&r2=153545&pathrev=153546
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/redirect-expected.txt?r1=153546&r2=153545&pathrev=153546
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/security/resources/cors-redir.php?r1=153546&r2=153545&pathrev=153546

[HTML Imports] Make import loading and parsing progressive.

This change incoporates DocumentWriter and CachedRawResource for
HTML import loading. By this change, HTMLImportsLoader becomes
a simplified version of DocumentLoader: It doesn't have any Frame or
other browsing related complexity, but does support progressive HTML parsing.

Note that this doesn't consider the order of the loading yet. That should eventually
be handled once the imports support script execution.

TEST=none
BUG= 240592 
R=abarth@chromium.org, dglazkov@chromium.org

Review URL: https://codereview.chromium.org/18016003
------------------------------------------------------------------------
Project Member Comment 23 by bugdroid1@chromium.org, Jul 9 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=153748

------------------------------------------------------------------------
r153748 | morrita@chromium.org | 2013-07-09T05:39:18.267021Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptElement.cpp?r1=153748&r2=153747&pathrev=153748
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGScriptElement.cpp?r1=153748&r2=153747&pathrev=153748
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptElement.h?r1=153748&r2=153747&pathrev=153748
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGScriptElement.h?r1=153748&r2=153747&pathrev=153748
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLScriptElement.cpp?r1=153748&r2=153747&pathrev=153748
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLScriptElement.h?r1=153748&r2=153747&pathrev=153748

Refactoring: Decouple ScriptElement from HTMLScriptElement and SVGScriptElement.

This change pulls ScriptElement out from Element inheritance chain.
This give us an opportunity to decouple the lifetime of the element and
script loading and execution. Various states which is realted to script loading
won't be needed and can be discarded once it is feed to the script engine.
Such refactoring will follow.

Also in a coming change, ScriptElement will be renamed to ElementScriptLoader.

TEST=none
BUG= 240592 
R=eseidel,dglazkov,abarth

Review URL: https://chromiumcodereview.appspot.com/18676002
------------------------------------------------------------------------
Project Member Comment 24 by bugdroid1@chromium.org, Jul 9 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=153755

------------------------------------------------------------------------
r153755 | morrita@chromium.org | 2013-07-09T07:10:09.468487Z

Changed paths:
   D http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptElement.cpp?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGScriptElement.cpp?r1=153755&r2=153754&pathrev=153755
   D http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptElement.h?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGScriptElement.h?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLConstructionSite.cpp?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLScriptElement.cpp?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/xml/parser/XMLDocumentParser.cpp?r1=153755&r2=153754&pathrev=153755
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptLoader.cpp?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLOptionElement.cpp?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLScriptElement.h?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptRunner.cpp?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=153755&r2=153754&pathrev=153755
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptLoaderClient.h?r1=153755&r2=153754&pathrev=153755
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptLoader.h?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptRunner.h?r1=153755&r2=153754&pathrev=153755
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLScriptRunner.cpp?r1=153755&r2=153754&pathrev=153755

Rename ScriptElement to ScriptLoader

This change renames ScriptElement to ScriptLoader.
This also does related renames:
- ScriptElementClient -> ScriptLoaderClient
- HTMLScriptElement::m_scriptElement -> HTMLScriptElement::m_loader
- Ditto for SVGScriptElement

As a bonus, ScriptLoaderClient got its own header file
which hides ScriptLoader from majority of core files.

BUG= 240592 
TEST=none
R=hayato@chromium.org

Review URL: https://codereview.chromium.org/18261015
------------------------------------------------------------------------
Project Member Comment 25 by bugdroid1@chromium.org, Jul 11 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=153977

------------------------------------------------------------------------
r153977 | morrita@chromium.org | 2013-07-11T05:53:54.856495Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=153977&r2=153976&pathrev=153977
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.h?r1=153977&r2=153976&pathrev=153977
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.cpp?r1=153977&r2=153976&pathrev=153977
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.h?r1=153977&r2=153976&pathrev=153977
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=153977&r2=153976&pathrev=153977
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.cpp?r1=153977&r2=153976&pathrev=153977
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=153977&r2=153976&pathrev=153977

Refactoring: Introduce HTMLImport interface to form import tree.

This change introduces HTMLImport abstract class which is derived by
HTMLImportLoader and HTMLImportsController.

- A set of HTMLImport forms a tree which represents the import dependnecy.
  Currently only child-to-parent link is available. The tree root is
  a HTMLImportController.

- Document now refers HTMLImport instead of HTMLImportController.
  For the master document, the object is HTMLImportController.
  For each imported document, it is a HTMLImportLoader which loads the document.
  Note that the only interaction from a document to its import is
  to ask if all of its (sub) imports are loaded.

- HTMLImportsController is turned from a RefCounted to a document Supplement.
  The lifetime is managed by the supplement machinery instead of RefPtr
  which Document::m_import originally was.
  Now m_import is a weak, raw pointer and is cleared by HTMLImport subclasses.

- didLoad() notification is now fired recursively up to
  the import dependency chain. This is crusial when
  scripts inside imported documents block the document parsing
  and let the notification unblock it.

TEST=none
BUG= 240592 
R=dglazkov@chromium.org

Review URL: https://codereview.chromium.org/18467003
------------------------------------------------------------------------
Project Member Comment 26 by bugdroid1@chromium.org, Jul 12 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=154082

------------------------------------------------------------------------
r154082 | morrita@chromium.org | 2013-07-12T05:09:12.350982Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.cpp?r1=154082&r2=154081&pathrev=154082
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=154082&r2=154081&pathrev=154082
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=154082&r2=154081&pathrev=154082
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.h?r1=154082&r2=154081&pathrev=154082
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.cpp?r1=154082&r2=154081&pathrev=154082
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.h?r1=154082&r2=154081&pathrev=154082
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=154082&r2=154081&pathrev=154082

Refactoring: Introduce HTMLImport interface to form import tree.

This change introduces HTMLImport abstract class which is derived by
HTMLImportLoader and HTMLImportsController.

- A set of HTMLImport forms a tree which represents the import dependnecy.
  Currently only child-to-parent link is available. The tree root is
  a HTMLImportController.

- Document now refers HTMLImport instead of HTMLImportController.
  For the master document, the object is HTMLImportController.
  For each imported document, it is a HTMLImportLoader which loads the document.
  Note that the only interaction from a document to its import is
  to ask if all of its (sub) imports are loaded.

- HTMLImportsController is turned from a RefCounted to a document Supplement.
  The lifetime is managed by the supplement machinery instead of RefPtr
  which Document::m_import originally was.
  Now m_import is a weak, raw pointer and is cleared by HTMLImport subclasses.

- didLoad() notification is now fired recursively up to
  the import dependency chain. This is crusial when
  scripts inside imported documents block the document parsing
  and let the notification unblock it.

TEST=none
BUG= 240592 
R=dglazkov@chromium.org

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153977

Review URL: https://chromiumcodereview.appspot.com/18467003
------------------------------------------------------------------------
Project Member Comment 27 by bugdroid1@chromium.org, Jul 16 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=154278

------------------------------------------------------------------------
r154278 | morrita@chromium.org | 2013-07-16T07:44:54.164088Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/xml/XMLHttpRequest.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/animation/PlayerTest.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/DocumentLoader.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/SinkDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedDocument.cpp?r1=154278&r2=154277&pathrev=154278
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/DocumentInit.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/editing/markup.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/MediaDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLViewSourceDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/ImageDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/TextDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/inspector/DOMPatchSupport.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/DOMImplementation.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/PluginDocument.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedFont.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLDocument.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/SinkDocument.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/MediaDocument.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLViewSourceDocument.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/animation/DocumentTimelineTest.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/ImageDocument.cpp?r1=154278&r2=154277&pathrev=154278
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/DocumentInit.h?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/TextDocument.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/xml/XSLTProcessor.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/svg/SVGDocument.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.cpp?r1=154278&r2=154277&pathrev=154278
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/PluginDocument.cpp?r1=154278&r2=154277&pathrev=154278

Refactoring: Extract DocumentInit for capture Document construction parameter.

This change replaces a set of parameters for the Document constructor
with DocumentInit class.

The motivation here is to pass a HTMLImport to the constructor.
In a coming change, passed import object will affect how the
security context of the document is decided.

For that purpose, DocumentInit encapsulates which Frame is
being used to initialize the context. The coming change will extend it
so taht HTML Imports can load external scripts.

Since DocumentInit has a default constructor, call sites where create
empty documents become cleaner.

BUG= 240592 
TEST=none
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/18808004
------------------------------------------------------------------------
Labels: -Pri-2 Pri-1
toolkit-hotlist scrub - raising priority 
Project Member Comment 29 by bugdroid1@chromium.org, Jul 18 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=154452

------------------------------------------------------------------------
r154452 | morrita@chromium.org | 2013-07-18T01:11:56.494117Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.cpp?r1=154452&r2=154451&pathrev=154452
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoader.cpp?r1=154452&r2=154451&pathrev=154452
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.h?r1=154452&r2=154451&pathrev=154452
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoaderHost.h?r1=154452&r2=154451&pathrev=154452
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontSelector.cpp?r1=154452&r2=154451&pathrev=154452
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResource.cpp?r1=154452&r2=154451&pathrev=154452
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoader.h?r1=154452&r2=154451&pathrev=154452
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/DocumentLoader.cpp?r1=154452&r2=154451&pathrev=154452

Refactoring: Introduce ResouceLoaderHost interface for unloading ResourceLoader.

This moves several direct dependencies of ResourceLoader into
newly inroduced ResouceLoaderHost interface, which is implemented by
CachedResourceLoader.

The motivation here is to make ResourceLoader working without DocumentLoader
and FrameLoader so that scripts can be loaded through imported documents, which
doesn't have a DocumentLoader.

Note that CachedResourceLoader already lives without DocumentLoader in some case,
thus it is natural to localize such kind of complication there and keep ResourceLoader
straightforward.

BUG= 240592 
TEST=none
R=japhet@chromium.org

Review URL: https://codereview.chromium.org/19574002
------------------------------------------------------------------------
Project Member Comment 30 by bugdroid1@chromium.org, Jul 18 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=154458

------------------------------------------------------------------------
r154458 | tkent@chromium.org | 2013-07-18T02:23:57.061785Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontSelector.cpp?r1=154458&r2=154457&pathrev=154458
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResource.cpp?r1=154458&r2=154457&pathrev=154458
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoader.h?r1=154458&r2=154457&pathrev=154458
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/DocumentLoader.cpp?r1=154458&r2=154457&pathrev=154458
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.cpp?r1=154458&r2=154457&pathrev=154458
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoader.cpp?r1=154458&r2=154457&pathrev=154458
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.h?r1=154458&r2=154457&pathrev=154458
   D http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoaderHost.h?r1=154458&r2=154457&pathrev=154458

Revert 154452 "Refactoring: Introduce ResouceLoaderHost interfac..."

> Refactoring: Introduce ResouceLoaderHost interface for unloading ResourceLoader.
> 
> This moves several direct dependencies of ResourceLoader into
> newly inroduced ResouceLoaderHost interface, which is implemented by
> CachedResourceLoader.
> 
> The motivation here is to make ResourceLoader working without DocumentLoader
> and FrameLoader so that scripts can be loaded through imported documents, which
> doesn't have a DocumentLoader.
> 
> Note that CachedResourceLoader already lives without DocumentLoader in some case,
> thus it is natural to localize such kind of complication there and keep ResourceLoader
> straightforward.
> 
> BUG= 240592 
> TEST=none
> R=japhet@chromium.org
> 
> Review URL: https://codereview.chromium.org/19574002

TBR=morrita@chromium.org

Review URL: https://codereview.chromium.org/19683007
------------------------------------------------------------------------
Project Member Comment 31 by bugdroid1@chromium.org, Jul 18 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=154471

------------------------------------------------------------------------
r154471 | morrita@chromium.org | 2013-07-18T06:14:18.151184Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/DocumentLoader.cpp?r1=154471&r2=154470&pathrev=154471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.cpp?r1=154471&r2=154470&pathrev=154471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoader.cpp?r1=154471&r2=154470&pathrev=154471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResourceLoader.h?r1=154471&r2=154470&pathrev=154471
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoaderHost.h?r1=154471&r2=154470&pathrev=154471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/css/CSSFontSelector.cpp?r1=154471&r2=154470&pathrev=154471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResource.cpp?r1=154471&r2=154470&pathrev=154471
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/ResourceLoader.h?r1=154471&r2=154470&pathrev=154471

Refactoring: Introduce ResouceLoaderHost interface for unloading ResourceLoader.

This moves several direct dependencies of ResourceLoader into
newly inroduced ResouceLoaderHost interface, which is implemented by
CachedResourceLoader.

The motivation here is to make ResourceLoader working without DocumentLoader
and FrameLoader so that scripts can be loaded through imported documents, which
doesn't have a DocumentLoader.

Note that CachedResourceLoader already lives without DocumentLoader in some case,
thus it is natural to localize such kind of complication there and keep ResourceLoader
straightforward.

BUG= 240592 
TEST=none
R=japhet@chromium.org

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=154452

Review URL: https://chromiumcodereview.appspot.com/19574002
------------------------------------------------------------------------
Project Member Comment 32 by bugdroid1@chromium.org, Jul 25 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=154924

------------------------------------------------------------------------
r154924 | morrita@chromium.org | 2013-07-25T18:42:12.566312Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/ContentSecurityPolicy.cpp?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-block-import-non-self.html?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/ResourceFetcher.cpp?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.h?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/page/ContentSecurityPolicy.h?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.cpp?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-not-block-import-in-import-expected.txt?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/ResourceFetcher.h?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.h?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-block-import-non-self-expected.txt?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/csp-blocking.cgi?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-in-imports.html?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/DocumentInit.cpp?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-block-import.html?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/having-csp-directive.html?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/importing-cors.html?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/DocumentInit.h?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/FrameLoader.cpp?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-in-imports-expected.txt?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-not-block-import-in-import.html?r1=154924&r2=154923&pathrev=154924
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-block-import-expected.txt?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.cpp?r1=154924&r2=154923&pathrev=154924
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/CachedResource.h?r1=154924&r2=154923&pathrev=154924

[HTML Import] Respect Content Security Policy Model

See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22752 for the expected behavior.

This change teaches DocumentInit about Imports:
- The security context of the imported document should be master's context (frame).
- Each imported document should have its own CSP. It is enforced by the HTTP header
   which it is served with, for example.

This change also teaches CachedResourceLoader about Imports. That is,
imports should be loaded as if it is a script in terms of CSP.

This change doesn't cover scripting on imported documents since it is yet to be implemented.
We should test CSP cases when we implemented the scripting.

BUG= 240592 
TEST=http/tests/htmlimports/csp-*.html
R=abarth,dglazkov

Review URL: https://chromiumcodereview.appspot.com/19940002
------------------------------------------------------------------------
My understanding is that this is only available in content_shell --dump-render-tree; is that right? In terms of "at every step, we can give Web developers something to try out, measure, and provide feedback" (Comment 2) can you give us an update of when this will be available in Canary?
Comment 34 by morrita@google.com, Jul 29 2013
I'll announce it on polymer-dev or somewhere when it's available.
Without scripting, it's clearly useless IMO and it can even break polyfill since
the loading can occur forcibly. That's why I keep this behind the flag at this moment.

Project Member Comment 35 by bugdroid1@chromium.org, Jul 30 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=155149

------------------------------------------------------------------------
r155149 | morrita@chromium.org | 2013-07-30T08:54:22.944966Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-script-prototypes-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/child-having-unsafe-eval-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-domain-nested-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval-nested.html?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLResourcePreloader.cpp?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/script-leaf.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/having-unsafe-inline-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/external-script-with-nonce.js?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-script-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/script-leaf-external-async.js?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptLoader.h?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/having-nonce-policy.html?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/DocumentInit.cpp?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-script-nosniff-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/sniff-js.cgi?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/having-unsafe-eval-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/cors-js.cgi?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/having-domain-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/having-sniffing-script.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-domain-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-script-prototypes.html?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-self-nested-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/run-check.js?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-domain-nested.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-nested-expected.txt?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/ResourceFetcher.cpp?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/script-leaf-external.js?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce-nested-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-script.html?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-master-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/child-having-domain-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/having-self-policy.html?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.h?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-script-nosniff.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptLoader.cpp?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-self-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-domain.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-expected.txt?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/parser/HTMLDocumentParser.cpp?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-self-nested.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval-nested-expected.txt?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/script-leaf-external-dynamic.js?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-nested.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/resources/script-prototype-test.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/child-having-self-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-unsafe-inline-and-eval.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce-nested.html?r1=155149&r2=155148&pathrev=155149
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-master.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/child-having-unsafe-inline-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/cors-js-for-localhost.cgi?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/csp-import-block-but-self.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/child-having-nonce-policy.html?r1=155149&r2=155148&pathrev=155149
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/external-script.js?r1=155149&r2=155148&pathrev=155149

[HTML Imports] Let script of imported document running.

This change allows <script> inside imported document running.
The implementation is based on a proposal at
https://www.w3.org/Bugs/Public/show_bug.cgi?id=22413.

This CL teaches ScriptLoader about HTML Imports so that it loads and
evaluates script if the document is an import.

For that purpose, now ScriptLoader distinguishes "executing document" which
is a master and "element" document which is an import, then executes scripts
on "executing" document.

Here are some remarks:
- This change doesn't make other resources, including stylesheets and images,
   being loaded on imports. The spec doesn't mention about them.
- This change doesn't take care of execution order. It will be attacked in
   following changes.
- Some of new CSP related tests capture some FAILures. This represents the 
   current limitation of Blink's CSP handling of HTML Import:
   It cannot prohibit eval() in imports and just follows master's context.
   This is because the imported scripts run on master's context and
   there is no way to the source of the eval() calls.

BUG= 240592 
TEST=csp-import-block-but-*.html, import-script-nosniff.html, import-script.html,
          import-script-prototypes.html
R=dglazkov,abarth

Review URL: https://chromiumcodereview.appspot.com/19762002
------------------------------------------------------------------------
Project Member Comment 36 by bugdroid1@chromium.org, Jul 31 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=155228

------------------------------------------------------------------------
r155228 | morrita@chromium.org | 2013-07-31T08:00:53.214425Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/import-blocking-child-2.html?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-child-expected.txt?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-nested-child-blocks-child.html?r1=155228&r2=155227&pathrev=155228
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=155228&r2=155227&pathrev=155228
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.cpp?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-nested-child.html?r1=155228&r2=155227&pathrev=155228
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=155228&r2=155227&pathrev=155228
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.cpp?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-nested-child-blocks-child-expected.txt?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/import-blocking-nested-child-1.html?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/import-blocking-nested-child-2.html?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-nested-child-expected.txt?r1=155228&r2=155227&pathrev=155228
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.h?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/blocking-script-js.cgi?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-nested-child-blocks-nested-child.html?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-child-blocks-child.html?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-child.html?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/blocked-script.js?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-nested-child-blocks-nested-child-expected.txt?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-blocking-child-blocks-child-expected.txt?r1=155228&r2=155227&pathrev=155228
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/import-blocking-child-1.html?r1=155228&r2=155227&pathrev=155228

[HTML Imports] Make import loading in order.

This change makes script loading in order from script viewpoint.
That means, all imports and scripts inside them are now loaded and executed
bofore following script.

Similar facily has been partially implemented, where there is a guarantee that
all subimports are loaded before following script execution in the parent
import or the master document. This change extends it to support better ordering.

For example, let's think about following import dependency:

master - i0 - i1 - s0
       - i2 - i3 - s1

where ix is an import and sx is a script.
In this example, master imports i0 and i2, i0 imports i1, and i1 includes s0, etc.
This change guarantees that s0 is executed before s1.

For this purpose, documents need to block the parser.
The blocking criteria is returned from HTMLImport::isBlocked().
(It was HTMLImport::haveChildrenLoaded() before.)
And this change is all about computing this "blocked" bit on each import.

There are three notable changes:

- Now the "blocked" bit is stored as HTMLImport::m_import flag. Originally it was
  computed for each query. It becomes too complex and expensive to do on demand.
  The flag is updated if a) new imports are requested via <link>, or b) an imported
  document is completely parsed. (a) turns on flags since such new imports can
  block existing import loading, then (b) is done for possibly unblocking them.

- The update phase is now done in a timer callback instead of doing it immediately
  in notification from parsers and resources. This separation eliminates
  hidden callback reentrancy and deep callstack, both of which are hard to debug.
  See HTMLImportsController::unblockTimerFired() for more detail.

- HTMLImports got m_children list to represent dependency tree.
  This list is used to traverse the dependnecy tree for updating the blocking flag.

BUG= 240592 
TEST=htmlimpots/import-blocking-*.html
R=dglazkov@chromium.org

Review URL: https://codereview.chromium.org/21182004
------------------------------------------------------------------------
Project Member Comment 37 by bugdroid1@chromium.org, Aug 8 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=155728

------------------------------------------------------------------------
r155728 | morrita@chromium.org | 2013-08-08T01:51:37.791138Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.cpp?r1=155728&r2=155727&pathrev=155728
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkImport.h?r1=155728&r2=155727&pathrev=155728
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.cpp?r1=155728&r2=155727&pathrev=155728
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImport.h?r1=155728&r2=155727&pathrev=155728
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportLoader.cpp?r1=155728&r2=155727&pathrev=155728
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=155728&r2=155727&pathrev=155728
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkImport.cpp?r1=155728&r2=155727&pathrev=155728
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=155728&r2=155727&pathrev=155728
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportLoader.h?r1=155728&r2=155727&pathrev=155728
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=155728&r2=155727&pathrev=155728

[HTML Imports] Refactoring: Split HTMLImportsController into per-class files.

This change
- Adds HTMLImportLoader.cpp/h
- Adds LinkImport.cpp/h
- Adds HTMLImportRoot class to abstract the controller detail away from the loader.
- Turns HTMLImportLoader::create() to HTMLImportController::createLoader()
  to streamline the dependency.

BUG= 240592 
R=dglazkov,dominicc
TEST=none

Review URL: https://chromiumcodereview.appspot.com/22561002
------------------------------------------------------------------------
Project Member Comment 39 by bugdroid1@chromium.org, Aug 9 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=155818

------------------------------------------------------------------------
r155818 | morrita@chromium.org | 2013-08-09T03:47:02.303388Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/loader/cache/FetchRequest.h?r1=155818&r2=155817&pathrev=155818
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-onerror.html?r1=155818&r2=155817&pathrev=155818
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-onload-expected.txt?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportLoader.cpp?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.cpp?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkImport.cpp?r1=155818&r2=155817&pathrev=155818
   A http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportLoaderClient.h?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportLoader.h?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLImportsController.h?r1=155818&r2=155817&pathrev=155818
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-onerror-expected.txt?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.cpp?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkImport.h?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/HTMLLinkElement.h?r1=155818&r2=155817&pathrev=155818
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/html/imports/import-onload.html?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/core.gypi?r1=155818&r2=155817&pathrev=155818
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/html/LinkResource.h?r1=155818&r2=155817&pathrev=155818

[HTML Imports] Implement "load" and "error" events.

To implement event delivery, this change does

- Generalize HTMLLinkElement and LinkResource classes so that
  LinkImport class can reap the same plumblings as stylesheet link,
- Introduces HTMLImportsLoaderClient, which is impleented by
  LinkImport, so that HTMLImportLoader notfies the readiness to
  its client. HTMLImportsLoader is capable to multiple client
  for import sharing. In such a case, multiple LinkImport objects
  point same loader object.

In addition, this change refactors HTMLImportsController::createLoader
where instance creation and reuse is now hidden in this method
and callers no longer need to care about that.

BUG= 240592 
R=dglazkov
TEST=import-onload.html,import-onerror.html

Review URL: https://chromiumcodereview.appspot.com/22573005
------------------------------------------------------------------------
Project Member Comment 40 by bugdroid1@chromium.org, Aug 12 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=155921

------------------------------------------------------------------------
r155921 | morrita@chromium.org | 2013-08-12T03:26:21.161996Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/EventTarget.cpp?r1=155921&r2=155920&pathrev=155921
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/EventTarget.h?r1=155921&r2=155920&pathrev=155921
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ScriptExecutionContext.h?r1=155921&r2=155920&pathrev=155921
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Document.h?r1=155921&r2=155920&pathrev=155921

Refactoring: Get rid of isDocument() check in EventTarget.

This is a preparation for dispatching onload events
for sub-imports.

In a coming change, newly added executingWindow() will
walk up the import tree to return the master doc's DOMWindow.

TEST=none
BUG= 240592 
R=abarth,dglazkov

Review URL: https://chromiumcodereview.appspot.com/22564003
------------------------------------------------------------------------
Weekly sync notes: Questions around behavior for events. Supposedly those are already defined in the HTML spec. Seems that the correct path is to implement those in HTML land. Also made some updates to the spec last week.
Weekly sync notes: load event logic is coming. There is a fix me in Dominic's test (registration context sharing) that needs support for frames.
Project Member Comment 43 by bugdroid1@chromium.org, Sep 11 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=157583

------------------------------------------------------------------------
r157583 | morrita@chromium.org | 2013-09-11T06:41:30.913948Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi?r1=157583&r2=157582&pathrev=157583
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html?r1=157583&r2=157582&pathrev=157583
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/dom/custom/registration-context-sharing.html?r1=157583&r2=157582&pathrev=157583

[HTML Imports] Employ load/error events to stabilize polling-based tests.

Now HTML Imports suppors load end error events, even inside the imported document.
Let's use it to make tests less flaky.

BUG= 240592 
R=dominicc,dglazkov

Review URL: https://chromiumcodereview.appspot.com/23903029
------------------------------------------------------------------------
Blockedon: chromium:323096
Random question: would it make any sense for us to enable HTML imports inside of Extensions and Apps before it's flipped on for the open web? It seems like CSP support would be a pre-requisite for that (i.e. "only import from the current origin, by default"), but perfect performance might not be.
Comment 47 by morrita@google.com, Jan 20 2014
We did App-only flag flip before for Shadow DOM, but found that it complicates the implementation in unexpected ways and should be avoided if possible. I think same can be said to HTML Imports.

That being said, I hope it won't take that long to turn HTML Import on at trunk as the spec is relatively small compared to Shadow DOM and Custom Elements.

If you are using Polymer and want to use it in a Chrome App now, vulcanizer [1] might help. It concatenates components into one file and eliminates the need  of HTML Imports.

Does this make sense?

[1] https://github.com/Polymer/vulcanize


Yep, thanks. Your first paragraph is convincing, and I share your hope in the second paragraph.
Comment 50 by morrita@google.com, Jan 23 2014
Eric, thanks for tracking the blocking bugs!
Labels: M-35
Blockedon: chromium:340318
Comment 53 by meh@chromium.org, Mar 14 2014
Labels: -M-35 M-36
Comment 54 by morrita@google.com, Mar 25 2014
Blockedon: chromium:356257
Blockedon: -chromium:323096
Project Member Comment 56 by bugdroid1@chromium.org, Apr 21 2014
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=172063

------------------------------------------------------------------
r172063 | morrita@chromium.org | 2014-04-21T19:33:51.484290Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/platform/RuntimeEnabledFeatures.in?r1=172063&r2=172062&pathrev=172063

Tentatively enable HTMLImports flag to ensure its ship-ability.

TEST=none
R=dglazkov,esprehn
BUG= 240592 

Review URL: https://codereview.chromium.org/245443002
-----------------------------------------------------------------
Comment 58 by clet...@gmail.com, Jul 17 2014
Can this be closed now that HTML Imports have landed in Chrome 36 Stable?
Comment 59 by morrita@google.com, Jul 17 2014
Status: Fixed
Good catch! Closing.
Sign in to add a comment