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

Unified Diff: Source/bindings/core/v8/custom/V8InspectorFrontendHostCustom.cpp

Issue 653613002: [DevTools] Inject element into toolbox window, do not load modules there. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/inspector/InspectorFrontendHost.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/custom/V8InspectorFrontendHostCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8InspectorFrontendHostCustom.cpp b/Source/bindings/core/v8/custom/V8InspectorFrontendHostCustom.cpp
index 06c77f4859b147151e05118cbe0096cb23a1f733..84c513f0d92c2c3b397ce764fff1d1139cefb0e7 100644
--- a/Source/bindings/core/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8InspectorFrontendHostCustom.cpp
@@ -32,6 +32,7 @@
#include "bindings/core/v8/V8InspectorFrontendHost.h"
#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8HTMLDocument.h"
#include "bindings/core/v8/V8MouseEvent.h"
#include "bindings/core/v8/V8Window.h"
#include "core/dom/Document.h"
@@ -146,17 +147,26 @@ void V8InspectorFrontendHost::showContextMenuAtPointMethodCustom(const v8::Funct
if (!populateContextMenuItems(v8::Local<v8::Array>::Cast(array), menu, info.GetIsolate()))
return;
- v8::Isolate* isolate = info.GetIsolate();
- v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain(isolate->GetEnteredContext()->Global(), isolate);
- if (windowWrapper.IsEmpty())
- return;
- LocalDOMWindow* window = V8Window::toImpl(windowWrapper);
- if (!window->document() || !window->document()->page())
+ Document* document = nullptr;
+ if (info.Length() >= 4) {
+ v8::Local<v8::Object> documentWrapper = v8::Local<v8::Object>::Cast(info[3]);
+ if (!V8HTMLDocument::wrapperTypeInfo.equals(toWrapperTypeInfo(documentWrapper)))
+ return;
+ document = V8HTMLDocument::toImpl(documentWrapper);
+ } else {
+ v8::Isolate* isolate = info.GetIsolate();
+ v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain(isolate->GetEnteredContext()->Global(), isolate);
+ if (windowWrapper.IsEmpty())
+ return;
+ LocalDOMWindow* window = V8Window::toImpl(windowWrapper);
+ document = window ? window->document() : nullptr;
+ }
+ if (!document || !document->page())
return;
InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toImpl(info.Holder());
Vector<ContextMenuItem> items = menu.items();
- frontendHost->showContextMenu(window->document()->page(), static_cast<float>(x->NumberValue()), static_cast<float>(y->NumberValue()), items);
+ frontendHost->showContextMenu(document->page(), static_cast<float>(x->NumberValue()), static_cast<float>(y->NumberValue()), items);
}
static void histogramEnumeration(const char* name, const v8::FunctionCallbackInfo<v8::Value>& info, int boundaryValue)
« no previous file with comments | « no previous file | Source/core/inspector/InspectorFrontendHost.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698