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

Side by Side Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 1042853004: [DevTools] Event Listeners Sidebar shows window listeners (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Extracted eventListenersTreeOutline.css Created 5 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 | « Source/bindings/core/v8/ScriptEventListener.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "bindings/core/v8/V8EventTarget.h" 47 #include "bindings/core/v8/V8EventTarget.h"
48 #include "bindings/core/v8/V8HTMLAllCollection.h" 48 #include "bindings/core/v8/V8HTMLAllCollection.h"
49 #include "bindings/core/v8/V8HTMLCollection.h" 49 #include "bindings/core/v8/V8HTMLCollection.h"
50 #include "bindings/core/v8/V8Location.h" 50 #include "bindings/core/v8/V8Location.h"
51 #include "bindings/core/v8/V8Navigator.h" 51 #include "bindings/core/v8/V8Navigator.h"
52 #include "bindings/core/v8/V8Node.h" 52 #include "bindings/core/v8/V8Node.h"
53 #include "bindings/core/v8/V8NodeList.h" 53 #include "bindings/core/v8/V8NodeList.h"
54 #include "bindings/core/v8/V8ScriptRunner.h" 54 #include "bindings/core/v8/V8ScriptRunner.h"
55 #include "core/events/EventTarget.h" 55 #include "core/events/EventTarget.h"
56 #include "core/frame/LocalDOMWindow.h" 56 #include "core/frame/LocalDOMWindow.h"
57 #include "core/inspector/EventListenerInfo.h"
57 #include "core/inspector/InjectedScript.h" 58 #include "core/inspector/InjectedScript.h"
58 #include "core/inspector/InjectedScriptHost.h" 59 #include "core/inspector/InjectedScriptHost.h"
59 #include "core/inspector/InspectorDOMAgent.h" 60 #include "core/inspector/InspectorDOMAgent.h"
60 #include "core/inspector/JavaScriptCallFrame.h" 61 #include "core/inspector/JavaScriptCallFrame.h"
61 #include "platform/JSONValues.h" 62 #include "platform/JSONValues.h"
62 63
63 namespace blink { 64 namespace blink {
64 65
65 Node* InjectedScriptHost::scriptValueAsNode(ScriptState* scriptState, ScriptValu e value) 66 Node* InjectedScriptHost::scriptValueAsNode(ScriptState* scriptState, ScriptValu e value)
66 { 67 {
67 ScriptState::Scope scope(scriptState); 68 ScriptState::Scope scope(scriptState);
68 if (!value.isObject() || value.isNull()) 69 if (!value.isObject() || value.isNull())
69 return 0; 70 return 0;
70 return V8Node::toImpl(v8::Local<v8::Object>::Cast(value.v8Value())); 71 return V8Node::toImpl(v8::Local<v8::Object>::Cast(value.v8Value()));
71 } 72 }
72 73
73 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node * node) 74 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node * node)
74 { 75 {
75 ScriptState::Scope scope(scriptState); 76 ScriptState::Scope scope(scriptState);
76 v8::Isolate* isolate = scriptState->isolate(); 77 v8::Isolate* isolate = scriptState->isolate();
77 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip tValue", "InjectedScriptHost", scriptState->context()->Global(), isolate); 78 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip tValue", "InjectedScriptHost", scriptState->context()->Global(), isolate);
78 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState) ) 79 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState) )
79 return ScriptValue(scriptState, v8::Null(isolate)); 80 return ScriptValue(scriptState, v8::Null(isolate));
80 return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(), isolate)); 81 return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(), isolate));
81 } 82 }
82 83
84 EventTarget* InjectedScriptHost::scriptValueAsEventTarget(ScriptState* scriptSta te, ScriptValue value)
85 {
86 ScriptState::Scope scope(scriptState);
87 if (!value.isObject() || value.isNull())
88 return nullptr;
89 v8::Isolate* isolate = scriptState->isolate();
90 EventTarget* target = V8EventTarget::toImplWithTypeCheck(isolate, v8::Local< v8::Object>::Cast(value.v8Value()));
91
92 // We need to handle a LocalDOMWindow specially, because a LocalDOMWindow wr apper exists on a prototype chain.
93 if (!target)
94 target = toDOMWindow(isolate, v8::Local<v8::Object>::Cast(value.v8Value( )));
95
96 if (!target || !target->executionContext())
97 return nullptr;
98 return target;
99 }
100
83 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info) 101 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info)
84 { 102 {
85 if (info.Length() < 1) 103 if (info.Length() < 1)
86 return; 104 return;
87 105
88 if (!info[0]->IsInt32()) { 106 if (!info[0]->IsInt32()) {
89 V8ThrowException::throwTypeError(info.GetIsolate(), "argument has to be an integer"); 107 V8ThrowException::throwTypeError(info.GetIsolate(), "argument has to be an integer");
90 return; 108 return;
91 } 109 }
92 110
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder()); 616 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder());
599 if (!injectedScriptNative) 617 if (!injectedScriptNative)
600 return; 618 return;
601 int id = info[0].As<v8::Int32>()->Value(); 619 int id = info[0].As<v8::Int32>()->Value();
602 String groupName = injectedScriptNative->groupName(id); 620 String groupName = injectedScriptNative->groupName(id);
603 if (!groupName.isEmpty()) 621 if (!groupName.isEmpty())
604 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName)); 622 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName));
605 } 623 }
606 624
607 } // namespace blink 625 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptEventListener.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698