Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: third_party/WebKit/Source/core/loader/NavigationScheduler.cpp

Issue 2644633006: Add KURL::protocolIsJavascript member function (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
index f19b8dbad513d50b75df68d955fc6ff9c4fc3655..a3774fe667e17fe5b6586312f5efc643ddadf3f7 100644
--- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
+++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -154,7 +154,7 @@ class ScheduledURLNavigation : public ScheduledNavigation {
protected:
ScheduledURLNavigation(double delay,
Document* originDocument,
- const String& url,
+ const KURL& url,
bool replacesCurrentItem,
bool isLocationChange)
: ScheduledNavigation(delay,
@@ -185,10 +185,10 @@ class ScheduledURLNavigation : public ScheduledNavigation {
frame->loader().load(request);
}
- String url() const { return m_url; }
+ KURL url() const { return m_url; }
private:
- String m_url;
+ KURL m_url;
ContentSecurityPolicyDisposition m_shouldCheckMainWorldContentSecurityPolicy;
};
@@ -196,7 +196,7 @@ class ScheduledRedirect final : public ScheduledURLNavigation {
public:
static ScheduledRedirect* create(double delay,
Document* originDocument,
- const String& url,
+ const KURL& url,
bool replacesCurrentItem) {
return new ScheduledRedirect(delay, originDocument, url,
replacesCurrentItem);
@@ -225,7 +225,7 @@ class ScheduledRedirect final : public ScheduledURLNavigation {
private:
ScheduledRedirect(double delay,
Document* originDocument,
- const String& url,
+ const KURL& url,
bool replacesCurrentItem)
: ScheduledURLNavigation(delay,
originDocument,
@@ -239,7 +239,7 @@ class ScheduledRedirect final : public ScheduledURLNavigation {
class ScheduledLocationChange final : public ScheduledURLNavigation {
public:
static ScheduledLocationChange* create(Document* originDocument,
- const String& url,
+ const KURL& url,
bool replacesCurrentItem) {
return new ScheduledLocationChange(originDocument, url,
replacesCurrentItem);
@@ -247,13 +247,13 @@ class ScheduledLocationChange final : public ScheduledURLNavigation {
private:
ScheduledLocationChange(Document* originDocument,
- const String& url,
+ const KURL& url,
bool replacesCurrentItem)
: ScheduledURLNavigation(0.0,
originDocument,
url,
replacesCurrentItem,
- !protocolIsJavaScript(url)) {}
+ !url.protocolIsJavaScript()) {}
};
class ScheduledReload final : public ScheduledNavigation {
@@ -381,13 +381,13 @@ inline bool NavigationScheduler::shouldScheduleReload() const {
}
inline bool NavigationScheduler::shouldScheduleNavigation(
- const String& url) const {
+ const KURL& url) const {
return m_frame->page() && m_frame->isNavigationAllowed() &&
- (protocolIsJavaScript(url) ||
+ (url.protocolIsJavaScript() ||
NavigationDisablerForBeforeUnload::isNavigationAllowed());
}
-void NavigationScheduler::scheduleRedirect(double delay, const String& url) {
+void NavigationScheduler::scheduleRedirect(double delay, const KURL& url) {
if (!shouldScheduleNavigation(url))
return;
if (delay < 0 || delay > INT_MAX / 1000)
@@ -421,7 +421,7 @@ bool NavigationScheduler::mustReplaceCurrentItem(LocalFrame* targetFrame) {
}
void NavigationScheduler::scheduleLocationChange(Document* originDocument,
- const String& url,
+ const KURL& url,
bool replacesCurrentItem) {
if (!shouldScheduleNavigation(url))
return;
@@ -434,12 +434,9 @@ void NavigationScheduler::scheduleLocationChange(Document* originDocument,
// minimize the navigator's ability to execute timing attacks.
if (originDocument->getSecurityOrigin()->canAccess(
m_frame->document()->getSecurityOrigin())) {
- KURL parsedURL(ParsedURLString, url);
- if (parsedURL.hasFragmentIdentifier() &&
- equalIgnoringFragmentIdentifier(m_frame->document()->url(),
- parsedURL)) {
- FrameLoadRequest request(originDocument,
- m_frame->document()->completeURL(url), "_self");
+ if (url.hasFragmentIdentifier() &&
+ equalIgnoringFragmentIdentifier(m_frame->document()->url(), url)) {
+ FrameLoadRequest request(originDocument, url, "_self");
request.setReplacesCurrentItem(replacesCurrentItem);
if (replacesCurrentItem)
request.setClientRedirect(ClientRedirectPolicy::ClientRedirect);
« no previous file with comments | « third_party/WebKit/Source/core/loader/NavigationScheduler.h ('k') | third_party/WebKit/Source/platform/weborigin/KURL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698