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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8PagePopupControllerBinding.cpp

Issue 2798863002: PagePopupController: handle frame-detached window usage. (Closed)
Patch Set: add test Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/calendar-picker/week-picker-close-no-crash.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "bindings/core/v8/V8PagePopupControllerBinding.h" 5 #include "bindings/core/v8/V8PagePopupControllerBinding.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "bindings/core/v8/V8Window.h" 8 #include "bindings/core/v8/V8Window.h"
9 #include "core/dom/ContextFeatures.h" 9 #include "core/dom/ContextFeatures.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
11 #include "core/dom/ExecutionContext.h" 11 #include "core/dom/ExecutionContext.h"
12 #include "core/frame/LocalDOMWindow.h" 12 #include "core/frame/LocalDOMWindow.h"
13 #include "core/page/PagePopupController.h" 13 #include "core/page/PagePopupController.h"
14 #include "core/page/PagePopupSupplement.h" 14 #include "core/page/PagePopupSupplement.h"
15 #include "platform/instrumentation/tracing/TraceEvent.h" 15 #include "platform/instrumentation/tracing/TraceEvent.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 namespace { 19 namespace {
20 20
21 void pagePopupControllerAttributeGetter( 21 void pagePopupControllerAttributeGetter(
22 const v8::PropertyCallbackInfo<v8::Value>& info) { 22 const v8::PropertyCallbackInfo<v8::Value>& info) {
23 v8::Local<v8::Object> holder = info.Holder(); 23 v8::Local<v8::Object> holder = info.Holder();
24 DOMWindow* impl = V8Window::toImpl(holder); 24 DOMWindow* impl = V8Window::toImpl(holder);
25 PagePopupController* cppValue = 25 PagePopupController* cppValue = nullptr;
26 PagePopupSupplement::from(*toLocalDOMWindow(impl)->frame()) 26 if (LocalFrame* frame = toLocalDOMWindow(impl)->frame())
27 .pagePopupController(); 27 cppValue = PagePopupSupplement::from(*frame).pagePopupController();
28 v8SetReturnValue(info, ToV8(cppValue, holder, info.GetIsolate())); 28 v8SetReturnValue(info, ToV8(cppValue, holder, info.GetIsolate()));
29 } 29 }
30 30
31 void pagePopupControllerAttributeGetterCallback( 31 void pagePopupControllerAttributeGetterCallback(
32 v8::Local<v8::Name>, 32 v8::Local<v8::Name>,
33 const v8::PropertyCallbackInfo<v8::Value>& info) { 33 const v8::PropertyCallbackInfo<v8::Value>& info) {
34 pagePopupControllerAttributeGetter(info); 34 pagePopupControllerAttributeGetter(info);
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 void V8PagePopupControllerBinding::installPagePopupController( 39 void V8PagePopupControllerBinding::installPagePopupController(
40 v8::Local<v8::Context> context, 40 v8::Local<v8::Context> context,
41 v8::Local<v8::Object> windowWrapper) { 41 v8::Local<v8::Object> windowWrapper) {
42 ExecutionContext* executionContext = 42 ExecutionContext* executionContext =
43 toExecutionContext(windowWrapper->CreationContext()); 43 toExecutionContext(windowWrapper->CreationContext());
44 if (!(executionContext && executionContext->isDocument() && 44 if (!(executionContext && executionContext->isDocument() &&
45 ContextFeatures::pagePopupEnabled(toDocument(executionContext)))) 45 ContextFeatures::pagePopupEnabled(toDocument(executionContext))))
46 return; 46 return;
47 47
48 windowWrapper->SetAccessor( 48 windowWrapper->SetAccessor(
49 context, v8AtomicString(context->GetIsolate(), "pagePopupController"), 49 context, v8AtomicString(context->GetIsolate(), "pagePopupController"),
50 pagePopupControllerAttributeGetterCallback).ToChecked(); 50 pagePopupControllerAttributeGetterCallback).ToChecked();
51 } 51 }
52 52
53 } // namespace blink 53 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/calendar-picker/week-picker-close-no-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698