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

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

Issue 2848503002: Revert of binding: Changes the association among global-proxy/global/window-instance (2nd attempt).… (Closed)
Patch Set: Updated the test expectation. Created 3 years, 7 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "bindings/core/v8/ToV8ForCore.h"
6
7 #include "bindings/core/v8/WindowProxy.h"
8 #include "core/events/EventTarget.h"
9 #include "core/frame/DOMWindow.h"
10 #include "core/frame/Frame.h"
11
12 namespace blink {
13
14 v8::Local<v8::Value> ToV8(DOMWindow* window,
15 v8::Local<v8::Object> creation_context,
16 v8::Isolate* isolate) {
17 // Notice that we explicitly ignore creationContext because the DOMWindow
18 // has its own creationContext.
19
20 if (UNLIKELY(!window))
21 return v8::Null(isolate);
22
23 // TODO(yukishiino): Get understanding of why it's possible to initialize
24 // the context after the frame is detached. And then, remove the following
25 // lines. See also https://crbug.com/712638 .
26 Frame* frame = window->GetFrame();
27 if (!frame)
28 return v8::Local<v8::Object>();
29
30 // TODO(yukishiino): Make this function always return the non-empty handle
31 // even if the frame is detached because the global proxy must always exist
32 // per spec.
33 return frame->GetWindowProxy(DOMWrapperWorld::Current(isolate))
34 ->GlobalProxyIfNotDetached();
35 }
36
37 v8::Local<v8::Value> ToV8(EventTarget* impl,
38 v8::Local<v8::Object> creation_context,
39 v8::Isolate* isolate) {
40 if (UNLIKELY(!impl))
41 return v8::Null(isolate);
42
43 if (impl->InterfaceName() == EventTargetNames::DOMWindow)
44 return ToV8(static_cast<DOMWindow*>(impl), creation_context, isolate);
45 return ToV8(static_cast<ScriptWrappable*>(impl), creation_context, isolate);
46 }
47
48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698