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