| Index: Source/core/html/LinkImport.cpp
|
| diff --git a/Source/core/html/LinkImport.cpp b/Source/core/html/LinkImport.cpp
|
| index 753751ee5dbdd0ba02b56b7268cb8e94dcd616e5..31703ac85ef4d7c946b742ef183752ac05a5dd72 100644
|
| --- a/Source/core/html/LinkImport.cpp
|
| +++ b/Source/core/html/LinkImport.cpp
|
| @@ -36,7 +36,6 @@
|
| #include "core/html/HTMLImportsController.h"
|
| #include "core/html/HTMLLinkElement.h"
|
| #include "core/loader/CrossOriginAccessControl.h"
|
| -#include "core/loader/cache/ResourceFetcher.h"
|
|
|
| namespace WebCore {
|
|
|
| @@ -52,6 +51,7 @@ LinkImport::LinkImport(HTMLLinkElement* owner)
|
|
|
| LinkImport::~LinkImport()
|
| {
|
| + clear();
|
| }
|
|
|
| Document* LinkImport::importedDocument() const
|
| @@ -67,39 +67,56 @@ void LinkImport::process()
|
| return;
|
| if (!m_owner)
|
| return;
|
| -
|
| if (!m_owner->document()->frame() && !m_owner->document()->import())
|
| return;
|
|
|
| - LinkRequestBuilder builder(m_owner);
|
| - if (!builder.isValid())
|
| - return;
|
| -
|
| if (!m_owner->document()->import()) {
|
| ASSERT(m_owner->document()->frame()); // The document should be the master.
|
| HTMLImportsController::provideTo(m_owner->document());
|
| }
|
|
|
| + LinkRequestBuilder builder(m_owner);
|
| + if (!builder.isValid()) {
|
| + didFinish();
|
| + return;
|
| + }
|
| +
|
| HTMLImport* parent = m_owner->document()->import();
|
| HTMLImportsController* controller = parent->controller();
|
| - if (RefPtr<HTMLImportLoader> found = controller->findLinkFor(builder.url())) {
|
| - m_loader = found;
|
| + m_loader = controller->createLoader(parent, builder.build(true));
|
| + if (!m_loader) {
|
| + didFinish();
|
| return;
|
| }
|
|
|
| - FetchRequest request = builder.build(true);
|
| - request.setPotentiallyCrossOriginEnabled(controller->securityOrigin(), DoNotAllowStoredCredentials);
|
| - ResourcePtr<CachedRawResource> resource = m_owner->document()->fetcher()->requestImport(request);
|
| - if (!resource)
|
| - return;
|
| + m_loader->addClient(this);
|
| +}
|
|
|
| - m_loader = controller->createLoader(parent, builder.url(), resource);
|
| +void LinkImport::clear()
|
| +{
|
| + m_owner = 0;
|
| +
|
| + if (m_loader) {
|
| + m_loader->removeClient(this);
|
| + m_loader.clear();
|
| + }
|
| }
|
|
|
| void LinkImport::ownerRemoved()
|
| {
|
| - m_owner = 0;
|
| - m_loader.clear();
|
| + clear();
|
| +}
|
| +
|
| +void LinkImport::didFinish()
|
| +{
|
| + if (!m_owner)
|
| + return;
|
| + m_owner->scheduleEvent();
|
| +}
|
| +
|
| +bool LinkImport::hasLoaded() const
|
| +{
|
| + return m_loader && m_loader->isLoaded();
|
| }
|
|
|
| } // namespace WebCore
|
|
|