OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 if (!m_frame) | 105 if (!m_frame) |
106 return String(); | 106 return String(); |
107 return DOMURLUtilsReadOnly::origin(url()); | 107 return DOMURLUtilsReadOnly::origin(url()); |
108 } | 108 } |
109 | 109 |
110 DOMStringList* Location::ancestorOrigins() const { | 110 DOMStringList* Location::ancestorOrigins() const { |
111 DOMStringList* origins = DOMStringList::create(DOMStringList::Location); | 111 DOMStringList* origins = DOMStringList::create(DOMStringList::Location); |
112 if (!m_frame) | 112 if (!m_frame) |
113 return origins; | 113 return origins; |
114 for (Frame* frame = m_frame->tree().parent(); frame; | 114 for (Frame* frame = m_frame->tree().parent(); frame; |
115 frame = frame->tree().parent()) | 115 frame = frame->tree().parent()) { |
116 origins->append(frame->securityContext()->getSecurityOrigin()->toString()); | 116 origins->append(frame->securityContext()->getSecurityOrigin()->toString()); |
| 117 } |
117 return origins; | 118 return origins; |
118 } | 119 } |
119 | 120 |
120 String Location::hash() const { | 121 String Location::hash() const { |
121 if (!m_frame) | 122 if (!m_frame) |
122 return String(); | 123 return String(); |
123 | 124 |
124 return DOMURLUtilsReadOnly::hash(url()); | 125 return DOMURLUtilsReadOnly::hash(url()); |
125 } | 126 } |
126 | 127 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if (protocolIsJavaScript(toLocalFrame(m_frame)->document()->url())) | 249 if (protocolIsJavaScript(toLocalFrame(m_frame)->document()->url())) |
249 return; | 250 return; |
250 m_frame->reload(FrameLoadTypeReload, ClientRedirectPolicy::ClientRedirect); | 251 m_frame->reload(FrameLoadTypeReload, ClientRedirectPolicy::ClientRedirect); |
251 } | 252 } |
252 | 253 |
253 void Location::setLocation(const String& url, | 254 void Location::setLocation(const String& url, |
254 LocalDOMWindow* currentWindow, | 255 LocalDOMWindow* currentWindow, |
255 LocalDOMWindow* enteredWindow, | 256 LocalDOMWindow* enteredWindow, |
256 ExceptionState* exceptionState, | 257 ExceptionState* exceptionState, |
257 SetLocation locationPolicy) { | 258 SetLocation locationPolicy) { |
258 ASSERT(m_frame); | 259 DCHECK(m_frame); |
259 if (!m_frame || !m_frame->host()) | 260 if (!m_frame || !m_frame->host()) |
260 return; | 261 return; |
261 | 262 |
262 if (!currentWindow->frame()) | 263 if (!currentWindow->frame()) |
263 return; | 264 return; |
264 | 265 |
265 if (!currentWindow->frame()->canNavigate(*m_frame)) { | 266 if (!currentWindow->frame()->canNavigate(*m_frame)) { |
266 if (exceptionState) | 267 if (exceptionState) { |
267 exceptionState->throwSecurityError( | 268 exceptionState->throwSecurityError( |
268 "The current window does not have permission to navigate the target " | 269 "The current window does not have permission to navigate the target " |
269 "frame to '" + | 270 "frame to '" + |
270 url + "'."); | 271 url + "'."); |
| 272 } |
271 return; | 273 return; |
272 } | 274 } |
273 | 275 |
274 Document* enteredDocument = enteredWindow->document(); | 276 Document* enteredDocument = enteredWindow->document(); |
275 if (!enteredDocument) | 277 if (!enteredDocument) |
276 return; | 278 return; |
277 | 279 |
278 KURL completedURL = enteredDocument->completeURL(url); | 280 KURL completedURL = enteredDocument->completeURL(url); |
279 if (completedURL.isNull()) | 281 if (completedURL.isNull()) |
280 return; | 282 return; |
(...skipping 16 matching lines...) Expand all Loading... |
297 argv.append(enteredDocument->url()); | 299 argv.append(enteredDocument->url()); |
298 argv.append(completedURL); | 300 argv.append(completedURL); |
299 activityLogger->logEvent("blinkSetAttribute", argv.size(), argv.data()); | 301 activityLogger->logEvent("blinkSetAttribute", argv.size(), argv.data()); |
300 } | 302 } |
301 m_frame->navigate(*currentWindow->document(), completedURL, | 303 m_frame->navigate(*currentWindow->document(), completedURL, |
302 locationPolicy == SetLocation::ReplaceThisFrame, | 304 locationPolicy == SetLocation::ReplaceThisFrame, |
303 UserGestureStatus::None); | 305 UserGestureStatus::None); |
304 } | 306 } |
305 | 307 |
306 } // namespace blink | 308 } // namespace blink |
OLD | NEW |