| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 , m_templateDocumentHost(0) | 466 , m_templateDocumentHost(0) |
| 467 , m_fonts(0) | 467 , m_fonts(0) |
| 468 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) | 468 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) |
| 469 { | 469 { |
| 470 setClient(this); | 470 setClient(this); |
| 471 ScriptWrappable::init(this); | 471 ScriptWrappable::init(this); |
| 472 | 472 |
| 473 if (m_frame) { | 473 if (m_frame) { |
| 474 provideContextFeaturesToDocumentFrom(this, m_frame->page()); | 474 provideContextFeaturesToDocumentFrom(this, m_frame->page()); |
| 475 | 475 |
| 476 m_fetcher = m_frame->loader()->activeDocumentLoader()->fetcher(); | 476 m_fetcher = m_frame->loader().activeDocumentLoader()->fetcher(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 if (!m_fetcher) | 479 if (!m_fetcher) |
| 480 m_fetcher = ResourceFetcher::create(0); | 480 m_fetcher = ResourceFetcher::create(0); |
| 481 m_fetcher->setDocument(this); | 481 m_fetcher->setDocument(this); |
| 482 | 482 |
| 483 // We depend on the url getting immediately set in subframes, but we | 483 // We depend on the url getting immediately set in subframes, but we |
| 484 // also depend on the url NOT getting immediately set in opened windows. | 484 // also depend on the url NOT getting immediately set in opened windows. |
| 485 // See fast/dom/early-frame-url.html | 485 // See fast/dom/early-frame-url.html |
| 486 // and fast/dom/location-new-window-no-crash.html, respectively. | 486 // and fast/dom/location-new-window-no-crash.html, respectively. |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 String oldTitle = m_title; | 1301 String oldTitle = m_title; |
| 1302 if (m_rawTitle.isEmpty()) | 1302 if (m_rawTitle.isEmpty()) |
| 1303 m_title = String(); | 1303 m_title = String(); |
| 1304 else if (m_rawTitle.is8Bit()) | 1304 else if (m_rawTitle.is8Bit()) |
| 1305 m_title = canonicalizedTitle<LChar>(this, m_rawTitle); | 1305 m_title = canonicalizedTitle<LChar>(this, m_rawTitle); |
| 1306 else | 1306 else |
| 1307 m_title = canonicalizedTitle<UChar>(this, m_rawTitle); | 1307 m_title = canonicalizedTitle<UChar>(this, m_rawTitle); |
| 1308 | 1308 |
| 1309 if (!m_frame || oldTitle == m_title) | 1309 if (!m_frame || oldTitle == m_title) |
| 1310 return; | 1310 return; |
| 1311 m_frame->loader()->client()->dispatchDidReceiveTitle(m_title); | 1311 m_frame->loader().client()->dispatchDidReceiveTitle(m_title); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 void Document::setTitle(const String& title) | 1314 void Document::setTitle(const String& title) |
| 1315 { | 1315 { |
| 1316 // Title set by JavaScript -- overrides any title elements. | 1316 // Title set by JavaScript -- overrides any title elements. |
| 1317 m_titleSetExplicitly = true; | 1317 m_titleSetExplicitly = true; |
| 1318 if (!isHTMLDocument() && !isXHTMLDocument()) | 1318 if (!isHTMLDocument() && !isXHTMLDocument()) |
| 1319 m_titleElement = 0; | 1319 m_titleElement = 0; |
| 1320 else if (!m_titleElement) { | 1320 else if (!m_titleElement) { |
| 1321 if (HTMLElement* headElement = head()) { | 1321 if (HTMLElement* headElement = head()) { |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 if (parser->isParsing()) { | 2166 if (parser->isParsing()) { |
| 2167 // FIXME: HTML5 doesn't tell us to check this, it might not be c
orrect. | 2167 // FIXME: HTML5 doesn't tell us to check this, it might not be c
orrect. |
| 2168 if (parser->isExecutingScript()) | 2168 if (parser->isExecutingScript()) |
| 2169 return; | 2169 return; |
| 2170 | 2170 |
| 2171 if (!parser->wasCreatedByScript() && parser->hasInsertionPoint()
) | 2171 if (!parser->wasCreatedByScript() && parser->hasInsertionPoint()
) |
| 2172 return; | 2172 return; |
| 2173 } | 2173 } |
| 2174 } | 2174 } |
| 2175 | 2175 |
| 2176 if (m_frame->loader()->state() == FrameStateProvisional) | 2176 if (m_frame->loader().state() == FrameStateProvisional) |
| 2177 m_frame->loader()->stopAllLoaders(); | 2177 m_frame->loader().stopAllLoaders(); |
| 2178 } | 2178 } |
| 2179 | 2179 |
| 2180 removeAllEventListeners(); | 2180 removeAllEventListeners(); |
| 2181 implicitOpen(); | 2181 implicitOpen(); |
| 2182 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) | 2182 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) |
| 2183 parser->setWasCreatedByScript(true); | 2183 parser->setWasCreatedByScript(true); |
| 2184 | 2184 |
| 2185 if (m_frame) | 2185 if (m_frame) |
| 2186 m_frame->loader()->didExplicitOpen(); | 2186 m_frame->loader().didExplicitOpen(); |
| 2187 if (m_loadEventProgress != LoadEventInProgress && m_loadEventProgress != Unl
oadEventInProgress) | 2187 if (m_loadEventProgress != LoadEventInProgress && m_loadEventProgress != Unl
oadEventInProgress) |
| 2188 m_loadEventProgress = LoadEventNotRun; | 2188 m_loadEventProgress = LoadEventNotRun; |
| 2189 } | 2189 } |
| 2190 | 2190 |
| 2191 void Document::detachParser() | 2191 void Document::detachParser() |
| 2192 { | 2192 { |
| 2193 if (!m_parser) | 2193 if (!m_parser) |
| 2194 return; | 2194 return; |
| 2195 m_parser->detach(); | 2195 m_parser->detach(); |
| 2196 m_parser.clear(); | 2196 m_parser.clear(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 parser->finish(); | 2298 parser->finish(); |
| 2299 | 2299 |
| 2300 if (!m_frame) { | 2300 if (!m_frame) { |
| 2301 // Because we have no frame, we don't know if all loading has completed, | 2301 // Because we have no frame, we don't know if all loading has completed, |
| 2302 // so we just call implicitClose() immediately. FIXME: This might fire | 2302 // so we just call implicitClose() immediately. FIXME: This might fire |
| 2303 // the load event prematurely <http://bugs.webkit.org/show_bug.cgi?id=14
568>. | 2303 // the load event prematurely <http://bugs.webkit.org/show_bug.cgi?id=14
568>. |
| 2304 implicitClose(); | 2304 implicitClose(); |
| 2305 return; | 2305 return; |
| 2306 } | 2306 } |
| 2307 | 2307 |
| 2308 m_frame->loader()->checkCompleted(); | 2308 m_frame->loader().checkCompleted(); |
| 2309 } | 2309 } |
| 2310 | 2310 |
| 2311 void Document::implicitClose() | 2311 void Document::implicitClose() |
| 2312 { | 2312 { |
| 2313 ASSERT(!inStyleRecalc()); | 2313 ASSERT(!inStyleRecalc()); |
| 2314 | 2314 |
| 2315 bool wasLocationChangePending = frame() && frame()->navigationScheduler().lo
cationChangePending(); | 2315 bool wasLocationChangePending = frame() && frame()->navigationScheduler().lo
cationChangePending(); |
| 2316 bool doload = !parsing() && m_parser && !processingLoadEvent() && !wasLocati
onChangePending; | 2316 bool doload = !parsing() && m_parser && !processingLoadEvent() && !wasLocati
onChangePending; |
| 2317 | 2317 |
| 2318 // If the load was blocked because of a pending location change and the loca
tion change triggers a same document | 2318 // If the load was blocked because of a pending location change and the loca
tion change triggers a same document |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2349 // here, instead of doing it from SVGElement::finishedParsingChildren (if ex
ternalResourcesRequired="false", | 2349 // here, instead of doing it from SVGElement::finishedParsingChildren (if ex
ternalResourcesRequired="false", |
| 2350 // which is the default, for ='true' its fired at a later time, once all ext
ernal resources finished loading). | 2350 // which is the default, for ='true' its fired at a later time, once all ext
ernal resources finished loading). |
| 2351 if (svgExtensions()) | 2351 if (svgExtensions()) |
| 2352 accessSVGExtensions()->dispatchSVGLoadEventToOutermostSVGElements(); | 2352 accessSVGExtensions()->dispatchSVGLoadEventToOutermostSVGElements(); |
| 2353 | 2353 |
| 2354 dispatchWindowLoadEvent(); | 2354 dispatchWindowLoadEvent(); |
| 2355 enqueuePageshowEvent(PageshowEventNotPersisted); | 2355 enqueuePageshowEvent(PageshowEventNotPersisted); |
| 2356 enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() :
SerializedScriptValue::nullValue()); | 2356 enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() :
SerializedScriptValue::nullValue()); |
| 2357 | 2357 |
| 2358 if (frame()) { | 2358 if (frame()) { |
| 2359 frame()->loader()->client()->dispatchDidHandleOnloadEvents(); | 2359 frame()->loader().client()->dispatchDidHandleOnloadEvents(); |
| 2360 loader()->applicationCacheHost()->stopDeferringEvents(); | 2360 loader()->applicationCacheHost()->stopDeferringEvents(); |
| 2361 } | 2361 } |
| 2362 | 2362 |
| 2363 // An event handler may have removed the frame | 2363 // An event handler may have removed the frame |
| 2364 if (!frame()) { | 2364 if (!frame()) { |
| 2365 m_loadEventProgress = LoadEventCompleted; | 2365 m_loadEventProgress = LoadEventCompleted; |
| 2366 return; | 2366 return; |
| 2367 } | 2367 } |
| 2368 | 2368 |
| 2369 // Make sure both the initial layout and reflow happen after the onload | 2369 // Make sure both the initial layout and reflow happen after the onload |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2459 toHTMLInputElement(currentFocusedElement)->endEditing(); | 2459 toHTMLInputElement(currentFocusedElement)->endEditing(); |
| 2460 if (m_loadEventProgress < PageHideInProgress) { | 2460 if (m_loadEventProgress < PageHideInProgress) { |
| 2461 m_loadEventProgress = PageHideInProgress; | 2461 m_loadEventProgress = PageHideInProgress; |
| 2462 dispatchWindowEvent(PageTransitionEvent::create(EventTypeNames::page
hide, false), this); | 2462 dispatchWindowEvent(PageTransitionEvent::create(EventTypeNames::page
hide, false), this); |
| 2463 if (!m_frame) | 2463 if (!m_frame) |
| 2464 return; | 2464 return; |
| 2465 | 2465 |
| 2466 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed | 2466 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed |
| 2467 // while dispatching the event, so protect it to prevent writing the
end | 2467 // while dispatching the event, so protect it to prevent writing the
end |
| 2468 // time into freed memory. | 2468 // time into freed memory. |
| 2469 RefPtr<DocumentLoader> documentLoader = m_frame->loader()->provisio
nalDocumentLoader(); | 2469 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); |
| 2470 m_loadEventProgress = UnloadEventInProgress; | 2470 m_loadEventProgress = UnloadEventInProgress; |
| 2471 RefPtr<Event> unloadEvent(Event::create(EventTypeNames::unload)); | 2471 RefPtr<Event> unloadEvent(Event::create(EventTypeNames::unload)); |
| 2472 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { | 2472 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { |
| 2473 DocumentLoadTiming* timing = documentLoader->timing(); | 2473 DocumentLoadTiming* timing = documentLoader->timing(); |
| 2474 ASSERT(timing->navigationStart()); | 2474 ASSERT(timing->navigationStart()); |
| 2475 timing->markUnloadEventStart(); | 2475 timing->markUnloadEventStart(); |
| 2476 dispatchWindowEvent(unloadEvent, this); | 2476 dispatchWindowEvent(unloadEvent, this); |
| 2477 timing->markUnloadEventEnd(); | 2477 timing->markUnloadEventEnd(); |
| 2478 } else { | 2478 } else { |
| 2479 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); | 2479 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); |
| 2480 } | 2480 } |
| 2481 } | 2481 } |
| 2482 updateStyleIfNeeded(); | 2482 updateStyleIfNeeded(); |
| 2483 m_loadEventProgress = UnloadEventHandled; | 2483 m_loadEventProgress = UnloadEventHandled; |
| 2484 } | 2484 } |
| 2485 | 2485 |
| 2486 if (!m_frame) | 2486 if (!m_frame) |
| 2487 return; | 2487 return; |
| 2488 | 2488 |
| 2489 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). | 2489 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). |
| 2490 bool keepEventListeners = m_frame->loader()->stateMachine()->isDisplayingIni
tialEmptyDocument() && m_frame->loader()->provisionalDocumentLoader() | 2490 bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInit
ialEmptyDocument() && m_frame->loader().provisionalDocumentLoader() |
| 2491 && isSecureTransitionTo(m_frame->loader()->provisionalDocumentLoader()->
url()); | 2491 && isSecureTransitionTo(m_frame->loader().provisionalDocumentLoader()->u
rl()); |
| 2492 if (!keepEventListeners) | 2492 if (!keepEventListeners) |
| 2493 removeAllEventListeners(); | 2493 removeAllEventListeners(); |
| 2494 } | 2494 } |
| 2495 | 2495 |
| 2496 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const | 2496 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const |
| 2497 { | 2497 { |
| 2498 if (m_loadEventProgress == BeforeUnloadEventInProgress) | 2498 if (m_loadEventProgress == BeforeUnloadEventInProgress) |
| 2499 return BeforeUnloadDismissal; | 2499 return BeforeUnloadDismissal; |
| 2500 if (m_loadEventProgress == PageHideInProgress) | 2500 if (m_loadEventProgress == PageHideInProgress) |
| 2501 return PageHideDismissal; | 2501 return PageHideDismissal; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 if (m_baseElementURL != baseElementURL && contentSecurityPolicy()->allowBase
URI(baseElementURL)) { | 2700 if (m_baseElementURL != baseElementURL && contentSecurityPolicy()->allowBase
URI(baseElementURL)) { |
| 2701 m_baseElementURL = baseElementURL; | 2701 m_baseElementURL = baseElementURL; |
| 2702 updateBaseURL(); | 2702 updateBaseURL(); |
| 2703 } | 2703 } |
| 2704 | 2704 |
| 2705 m_baseTarget = target ? *target : nullAtom; | 2705 m_baseTarget = target ? *target : nullAtom; |
| 2706 } | 2706 } |
| 2707 | 2707 |
| 2708 String Document::userAgent(const KURL& url) const | 2708 String Document::userAgent(const KURL& url) const |
| 2709 { | 2709 { |
| 2710 return frame() ? frame()->loader()->userAgent(url) : String(); | 2710 return frame() ? frame()->loader().userAgent(url) : String(); |
| 2711 } | 2711 } |
| 2712 | 2712 |
| 2713 void Document::disableEval(const String& errorMessage) | 2713 void Document::disableEval(const String& errorMessage) |
| 2714 { | 2714 { |
| 2715 if (!frame()) | 2715 if (!frame()) |
| 2716 return; | 2716 return; |
| 2717 | 2717 |
| 2718 frame()->script().disableEval(errorMessage); | 2718 frame()->script().disableEval(errorMessage); |
| 2719 } | 2719 } |
| 2720 | 2720 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 // are still some restrictions on navigation to avoid nuisance attacks. | 2760 // are still some restrictions on navigation to avoid nuisance attacks. |
| 2761 // Specifically, a document can navigate a top-level frame if that frame | 2761 // Specifically, a document can navigate a top-level frame if that frame |
| 2762 // opened the document or if the document is the same-origin with any of | 2762 // opened the document or if the document is the same-origin with any of |
| 2763 // the top-level frame's opener's ancestors (in the frame hierarchy). | 2763 // the top-level frame's opener's ancestors (in the frame hierarchy). |
| 2764 // | 2764 // |
| 2765 // In both of these cases, the document performing the navigation is in | 2765 // In both of these cases, the document performing the navigation is in |
| 2766 // some way related to the frame being navigate (e.g., by the "opener" | 2766 // some way related to the frame being navigate (e.g., by the "opener" |
| 2767 // and/or "parent" relation). Requiring some sort of relation prevents a | 2767 // and/or "parent" relation). Requiring some sort of relation prevents a |
| 2768 // document from navigating arbitrary, unrelated top-level frames. | 2768 // document from navigating arbitrary, unrelated top-level frames. |
| 2769 if (!targetFrame->tree().parent()) { | 2769 if (!targetFrame->tree().parent()) { |
| 2770 if (targetFrame == m_frame->loader()->opener()) | 2770 if (targetFrame == m_frame->loader().opener()) |
| 2771 return true; | 2771 return true; |
| 2772 | 2772 |
| 2773 if (canAccessAncestor(securityOrigin(), targetFrame->loader()->opener())
) | 2773 if (canAccessAncestor(securityOrigin(), targetFrame->loader().opener())) |
| 2774 return true; | 2774 return true; |
| 2775 } | 2775 } |
| 2776 | 2776 |
| 2777 printNavigationErrorMessage(targetFrame, url(), "The frame attempting naviga
tion is neither same-origin with the target, nor is it the target's parent or op
ener."); | 2777 printNavigationErrorMessage(targetFrame, url(), "The frame attempting naviga
tion is neither same-origin with the target, nor is it the target's parent or op
ener."); |
| 2778 return false; | 2778 return false; |
| 2779 } | 2779 } |
| 2780 | 2780 |
| 2781 Frame* Document::findUnsafeParentScrollPropagationBoundary() | 2781 Frame* Document::findUnsafeParentScrollPropagationBoundary() |
| 2782 { | 2782 { |
| 2783 Frame* currentFrame = m_frame; | 2783 Frame* currentFrame = m_frame; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2919 // Exception (for sandboxed documents) ignored. | 2919 // Exception (for sandboxed documents) ignored. |
| 2920 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION); | 2920 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION); |
| 2921 } | 2921 } |
| 2922 | 2922 |
| 2923 void Document::processHttpEquivXFrameOptions(const String& content) | 2923 void Document::processHttpEquivXFrameOptions(const String& content) |
| 2924 { | 2924 { |
| 2925 Frame* frame = this->frame(); | 2925 Frame* frame = this->frame(); |
| 2926 if (!frame) | 2926 if (!frame) |
| 2927 return; | 2927 return; |
| 2928 | 2928 |
| 2929 FrameLoader* frameLoader = frame->loader(); | 2929 FrameLoader& frameLoader = frame->loader(); |
| 2930 unsigned long requestIdentifier = loader()->mainResourceIdentifier(); | 2930 unsigned long requestIdentifier = loader()->mainResourceIdentifier(); |
| 2931 if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url(), request
Identifier)) { | 2931 if (frameLoader.shouldInterruptLoadForXFrameOptions(content, url(), requestI
dentifier)) { |
| 2932 String message = "Refused to display '" + url().elidedString() + "' in a
frame because it set 'X-Frame-Options' to '" + content + "'."; | 2932 String message = "Refused to display '" + url().elidedString() + "' in a
frame because it set 'X-Frame-Options' to '" + content + "'."; |
| 2933 frameLoader->stopAllLoaders(); | 2933 frameLoader.stopAllLoaders(); |
| 2934 // Stopping the loader isn't enough, as we're already parsing the docume
nt; to honor the header's | 2934 // Stopping the loader isn't enough, as we're already parsing the docume
nt; to honor the header's |
| 2935 // intent, we must navigate away from the possibly partially-rendered do
cument to a location that | 2935 // intent, we must navigate away from the possibly partially-rendered do
cument to a location that |
| 2936 // doesn't inherit the parent's SecurityOrigin. | 2936 // doesn't inherit the parent's SecurityOrigin. |
| 2937 frame->navigationScheduler().scheduleLocationChange(securityOrigin(), Se
curityOrigin::urlWithUniqueSecurityOrigin(), String()); | 2937 frame->navigationScheduler().scheduleLocationChange(securityOrigin(), Se
curityOrigin::urlWithUniqueSecurityOrigin(), String()); |
| 2938 addConsoleMessageWithRequestIdentifier(SecurityMessageSource, ErrorMessa
geLevel, message, requestIdentifier); | 2938 addConsoleMessageWithRequestIdentifier(SecurityMessageSource, ErrorMessa
geLevel, message, requestIdentifier); |
| 2939 } | 2939 } |
| 2940 } | 2940 } |
| 2941 | 2941 |
| 2942 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin
) | 2942 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin
) |
| 2943 { | 2943 { |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4117 KURL Document::openSearchDescriptionURL() | 4117 KURL Document::openSearchDescriptionURL() |
| 4118 { | 4118 { |
| 4119 static const char* const openSearchMIMEType = "application/opensearchdescrip
tion+xml"; | 4119 static const char* const openSearchMIMEType = "application/opensearchdescrip
tion+xml"; |
| 4120 static const char* const openSearchRelation = "search"; | 4120 static const char* const openSearchRelation = "search"; |
| 4121 | 4121 |
| 4122 // FIXME: Why do only top-level frames have openSearchDescriptionURLs? | 4122 // FIXME: Why do only top-level frames have openSearchDescriptionURLs? |
| 4123 if (!frame() || frame()->tree().parent()) | 4123 if (!frame() || frame()->tree().parent()) |
| 4124 return KURL(); | 4124 return KURL(); |
| 4125 | 4125 |
| 4126 // FIXME: Why do we need to wait for FrameStateComplete? | 4126 // FIXME: Why do we need to wait for FrameStateComplete? |
| 4127 if (frame()->loader()->state() != FrameStateComplete) | 4127 if (frame()->loader().state() != FrameStateComplete) |
| 4128 return KURL(); | 4128 return KURL(); |
| 4129 | 4129 |
| 4130 if (!head()) | 4130 if (!head()) |
| 4131 return KURL(); | 4131 return KURL(); |
| 4132 | 4132 |
| 4133 RefPtr<HTMLCollection> children = head()->children(); | 4133 RefPtr<HTMLCollection> children = head()->children(); |
| 4134 for (unsigned i = 0; Node* child = children->item(i); i++) { | 4134 for (unsigned i = 0; Node* child = children->item(i); i++) { |
| 4135 if (!child->hasTagName(linkTag)) | 4135 if (!child->hasTagName(linkTag)) |
| 4136 continue; | 4136 continue; |
| 4137 HTMLLinkElement* linkElement = toHTMLLinkElement(child); | 4137 HTMLLinkElement* linkElement = toHTMLLinkElement(child); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4353 if (RefPtr<Frame> f = frame()) { | 4353 if (RefPtr<Frame> f = frame()) { |
| 4354 // FrameLoader::finishedParsing() might end up calling Document::implici
tClose() if all | 4354 // FrameLoader::finishedParsing() might end up calling Document::implici
tClose() if all |
| 4355 // resource loads are complete. HTMLObjectElements can start loading the
ir resources from | 4355 // resource loads are complete. HTMLObjectElements can start loading the
ir resources from |
| 4356 // post attach callbacks triggered by recalcStyle(). This means if we p
arse out an <object> | 4356 // post attach callbacks triggered by recalcStyle(). This means if we p
arse out an <object> |
| 4357 // tag and then reach the end of the document without updating styles, w
e might not have yet | 4357 // tag and then reach the end of the document without updating styles, w
e might not have yet |
| 4358 // started the resource load and might fire the window load event too ea
rly. To avoid this | 4358 // started the resource load and might fire the window load event too ea
rly. To avoid this |
| 4359 // we force the styles to be up to date before calling FrameLoader::fini
shedParsing(). | 4359 // we force the styles to be up to date before calling FrameLoader::fini
shedParsing(). |
| 4360 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com
ment 35. | 4360 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com
ment 35. |
| 4361 updateStyleIfNeeded(); | 4361 updateStyleIfNeeded(); |
| 4362 | 4362 |
| 4363 f->loader()->finishedParsing(); | 4363 f->loader().finishedParsing(); |
| 4364 | 4364 |
| 4365 InspectorInstrumentation::domContentLoadedEventFired(f.get()); | 4365 InspectorInstrumentation::domContentLoadedEventFired(f.get()); |
| 4366 } | 4366 } |
| 4367 | 4367 |
| 4368 // Schedule dropping of the DocumentSharedObjectPool. We keep it alive for a
while after parsing finishes | 4368 // Schedule dropping of the DocumentSharedObjectPool. We keep it alive for a
while after parsing finishes |
| 4369 // so that dynamically inserted content can also benefit from sharing optimi
zations. | 4369 // so that dynamically inserted content can also benefit from sharing optimi
zations. |
| 4370 // Note that we don't refresh the timer on pool access since that could lead
to huge caches being kept | 4370 // Note that we don't refresh the timer on pool access since that could lead
to huge caches being kept |
| 4371 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. | 4371 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. |
| 4372 static const int timeToKeepSharedObjectPoolAliveAfterParsingFinishedInSecond
s = 10; | 4372 static const int timeToKeepSharedObjectPoolAliveAfterParsingFinishedInSecond
s = 10; |
| 4373 m_sharedObjectPoolClearTimer.startOneShot(timeToKeepSharedObjectPoolAliveAft
erParsingFinishedInSeconds); | 4373 m_sharedObjectPoolClearTimer.startOneShot(timeToKeepSharedObjectPoolAliveAft
erParsingFinishedInSeconds); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4886 ASSERT(m_loadEventDelayCount); | 4886 ASSERT(m_loadEventDelayCount); |
| 4887 --m_loadEventDelayCount; | 4887 --m_loadEventDelayCount; |
| 4888 | 4888 |
| 4889 if (frame() && !m_loadEventDelayCount && !m_loadEventDelayTimer.isActive()) | 4889 if (frame() && !m_loadEventDelayCount && !m_loadEventDelayTimer.isActive()) |
| 4890 m_loadEventDelayTimer.startOneShot(0); | 4890 m_loadEventDelayTimer.startOneShot(0); |
| 4891 } | 4891 } |
| 4892 | 4892 |
| 4893 void Document::loadEventDelayTimerFired(Timer<Document>*) | 4893 void Document::loadEventDelayTimerFired(Timer<Document>*) |
| 4894 { | 4894 { |
| 4895 if (frame()) | 4895 if (frame()) |
| 4896 frame()->loader()->checkCompleted(); | 4896 frame()->loader().checkCompleted(); |
| 4897 } | 4897 } |
| 4898 | 4898 |
| 4899 ScriptedAnimationController& Document::ensureScriptedAnimationController() | 4899 ScriptedAnimationController& Document::ensureScriptedAnimationController() |
| 4900 { | 4900 { |
| 4901 if (!m_scriptedAnimationController) { | 4901 if (!m_scriptedAnimationController) { |
| 4902 m_scriptedAnimationController = ScriptedAnimationController::create(this
); | 4902 m_scriptedAnimationController = ScriptedAnimationController::create(this
); |
| 4903 // We need to make sure that we don't start up the animation controller
on a background tab, for example. | 4903 // We need to make sure that we don't start up the animation controller
on a background tab, for example. |
| 4904 if (!page()) | 4904 if (!page()) |
| 4905 m_scriptedAnimationController->suspend(); | 4905 m_scriptedAnimationController->suspend(); |
| 4906 } | 4906 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5016 if (!ownerElement) | 5016 if (!ownerElement) |
| 5017 return false; | 5017 return false; |
| 5018 return m_mayDisplaySeamlesslyWithParent && ownerElement->hasTagName(iframeTa
g) && ownerElement->fastHasAttribute(seamlessAttr); | 5018 return m_mayDisplaySeamlesslyWithParent && ownerElement->hasTagName(iframeTa
g) && ownerElement->fastHasAttribute(seamlessAttr); |
| 5019 } | 5019 } |
| 5020 | 5020 |
| 5021 DocumentLoader* Document::loader() const | 5021 DocumentLoader* Document::loader() const |
| 5022 { | 5022 { |
| 5023 if (!m_frame) | 5023 if (!m_frame) |
| 5024 return 0; | 5024 return 0; |
| 5025 | 5025 |
| 5026 DocumentLoader* loader = m_frame->loader()->documentLoader(); | 5026 DocumentLoader* loader = m_frame->loader().documentLoader(); |
| 5027 if (!loader) | 5027 if (!loader) |
| 5028 return 0; | 5028 return 0; |
| 5029 | 5029 |
| 5030 if (m_frame->document() != this) | 5030 if (m_frame->document() != this) |
| 5031 return 0; | 5031 return 0; |
| 5032 | 5032 |
| 5033 return loader; | 5033 return loader; |
| 5034 } | 5034 } |
| 5035 | 5035 |
| 5036 IntSize Document::initialViewportSize() const | 5036 IntSize Document::initialViewportSize() const |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5085 | 5085 |
| 5086 void Document::decrementActiveParserCount() | 5086 void Document::decrementActiveParserCount() |
| 5087 { | 5087 { |
| 5088 --m_activeParserCount; | 5088 --m_activeParserCount; |
| 5089 if (!frame()) | 5089 if (!frame()) |
| 5090 return; | 5090 return; |
| 5091 // FIXME: This should always be enabled, but it seems to cause | 5091 // FIXME: This should always be enabled, but it seems to cause |
| 5092 // http/tests/security/feed-urls-from-remote.html to timeout on Mac WK1 | 5092 // http/tests/security/feed-urls-from-remote.html to timeout on Mac WK1 |
| 5093 // see http://webkit.org/b/110554 and http://webkit.org/b/110401 | 5093 // see http://webkit.org/b/110554 and http://webkit.org/b/110401 |
| 5094 loader()->checkLoadComplete(); | 5094 loader()->checkLoadComplete(); |
| 5095 frame()->loader()->checkLoadComplete(); | 5095 frame()->loader().checkLoadComplete(); |
| 5096 } | 5096 } |
| 5097 | 5097 |
| 5098 void Document::setContextFeatures(PassRefPtr<ContextFeatures> features) | 5098 void Document::setContextFeatures(PassRefPtr<ContextFeatures> features) |
| 5099 { | 5099 { |
| 5100 m_contextFeatures = features; | 5100 m_contextFeatures = features; |
| 5101 } | 5101 } |
| 5102 | 5102 |
| 5103 static RenderObject* nearestCommonHoverAncestor(RenderObject* obj1, RenderObject
* obj2) | 5103 static RenderObject* nearestCommonHoverAncestor(RenderObject* obj1, RenderObject
* obj2) |
| 5104 { | 5104 { |
| 5105 if (!obj1 || !obj2) | 5105 if (!obj1 || !obj2) |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5350 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style
ResolverUpdateMode updateMode) | 5350 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style
ResolverUpdateMode updateMode) |
| 5351 { | 5351 { |
| 5352 if (!isActive()) | 5352 if (!isActive()) |
| 5353 return; | 5353 return; |
| 5354 | 5354 |
| 5355 styleEngine()->modifiedStyleSheet(sheet); | 5355 styleEngine()->modifiedStyleSheet(sheet); |
| 5356 styleResolverChanged(when, updateMode); | 5356 styleResolverChanged(when, updateMode); |
| 5357 } | 5357 } |
| 5358 | 5358 |
| 5359 } // namespace WebCore | 5359 } // namespace WebCore |
| OLD | NEW |