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

Unified Diff: Source/core/frame/Location.cpp

Issue 879423003: Move Location to DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove DOMWindowProperty changes Created 5 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: Source/core/frame/Location.cpp
diff --git a/Source/core/frame/Location.cpp b/Source/core/frame/Location.cpp
index 45b0ea5cdeecaa4238c66d32d6aa8a789c0cae5b..dccdb944f7a8f0f832179991cf4c7e7bfa189dc8 100644
--- a/Source/core/frame/Location.cpp
+++ b/Source/core/frame/Location.cpp
@@ -42,21 +42,21 @@
namespace blink {
-Location::Location(LocalFrame* frame)
- : DOMWindowProperty(frame)
+Location::Location(Frame* frame)
+ : m_frame(frame)
{
}
void Location::trace(Visitor* visitor)
{
- DOMWindowProperty::trace(visitor);
+ visitor->trace(m_frame);
}
inline const KURL& Location::url() const
{
- ASSERT(m_frame);
+ ASSERT(m_frame && m_frame->isLocalFrame());
haraken 2015/02/03 00:56:09 This ASSERT would be redundant, since toLocalFrame
Nate Chapin 2015/02/03 19:17:21 Done.
- const KURL& url = m_frame->document()->url();
+ const KURL& url = toLocalFrame(m_frame)->document()->url();
if (!url.isValid())
return blankURL(); // Use "about:blank" while the page is still loading (before we have a frame).
@@ -149,7 +149,8 @@ void Location::setProtocol(LocalDOMWindow* callingWindow, LocalDOMWindow* entere
{
if (!m_frame)
return;
- KURL url = m_frame->document()->url();
+ ASSERT(m_frame->isLocalFrame());
haraken 2015/02/03 00:56:09 Ditto. The same comment for other parts in this fi
Nate Chapin 2015/02/03 19:17:21 Done.
+ KURL url = toLocalFrame(m_frame)->document()->url();
if (!url.setProtocol(protocol)) {
exceptionState.throwDOMException(SyntaxError, "'" + protocol + "' is an invalid protocol.");
return;
@@ -161,7 +162,8 @@ void Location::setHost(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWin
{
if (!m_frame)
return;
- KURL url = m_frame->document()->url();
+ ASSERT(m_frame->isLocalFrame());
+ KURL url = toLocalFrame(m_frame)->document()->url();
url.setHostAndPort(host);
setLocation(url.string(), callingWindow, enteredWindow);
}
@@ -170,7 +172,8 @@ void Location::setHostname(LocalDOMWindow* callingWindow, LocalDOMWindow* entere
{
if (!m_frame)
return;
- KURL url = m_frame->document()->url();
+ ASSERT(m_frame->isLocalFrame());
+ KURL url = toLocalFrame(m_frame)->document()->url();
url.setHost(hostname);
setLocation(url.string(), callingWindow, enteredWindow);
}
@@ -179,7 +182,8 @@ void Location::setPort(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWin
{
if (!m_frame)
return;
- KURL url = m_frame->document()->url();
+ ASSERT(m_frame->isLocalFrame());
+ KURL url = toLocalFrame(m_frame)->document()->url();
url.setPort(portString);
setLocation(url.string(), callingWindow, enteredWindow);
}
@@ -188,7 +192,8 @@ void Location::setPathname(LocalDOMWindow* callingWindow, LocalDOMWindow* entere
{
if (!m_frame)
return;
- KURL url = m_frame->document()->url();
+ ASSERT(m_frame->isLocalFrame());
+ KURL url = toLocalFrame(m_frame)->document()->url();
url.setPath(pathname);
setLocation(url.string(), callingWindow, enteredWindow);
}
@@ -197,7 +202,8 @@ void Location::setSearch(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredW
{
if (!m_frame)
return;
- KURL url = m_frame->document()->url();
+ ASSERT(m_frame->isLocalFrame());
+ KURL url = toLocalFrame(m_frame)->document()->url();
url.setQuery(search);
setLocation(url.string(), callingWindow, enteredWindow);
}
@@ -206,7 +212,8 @@ void Location::setHash(LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWin
{
if (!m_frame)
return;
- KURL url = m_frame->document()->url();
+ ASSERT(m_frame->isLocalFrame());
+ KURL url = toLocalFrame(m_frame)->document()->url();
String oldFragmentIdentifier = url.fragmentIdentifier();
String newFragmentIdentifier = hash;
if (hash[0] == '#')
@@ -238,7 +245,8 @@ void Location::reload(LocalDOMWindow* callingWindow)
{
if (!m_frame)
return;
- if (protocolIsJavaScript(m_frame->document()->url()))
+ ASSERT(m_frame->isLocalFrame());
+ if (protocolIsJavaScript(toLocalFrame(m_frame)->document()->url()))
return;
m_frame->reload(NormalReload, ClientRedirect);
}

Powered by Google App Engine
This is Rietveld 408576698