| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 // If the layoutObject is gone then we are in the process of destruction. | 2569 // If the layoutObject is gone then we are in the process of destruction. |
| 2570 // This method will be called before m_frame = nullptr. | 2570 // This method will be called before m_frame = nullptr. |
| 2571 if (!axObjectCacheOwner().layoutView()) | 2571 if (!axObjectCacheOwner().layoutView()) |
| 2572 return 0; | 2572 return 0; |
| 2573 | 2573 |
| 2574 return axObjectCacheOwner().m_axObjectCache.get(); | 2574 return axObjectCacheOwner().m_axObjectCache.get(); |
| 2575 } | 2575 } |
| 2576 | 2576 |
| 2577 AXObjectCache* Document::axObjectCache() const { | 2577 AXObjectCache* Document::axObjectCache() const { |
| 2578 Settings* settings = this->settings(); | 2578 Settings* settings = this->settings(); |
| 2579 if (!settings || !settings->accessibilityEnabled()) | 2579 if (!settings || !settings->GetAccessibilityEnabled()) |
| 2580 return 0; | 2580 return 0; |
| 2581 | 2581 |
| 2582 // The only document that actually has a AXObjectCache is the top-level | 2582 // The only document that actually has a AXObjectCache is the top-level |
| 2583 // document. This is because we need to be able to get from any | 2583 // document. This is because we need to be able to get from any |
| 2584 // WebCoreAXObject to any other WebCoreAXObject on the same page. Using a | 2584 // WebCoreAXObject to any other WebCoreAXObject on the same page. Using a |
| 2585 // single cache allows lookups across nested webareas (i.e. multiple | 2585 // single cache allows lookups across nested webareas (i.e. multiple |
| 2586 // documents). | 2586 // documents). |
| 2587 Document& cacheOwner = this->axObjectCacheOwner(); | 2587 Document& cacheOwner = this->axObjectCacheOwner(); |
| 2588 | 2588 |
| 2589 // If the document has already been detached, do not make a new axObjectCache. | 2589 // If the document has already been detached, do not make a new axObjectCache. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2944 | 2944 |
| 2945 // Always do a layout after loading if needed. | 2945 // Always do a layout after loading if needed. |
| 2946 if (view() && !layoutViewItem().isNull() && | 2946 if (view() && !layoutViewItem().isNull() && |
| 2947 (!layoutViewItem().firstChild() || layoutViewItem().needsLayout())) | 2947 (!layoutViewItem().firstChild() || layoutViewItem().needsLayout())) |
| 2948 view()->layout(); | 2948 view()->layout(); |
| 2949 } | 2949 } |
| 2950 | 2950 |
| 2951 m_loadEventProgress = LoadEventCompleted; | 2951 m_loadEventProgress = LoadEventCompleted; |
| 2952 | 2952 |
| 2953 if (frame() && !layoutViewItem().isNull() && | 2953 if (frame() && !layoutViewItem().isNull() && |
| 2954 settings()->accessibilityEnabled()) { | 2954 settings()->GetAccessibilityEnabled()) { |
| 2955 if (AXObjectCache* cache = axObjectCache()) { | 2955 if (AXObjectCache* cache = axObjectCache()) { |
| 2956 if (this == &axObjectCacheOwner()) | 2956 if (this == &axObjectCacheOwner()) |
| 2957 cache->handleLoadComplete(this); | 2957 cache->handleLoadComplete(this); |
| 2958 else | 2958 else |
| 2959 cache->handleLayoutComplete(this); | 2959 cache->handleLayoutComplete(this); |
| 2960 } | 2960 } |
| 2961 } | 2961 } |
| 2962 | 2962 |
| 2963 if (svgExtensions()) | 2963 if (svgExtensions()) |
| 2964 accessSVGExtensions().startAnimations(); | 2964 accessSVGExtensions().startAnimations(); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3431 "the 'allow-scripts' keyword is not set."; | 3431 "the 'allow-scripts' keyword is not set."; |
| 3432 addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, | 3432 addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, |
| 3433 ErrorMessageLevel, message)); | 3433 ErrorMessageLevel, message)); |
| 3434 return; | 3434 return; |
| 3435 } | 3435 } |
| 3436 m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL); | 3436 m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL); |
| 3437 } | 3437 } |
| 3438 | 3438 |
| 3439 bool Document::shouldMergeWithLegacyDescription( | 3439 bool Document::shouldMergeWithLegacyDescription( |
| 3440 ViewportDescription::Type origin) const { | 3440 ViewportDescription::Type origin) const { |
| 3441 return settings() && settings()->viewportMetaMergeContentQuirk() && | 3441 return settings() && settings()->GetViewportMetaMergeContentQuirk() && |
| 3442 m_legacyViewportDescription.isMetaViewportType() && | 3442 m_legacyViewportDescription.isMetaViewportType() && |
| 3443 m_legacyViewportDescription.type == origin; | 3443 m_legacyViewportDescription.type == origin; |
| 3444 } | 3444 } |
| 3445 | 3445 |
| 3446 void Document::setViewportDescription( | 3446 void Document::setViewportDescription( |
| 3447 const ViewportDescription& viewportDescription) { | 3447 const ViewportDescription& viewportDescription) { |
| 3448 if (viewportDescription.isLegacyViewportType()) { | 3448 if (viewportDescription.isLegacyViewportType()) { |
| 3449 if (viewportDescription == m_legacyViewportDescription) | 3449 if (viewportDescription == m_legacyViewportDescription) |
| 3450 return; | 3450 return; |
| 3451 m_legacyViewportDescription = viewportDescription; | 3451 m_legacyViewportDescription = viewportDescription; |
| 3452 } else { | 3452 } else { |
| 3453 if (viewportDescription == m_viewportDescription) | 3453 if (viewportDescription == m_viewportDescription) |
| 3454 return; | 3454 return; |
| 3455 m_viewportDescription = viewportDescription; | 3455 m_viewportDescription = viewportDescription; |
| 3456 | 3456 |
| 3457 // The UA-defined min-width is considered specifically by Android WebView | 3457 // The UA-defined min-width is considered specifically by Android WebView |
| 3458 // quirks mode. | 3458 // quirks mode. |
| 3459 if (!viewportDescription.isSpecifiedByAuthor()) | 3459 if (!viewportDescription.isSpecifiedByAuthor()) |
| 3460 m_viewportDefaultMinWidth = viewportDescription.minWidth; | 3460 m_viewportDefaultMinWidth = viewportDescription.minWidth; |
| 3461 } | 3461 } |
| 3462 | 3462 |
| 3463 updateViewportDescription(); | 3463 updateViewportDescription(); |
| 3464 } | 3464 } |
| 3465 | 3465 |
| 3466 ViewportDescription Document::viewportDescription() const { | 3466 ViewportDescription Document::viewportDescription() const { |
| 3467 ViewportDescription appliedViewportDescription = m_viewportDescription; | 3467 ViewportDescription appliedViewportDescription = m_viewportDescription; |
| 3468 bool viewportMetaEnabled = settings() && settings()->viewportMetaEnabled(); | 3468 bool viewportMetaEnabled = settings() && settings()->GetViewportMetaEnabled(); |
| 3469 if (m_legacyViewportDescription.type != | 3469 if (m_legacyViewportDescription.type != |
| 3470 ViewportDescription::UserAgentStyleSheet && | 3470 ViewportDescription::UserAgentStyleSheet && |
| 3471 viewportMetaEnabled) | 3471 viewportMetaEnabled) |
| 3472 appliedViewportDescription = m_legacyViewportDescription; | 3472 appliedViewportDescription = m_legacyViewportDescription; |
| 3473 if (shouldOverrideLegacyDescription(m_viewportDescription.type)) | 3473 if (shouldOverrideLegacyDescription(m_viewportDescription.type)) |
| 3474 appliedViewportDescription = m_viewportDescription; | 3474 appliedViewportDescription = m_viewportDescription; |
| 3475 | 3475 |
| 3476 return appliedViewportDescription; | 3476 return appliedViewportDescription; |
| 3477 } | 3477 } |
| 3478 | 3478 |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4488 bool Document::isInInvisibleSubframe() const { | 4488 bool Document::isInInvisibleSubframe() const { |
| 4489 if (!localOwner()) | 4489 if (!localOwner()) |
| 4490 return false; // this is a local root element | 4490 return false; // this is a local root element |
| 4491 | 4491 |
| 4492 // TODO(bokan): This looks like it doesn't work in OOPIF. | 4492 // TODO(bokan): This looks like it doesn't work in OOPIF. |
| 4493 DCHECK(frame()); | 4493 DCHECK(frame()); |
| 4494 return frame()->ownerLayoutItem().isNull(); | 4494 return frame()->ownerLayoutItem().isNull(); |
| 4495 } | 4495 } |
| 4496 | 4496 |
| 4497 String Document::cookie(ExceptionState& exceptionState) const { | 4497 String Document::cookie(ExceptionState& exceptionState) const { |
| 4498 if (settings() && !settings()->cookieEnabled()) | 4498 if (settings() && !settings()->GetCookieEnabled()) |
| 4499 return String(); | 4499 return String(); |
| 4500 | 4500 |
| 4501 // FIXME: The HTML5 DOM spec states that this attribute can raise an | 4501 // FIXME: The HTML5 DOM spec states that this attribute can raise an |
| 4502 // InvalidStateError exception on getting if the Document has no | 4502 // InvalidStateError exception on getting if the Document has no |
| 4503 // browsing context. | 4503 // browsing context. |
| 4504 | 4504 |
| 4505 if (!getSecurityOrigin()->canAccessCookies()) { | 4505 if (!getSecurityOrigin()->canAccessCookies()) { |
| 4506 if (isSandboxed(SandboxOrigin)) | 4506 if (isSandboxed(SandboxOrigin)) |
| 4507 exceptionState.throwSecurityError( | 4507 exceptionState.throwSecurityError( |
| 4508 "The document is sandboxed and lacks the 'allow-same-origin' flag."); | 4508 "The document is sandboxed and lacks the 'allow-same-origin' flag."); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4522 return String(); | 4522 return String(); |
| 4523 | 4523 |
| 4524 KURL cookieURL = this->cookieURL(); | 4524 KURL cookieURL = this->cookieURL(); |
| 4525 if (cookieURL.isEmpty()) | 4525 if (cookieURL.isEmpty()) |
| 4526 return String(); | 4526 return String(); |
| 4527 | 4527 |
| 4528 return cookies(this, cookieURL); | 4528 return cookies(this, cookieURL); |
| 4529 } | 4529 } |
| 4530 | 4530 |
| 4531 void Document::setCookie(const String& value, ExceptionState& exceptionState) { | 4531 void Document::setCookie(const String& value, ExceptionState& exceptionState) { |
| 4532 if (settings() && !settings()->cookieEnabled()) | 4532 if (settings() && !settings()->GetCookieEnabled()) |
| 4533 return; | 4533 return; |
| 4534 | 4534 |
| 4535 // FIXME: The HTML5 DOM spec states that this attribute can raise an | 4535 // FIXME: The HTML5 DOM spec states that this attribute can raise an |
| 4536 // InvalidStateError exception on setting if the Document has no | 4536 // InvalidStateError exception on setting if the Document has no |
| 4537 // browsing context. | 4537 // browsing context. |
| 4538 | 4538 |
| 4539 if (!getSecurityOrigin()->canAccessCookies()) { | 4539 if (!getSecurityOrigin()->canAccessCookies()) { |
| 4540 if (isSandboxed(SandboxOrigin)) | 4540 if (isSandboxed(SandboxOrigin)) |
| 4541 exceptionState.throwSecurityError( | 4541 exceptionState.throwSecurityError( |
| 4542 "The document is sandboxed and lacks the 'allow-same-origin' flag."); | 4542 "The document is sandboxed and lacks the 'allow-same-origin' flag."); |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5514 setContentSecurityPolicy( | 5514 setContentSecurityPolicy( |
| 5515 importsController()->master()->contentSecurityPolicy()); | 5515 importsController()->master()->contentSecurityPolicy()); |
| 5516 } else { | 5516 } else { |
| 5517 initContentSecurityPolicy(); | 5517 initContentSecurityPolicy(); |
| 5518 } | 5518 } |
| 5519 | 5519 |
| 5520 if (getSecurityOrigin()->hasSuborigin()) | 5520 if (getSecurityOrigin()->hasSuborigin()) |
| 5521 enforceSuborigin(*getSecurityOrigin()->suborigin()); | 5521 enforceSuborigin(*getSecurityOrigin()->suborigin()); |
| 5522 | 5522 |
| 5523 if (Settings* settings = initializer.settings()) { | 5523 if (Settings* settings = initializer.settings()) { |
| 5524 if (!settings->webSecurityEnabled()) { | 5524 if (!settings->GetWebSecurityEnabled()) { |
| 5525 // Web security is turned off. We should let this document access every | 5525 // Web security is turned off. We should let this document access every |
| 5526 // other document. This is used primary by testing harnesses for web | 5526 // other document. This is used primary by testing harnesses for web |
| 5527 // sites. | 5527 // sites. |
| 5528 getSecurityOrigin()->grantUniversalAccess(); | 5528 getSecurityOrigin()->grantUniversalAccess(); |
| 5529 } else if (getSecurityOrigin()->isLocal()) { | 5529 } else if (getSecurityOrigin()->isLocal()) { |
| 5530 if (settings->allowUniversalAccessFromFileURLs()) { | 5530 if (settings->GetAllowUniversalAccessFromFileURLs()) { |
| 5531 // Some clients want local URLs to have universal access, but that | 5531 // Some clients want local URLs to have universal access, but that |
| 5532 // setting is dangerous for other clients. | 5532 // setting is dangerous for other clients. |
| 5533 getSecurityOrigin()->grantUniversalAccess(); | 5533 getSecurityOrigin()->grantUniversalAccess(); |
| 5534 } else if (!settings->allowFileAccessFromFileURLs()) { | 5534 } else if (!settings->GetAllowFileAccessFromFileURLs()) { |
| 5535 // Some clients do not want local URLs to have access to other local | 5535 // Some clients do not want local URLs to have access to other local |
| 5536 // URLs. | 5536 // URLs. |
| 5537 getSecurityOrigin()->blockLocalAccessFromLocalOrigin(); | 5537 getSecurityOrigin()->blockLocalAccessFromLocalOrigin(); |
| 5538 } | 5538 } |
| 5539 } | 5539 } |
| 5540 } | 5540 } |
| 5541 | 5541 |
| 5542 if (initializer.shouldTreatURLAsSrcdocDocument()) { | 5542 if (initializer.shouldTreatURLAsSrcdocDocument()) { |
| 5543 m_isSrcdocDocument = true; | 5543 m_isSrcdocDocument = true; |
| 5544 setBaseURLOverride(initializer.parentBaseURL()); | 5544 setBaseURLOverride(initializer.parentBaseURL()); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5690 void Document::detachRange(Range* range) { | 5690 void Document::detachRange(Range* range) { |
| 5691 // We don't ASSERT m_ranges.contains(range) to allow us to call this | 5691 // We don't ASSERT m_ranges.contains(range) to allow us to call this |
| 5692 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 | 5692 // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044 |
| 5693 m_ranges.remove(range); | 5693 m_ranges.remove(range); |
| 5694 } | 5694 } |
| 5695 | 5695 |
| 5696 void Document::initDNSPrefetch() { | 5696 void Document::initDNSPrefetch() { |
| 5697 Settings* settings = this->settings(); | 5697 Settings* settings = this->settings(); |
| 5698 | 5698 |
| 5699 m_haveExplicitlyDisabledDNSPrefetch = false; | 5699 m_haveExplicitlyDisabledDNSPrefetch = false; |
| 5700 m_isDNSPrefetchEnabled = settings && settings->dnsPrefetchingEnabled() && | 5700 m_isDNSPrefetchEnabled = settings && settings->GetDNSPrefetchingEnabled() && |
| 5701 getSecurityOrigin()->protocol() == "http"; | 5701 getSecurityOrigin()->protocol() == "http"; |
| 5702 | 5702 |
| 5703 // Inherit DNS prefetch opt-out from parent frame | 5703 // Inherit DNS prefetch opt-out from parent frame |
| 5704 if (Document* parent = parentDocument()) { | 5704 if (Document* parent = parentDocument()) { |
| 5705 if (!parent->isDNSPrefetchEnabled()) | 5705 if (!parent->isDNSPrefetchEnabled()) |
| 5706 m_isDNSPrefetchEnabled = false; | 5706 m_isDNSPrefetchEnabled = false; |
| 5707 } | 5707 } |
| 5708 } | 5708 } |
| 5709 | 5709 |
| 5710 void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl) { | 5710 void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl) { |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6585 } | 6585 } |
| 6586 | 6586 |
| 6587 void showLiveDocumentInstances() { | 6587 void showLiveDocumentInstances() { |
| 6588 WeakDocumentSet& set = liveDocumentSet(); | 6588 WeakDocumentSet& set = liveDocumentSet(); |
| 6589 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6589 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6590 for (Document* document : set) | 6590 for (Document* document : set) |
| 6591 fprintf(stderr, "- Document %p URL: %s\n", document, | 6591 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6592 document->url().getString().utf8().data()); | 6592 document->url().getString().utf8().data()); |
| 6593 } | 6593 } |
| 6594 #endif | 6594 #endif |
| OLD | NEW |