HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request) { ASSERT(!request.url().isEmpty() && request.url().isValid()); ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent))); if (HTMLImportChild* childToShareWith = root()->find(request.url())) { HTMLImportLoader* loader = childToShareWith->loader(); ASSERT(loader); HTMLImportChild* child = createChild(request.url(), loader, parent, client); child->didShareLoader(); return child; } bool sameOriginRequest = master()->securityOrigin()->canRequest(request.url()); request.setCrossOriginAccessControl( master()->securityOrigin(), sameOriginRequest ? AllowStoredCredentials : DoNotAllowStoredCredentials, ClientDidNotRequestCredentials); ResourcePtr<RawResource> resource = parent->document()->fetcher()->fetchImport(request); if (!resource) return 0; HTMLImportLoader* loader = createLoader(); HTMLImportChild* child = createChild(request.url(), loader, parent, client); // We set resource after the import tree is built since // Resource::addClient() immediately calls back to feed the bytes when the resource is cached. loader->startLoading(resource); child->didStartLoading(); return child; }
void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtr<CustomElementRegistrationContext> context, PassRefPtr<Element> element, const CustomElementDescriptor& descriptor) { if (CustomElementCallbackDispatcher::inCallbackDeliveryScope()) { context->resolve(element.get(), descriptor); return; } HTMLImportLoader* loader = element->document().importLoader(); OwnPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskResolutionStep::create(context, element, descriptor); CustomElementMicrotaskDispatcher::instance().enqueue(loader ? loader->firstImport() : 0, step.release()); }
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request) { ASSERT(!request.url().isEmpty() && request.url().isValid()); ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent))); if (HTMLImportChild* childToShareWith = root()->find(request.url())) { HTMLImportLoader* loader = childToShareWith->loader(); ASSERT(loader); HTMLImportChild* child = createChild(request.url(), loader, parent, client); child->didShareLoader(); return child; } HTMLImportLoader* loader = createLoader(); HTMLImportChild* child = createChild(request.url(), loader, parent, client); // We set resource after the import tree is built since // Resource::addClient() immediately calls back to feed the bytes when the resource is cached. loader->startLoading(request.url()); child->didStartLoading(); return child; }