diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 15:28:34 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 13:54:51 +0000 |
commit | 2a19c63448c84c1805fb1a585c3651318bb86ca7 (patch) | |
tree | eb17888e8531aa6ee5e85721bd553b832a7e5156 /chromium/third_party/blink/renderer/core/frame/history.cc | |
parent | b014812705fc80bff0a5c120dfcef88f349816dc (diff) | |
download | qtwebengine-chromium-2a19c63448c84c1805fb1a585c3651318bb86ca7.tar.gz |
BASELINE: Update Chromium to 69.0.3497.70
Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/frame/history.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/frame/history.cc | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/chromium/third_party/blink/renderer/core/frame/history.cc b/chromium/third_party/blink/renderer/core/frame/history.cc index 82ba2201ab8..1b4b8aef02c 100644 --- a/chromium/third_party/blink/renderer/core/frame/history.cc +++ b/chromium/third_party/blink/renderer/core/frame/history.cc @@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/frame/history.h" -#include "third_party/blink/renderer/bindings/core/v8/exception_state.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/frame_console.h" @@ -38,6 +37,7 @@ #include "third_party/blink/renderer/core/loader/history_item.h" #include "third_party/blink/renderer/core/loader/navigation_scheduler.h" #include "third_party/blink/renderer/core/page/page.h" +#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" @@ -134,11 +134,21 @@ String History::scrollRestoration(ExceptionState& exception_state) { } HistoryScrollRestorationType History::ScrollRestorationInternal() const { - HistoryItem* history_item = - GetFrame() ? GetFrame()->Loader().GetDocumentLoader()->GetHistoryItem() - : nullptr; - return history_item ? history_item->ScrollRestorationType() - : kScrollRestorationAuto; + constexpr HistoryScrollRestorationType default_type = kScrollRestorationAuto; + + LocalFrame* frame = GetFrame(); + if (!frame) + return default_type; + + DocumentLoader* document_loader = frame->Loader().GetDocumentLoader(); + if (!document_loader) + return default_type; + + HistoryItem* history_item = document_loader->GetHistoryItem(); + if (!history_item) + return default_type; + + return history_item->ScrollRestorationType(); } // TODO(crbug.com/394296): This is not the long-term fix to IPC flooding that we @@ -212,7 +222,7 @@ void History::go(ScriptState* script_state, // Otherwise, navigation happens on the root frame. // This behavior is designed in the following spec. // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go - GetFrame()->Reload(kFrameLoadTypeReload, + GetFrame()->Reload(WebFrameLoadType::kReload, ClientRedirectPolicy::kClientRedirect); } } @@ -222,7 +232,7 @@ void History::pushState(scoped_refptr<SerializedScriptValue> data, const String& url, ExceptionState& exception_state) { StateObjectAdded(std::move(data), title, url, ScrollRestorationInternal(), - kFrameLoadTypeStandard, exception_state); + WebFrameLoadType::kStandard, exception_state); } KURL History::UrlForState(const String& url_string) { @@ -248,7 +258,7 @@ bool History::CanChangeToUrl(const KURL& url, // We allow sandboxed documents, `data:`/`file:` URLs, etc. to use // 'pushState'/'replaceState' to modify the URL fragment: see // https://crbug.com/528681 for the compatibility concerns. - if (document_origin->IsUnique() || document_origin->IsLocal()) + if (document_origin->IsOpaque() || document_origin->IsLocal()) return EqualIgnoringQueryAndFragment(url, document_url); if (!EqualIgnoringPathQueryAndFragment(url, document_url)) @@ -256,7 +266,7 @@ bool History::CanChangeToUrl(const KURL& url, scoped_refptr<const SecurityOrigin> requested_origin = SecurityOrigin::Create(url); - if (requested_origin->IsUnique() || + if (requested_origin->IsOpaque() || !requested_origin->IsSameSchemeHostPort(document_origin)) { return false; } @@ -268,7 +278,7 @@ void History::StateObjectAdded(scoped_refptr<SerializedScriptValue> data, const String& /* title */, const String& url_string, HistoryScrollRestorationType restoration_type, - FrameLoadType type, + WebFrameLoadType type, ExceptionState& exception_state) { if (!GetFrame() || !GetFrame()->GetPage() || !GetFrame()->Loader().GetDocumentLoader()) { @@ -295,7 +305,7 @@ void History::StateObjectAdded(scoped_refptr<SerializedScriptValue> data, if (ShouldThrottleStateObjectChanges()) { // TODO(769592): Get an API spec change so that we can throw an exception: // - // exception_state.ThrowDOMException(kQuotaExceededError, + // exception_state.ThrowDOMException(DOMExceptionCode::kQuotaExceededError, // "Throttling history state changes to " // "prevent the browser from hanging."); // |