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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 1373773003: Implement 'window.isSecureContext'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: document. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/frame/DOMWindow.h" 6 #include "core/frame/DOMWindow.h"
7 7
8 #include "bindings/core/v8/ScriptCallStackFactory.h" 8 #include "bindings/core/v8/ScriptCallStackFactory.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
11 #include "core/dom/ExecutionContext.h"
11 #include "core/dom/SecurityContext.h" 12 #include "core/dom/SecurityContext.h"
12 #include "core/events/MessageEvent.h" 13 #include "core/events/MessageEvent.h"
13 #include "core/frame/Frame.h" 14 #include "core/frame/Frame.h"
14 #include "core/frame/FrameClient.h" 15 #include "core/frame/FrameClient.h"
15 #include "core/frame/FrameConsole.h" 16 #include "core/frame/FrameConsole.h"
16 #include "core/frame/LocalDOMWindow.h" 17 #include "core/frame/LocalDOMWindow.h"
17 #include "core/frame/Location.h" 18 #include "core/frame/Location.h"
18 #include "core/frame/Settings.h" 19 #include "core/frame/Settings.h"
19 #include "core/frame/UseCounter.h" 20 #include "core/frame/UseCounter.h"
20 #include "core/inspector/ConsoleMessageStorage.h" 21 #include "core/inspector/ConsoleMessageStorage.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void DOMWindow::resetLocation() 149 void DOMWindow::resetLocation()
149 { 150 {
150 // Location needs to be reset manually because it doesn't inherit from DOMWi ndowProperty. 151 // Location needs to be reset manually because it doesn't inherit from DOMWi ndowProperty.
151 // DOMWindowProperty is local-only, and Location needs to support remote win dows, too. 152 // DOMWindowProperty is local-only, and Location needs to support remote win dows, too.
152 if (m_location) { 153 if (m_location) {
153 m_location->reset(); 154 m_location->reset();
154 m_location = nullptr; 155 m_location = nullptr;
155 } 156 }
156 } 157 }
157 158
159 bool DOMWindow::isSecureContext() const
160 {
161 if (!frame())
162 return false;
163
164 String unusedErrorMessage;
165 return document()->isSecureContext(unusedErrorMessage, ExecutionContext::Sta ndardSecureContextCheck);
166 }
167
158 void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes sagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, Except ionState& exceptionState) 168 void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes sagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, Except ionState& exceptionState)
159 { 169 {
160 if (!isCurrentlyDisplayedInFrame()) 170 if (!isCurrentlyDisplayedInFrame())
161 return; 171 return;
162 172
163 Document* sourceDocument = source->document(); 173 Document* sourceDocument = source->document();
164 174
165 // Compute the target origin. We need to do this synchronously in order 175 // Compute the target origin. We need to do this synchronously in order
166 // to generate the SyntaxError exception correctly. 176 // to generate the SyntaxError exception correctly.
167 RefPtr<SecurityOrigin> target; 177 RefPtr<SecurityOrigin> target;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 m_windowIsClosing = true; 338 m_windowIsClosing = true;
329 } 339 }
330 340
331 DEFINE_TRACE(DOMWindow) 341 DEFINE_TRACE(DOMWindow)
332 { 342 {
333 visitor->trace(m_location); 343 visitor->trace(m_location);
334 EventTargetWithInlineData::trace(visitor); 344 EventTargetWithInlineData::trace(visitor);
335 } 345 }
336 346
337 } // namespace blink 347 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.h ('k') | third_party/WebKit/Source/core/frame/Window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698