Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "core/frame/Location.h" | 29 #include "core/frame/Location.h" |
| 30 | 30 |
| 31 #include "bindings/core/v8/BindingSecurity.h" | 31 #include "bindings/core/v8/BindingSecurity.h" |
| 32 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
| 33 #include "bindings/core/v8/V8DOMActivityLogger.h" | 33 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 34 #include "bindings/core/v8/V8DOMWrapper.h" | |
| 34 #include "core/dom/DOMURLUtilsReadOnly.h" | 35 #include "core/dom/DOMURLUtilsReadOnly.h" |
| 35 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 36 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/frame/LocalDOMWindow.h" | 38 #include "core/frame/LocalDOMWindow.h" |
| 38 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
| 39 #include "core/loader/FrameLoader.h" | 40 #include "core/loader/FrameLoader.h" |
| 40 #include "platform/weborigin/KURL.h" | 41 #include "platform/weborigin/KURL.h" |
| 41 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 DOMStringList* origins = DOMStringList::create(); | 113 DOMStringList* origins = DOMStringList::create(); |
| 113 if (!m_frame) | 114 if (!m_frame) |
| 114 return origins; | 115 return origins; |
| 115 for (Frame* frame = m_frame->tree().parent(); frame; | 116 for (Frame* frame = m_frame->tree().parent(); frame; |
| 116 frame = frame->tree().parent()) { | 117 frame = frame->tree().parent()) { |
| 117 origins->append(frame->securityContext()->getSecurityOrigin()->toString()); | 118 origins->append(frame->securityContext()->getSecurityOrigin()->toString()); |
| 118 } | 119 } |
| 119 return origins; | 120 return origins; |
| 120 } | 121 } |
| 121 | 122 |
| 123 v8::Local<v8::Object> Location::crossOriginWrapper(v8::Isolate* isolate) { | |
|
Yuki
2017/01/24 10:31:05
I guess it's better to rename this function to rem
| |
| 124 if (m_crossOriginWrapper.IsEmpty()) { | |
| 125 m_crossOriginWrapper.Reset( | |
| 126 isolate, wrapperTypeInfo() | |
| 127 ->domTemplate(isolate, DOMWrapperWorld::world( | |
|
dcheng
2017/01/24 09:40:47
However, this makes me nervous. Is there a way to
Yuki
2017/01/24 10:31:04
No, because we have main-world-specific optimizati
dcheng
2017/01/24 10:41:59
Can you point me at the main world optimizations?
Yuki
2017/01/24 10:53:00
I meant [PerWorldBindings] extended attribute, but
| |
| 128 isolate->GetCurrentContext())) | |
| 129 ->NewRemoteInstance() | |
|
dcheng
2017/01/24 09:40:47
+jochen
Sharing a remote instance like this shoul
Yuki
2017/01/24 10:31:04
If it's okay, then I'd like to have a comment here
| |
| 130 .ToLocalChecked()); | |
| 131 V8DOMWrapper::setNativeInfo(isolate, m_crossOriginWrapper.Get(isolate), | |
| 132 wrapperTypeInfo(), this); | |
| 133 m_crossOriginWrapper.SetWrapperClassId(wrapperTypeInfo()->wrapperClassId); | |
| 134 } | |
| 135 return m_crossOriginWrapper.Get(isolate); | |
| 136 } | |
| 137 | |
| 122 String Location::hash() const { | 138 String Location::hash() const { |
| 123 if (!m_frame) | 139 if (!m_frame) |
| 124 return String(); | 140 return String(); |
| 125 | 141 |
| 126 return DOMURLUtilsReadOnly::hash(url()); | 142 return DOMURLUtilsReadOnly::hash(url()); |
| 127 } | 143 } |
| 128 | 144 |
| 129 void Location::setHref(LocalDOMWindow* currentWindow, | 145 void Location::setHref(LocalDOMWindow* currentWindow, |
| 130 LocalDOMWindow* enteredWindow, | 146 LocalDOMWindow* enteredWindow, |
| 131 const String& url, | 147 const String& url, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 argv.push_back(enteredDocument->url()); | 328 argv.push_back(enteredDocument->url()); |
| 313 argv.push_back(completedURL); | 329 argv.push_back(completedURL); |
| 314 activityLogger->logEvent("blinkSetAttribute", argv.size(), argv.data()); | 330 activityLogger->logEvent("blinkSetAttribute", argv.size(), argv.data()); |
| 315 } | 331 } |
| 316 m_frame->navigate(*currentWindow->document(), completedURL, | 332 m_frame->navigate(*currentWindow->document(), completedURL, |
| 317 setLocationPolicy == SetLocationPolicy::ReplaceThisFrame, | 333 setLocationPolicy == SetLocationPolicy::ReplaceThisFrame, |
| 318 UserGestureStatus::None); | 334 UserGestureStatus::None); |
| 319 } | 335 } |
| 320 | 336 |
| 321 } // namespace blink | 337 } // namespace blink |
| OLD | NEW |