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

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

Issue 939613002: Add [TypeChecking=Unrestricted] on DevToolsHost interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | Source/core/inspector/DevToolsHost.idl » ('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-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2009 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 DevToolsHost* devtoolsHost = V8DevToolsHost::toImpl(info.Holder()); 123 DevToolsHost* devtoolsHost = V8DevToolsHost::toImpl(info.Holder());
124 Vector<ContextMenuItem> items = menu.items(); 124 Vector<ContextMenuItem> items = menu.items();
125 devtoolsHost->showContextMenu(event, items); 125 devtoolsHost->showContextMenu(event, items);
126 } 126 }
127 127
128 void V8DevToolsHost::showContextMenuAtPointMethodCustom(const v8::FunctionCallba ckInfo<v8::Value>& info) 128 void V8DevToolsHost::showContextMenuAtPointMethodCustom(const v8::FunctionCallba ckInfo<v8::Value>& info)
129 { 129 {
130 if (info.Length() < 3) 130 if (info.Length() < 3)
131 return; 131 return;
132 132
133 v8::Local<v8::Value> x = v8::Local<v8::Value>::Cast(info[0]); 133 ExceptionState exceptionState(ExceptionState::ExecutionContext, "showContext MenuAtPoint", "DevToolsHost", info.Holder(), info.GetIsolate());
134 if (!x->IsNumber())
135 return;
136 134
137 v8::Local<v8::Value> y = v8::Local<v8::Value>::Cast(info[1]); 135 TONATIVE_VOID_EXCEPTIONSTATE(float, x, toRestrictedFloat(info[0], exceptionS tate), exceptionState);
138 if (!y->IsNumber()) 136 TONATIVE_VOID_EXCEPTIONSTATE(float, y, toRestrictedFloat(info[1], exceptionS tate), exceptionState);
139 return;
140 137
141 v8::Local<v8::Value> array = v8::Local<v8::Value>::Cast(info[2]); 138 v8::Local<v8::Value> array = v8::Local<v8::Value>::Cast(info[2]);
142 if (!array->IsArray()) 139 if (!array->IsArray())
143 return; 140 return;
144 ContextMenu menu; 141 ContextMenu menu;
145 if (!populateContextMenuItems(v8::Local<v8::Array>::Cast(array), menu, info. GetIsolate())) 142 if (!populateContextMenuItems(v8::Local<v8::Array>::Cast(array), menu, info. GetIsolate()))
146 return; 143 return;
147 144
148 Document* document = nullptr; 145 Document* document = nullptr;
149 if (info.Length() >= 4 && v8::Local<v8::Value>::Cast(info[3])->IsObject()) { 146 if (info.Length() >= 4 && v8::Local<v8::Value>::Cast(info[3])->IsObject()) {
150 v8::Local<v8::Object> documentWrapper = v8::Local<v8::Object>::Cast(info [3]); 147 v8::Local<v8::Object> documentWrapper = v8::Local<v8::Object>::Cast(info [3]);
151 if (!V8HTMLDocument::wrapperTypeInfo.equals(toWrapperTypeInfo(documentWr apper))) 148 if (!V8HTMLDocument::wrapperTypeInfo.equals(toWrapperTypeInfo(documentWr apper)))
152 return; 149 return;
153 document = V8HTMLDocument::toImpl(documentWrapper); 150 document = V8HTMLDocument::toImpl(documentWrapper);
154 } else { 151 } else {
155 v8::Isolate* isolate = info.GetIsolate(); 152 v8::Isolate* isolate = info.GetIsolate();
156 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype Chain(isolate->GetEnteredContext()->Global(), isolate); 153 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype Chain(isolate->GetEnteredContext()->Global(), isolate);
157 if (windowWrapper.IsEmpty()) 154 if (windowWrapper.IsEmpty())
158 return; 155 return;
159 DOMWindow* window = V8Window::toImpl(windowWrapper); 156 DOMWindow* window = V8Window::toImpl(windowWrapper);
160 document = window ? toLocalDOMWindow(window)->document() : nullptr; 157 document = window ? toLocalDOMWindow(window)->document() : nullptr;
161 } 158 }
162 if (!document || !document->frame()) 159 if (!document || !document->frame())
163 return; 160 return;
164 161
165 DevToolsHost* devtoolsHost = V8DevToolsHost::toImpl(info.Holder()); 162 DevToolsHost* devtoolsHost = V8DevToolsHost::toImpl(info.Holder());
166 Vector<ContextMenuItem> items = menu.items(); 163 Vector<ContextMenuItem> items = menu.items();
167 devtoolsHost->showContextMenu(document->frame(), static_cast<float>(x->Numbe rValue()), static_cast<float>(y->NumberValue()), items); 164 devtoolsHost->showContextMenu(document->frame(), x, y, items);
168 } 165 }
169 166
170 } // namespace blink 167 } // namespace blink
171 168
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/DevToolsHost.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698