Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (219690 => 219691)
--- trunk/Source/WebCore/CMakeLists.txt 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-07-20 16:58:06 UTC (rev 219691)
@@ -1202,7 +1202,6 @@
bindings/js/JSIDBObjectStoreCustom.cpp
bindings/js/JSIDBTransactionCustom.cpp
bindings/js/JSImageDataCustom.cpp
- bindings/js/JSInspectorFrontendHostCustom.cpp
bindings/js/JSLazyEventListener.cpp
bindings/js/JSLocationCustom.cpp
bindings/js/JSMainThreadExecState.cpp
Modified: trunk/Source/WebCore/ChangeLog (219690 => 219691)
--- trunk/Source/WebCore/ChangeLog 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/ChangeLog 2017-07-20 16:58:06 UTC (rev 219691)
@@ -1,3 +1,24 @@
+2017-07-20 Sam Weinig <[email protected]>
+
+ [WebIDL] Remove custom bindings for InspectorFrontendHost
+ https://bugs.webkit.org/show_bug.cgi?id=174659
+
+ Reviewed by Chris Dumez.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSInspectorFrontendHostCustom.cpp: Removed.
+ Remove JSInspectorFrontendHostCustom.cpp.
+
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::populateContextMenu):
+ (WebCore::InspectorFrontendHost::showContextMenu):
+ * inspector/InspectorFrontendHost.h:
+ * inspector/InspectorFrontendHost.idl:
+ Re-implement showContextMenu by using an IDL defined ContextMenuItem dictionary
+ and converting from that to a WebCore::ContextMenu in the implementation.
+
2017-07-20 Charlie Turner <[email protected]>
[GTK] Layout Test http/tests/media/hls/hls-progress.html is failing
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (219690 => 219691)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-07-20 16:58:06 UTC (rev 219691)
@@ -3089,7 +3089,6 @@
7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */; };
7A74ECBA101839A600BF939E /* InspectorDOMStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */; };
7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */; };
- 7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */; };
7A929CA61C598A9E004DF226 /* ResourceLoadStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A929CA11C598378004DF226 /* ResourceLoadStatistics.cpp */; };
7A929CA71C598AA9004DF226 /* ResourceLoadStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A929CA21C598378004DF226 /* ResourceLoadStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; };
7A93868518DCC14500B8263D /* VTTScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A93868218DCC14500B8263D /* VTTScanner.cpp */; };
@@ -11118,7 +11117,6 @@
7A7256B915EB9F5B007323A7 /* InspectorOverlayPage.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = InspectorOverlayPage.html; sourceTree = "<group>"; };
7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageAgent.cpp; sourceTree = "<group>"; };
7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMStorageAgent.h; sourceTree = "<group>"; };
- 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHostCustom.cpp; sourceTree = "<group>"; };
7A929CA11C598378004DF226 /* ResourceLoadStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadStatistics.cpp; sourceTree = "<group>"; };
7A929CA21C598378004DF226 /* ResourceLoadStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatistics.h; sourceTree = "<group>"; };
7A93868218DCC14500B8263D /* VTTScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VTTScanner.cpp; sourceTree = "<group>"; };
@@ -23615,7 +23613,6 @@
9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */,
BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */,
D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
- 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */,
@@ -32067,7 +32064,6 @@
A7D0318E0E93540300E24ACD /* JSImageDataCustom.cpp in Sources */,
A86629D409DA2B48009633A6 /* JSInputEvent.cpp in Sources */,
7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */,
- 7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */,
0F4710E51DB700C7002DCEC3 /* JSIntersectionObserver.cpp in Sources */,
0F8B45751DC41DBA00443C3F /* JSIntersectionObserverCallback.cpp in Sources */,
0F4710E71DB700C7002DCEC3 /* JSIntersectionObserverEntry.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (219690 => 219691)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2017-07-20 16:58:06 UTC (rev 219691)
@@ -70,7 +70,6 @@
#include "JSHTMLTemplateElementCustom.cpp"
#include "JSHistoryCustom.cpp"
#include "JSImageDataCustom.cpp"
-#include "JSInspectorFrontendHostCustom.cpp"
#include "JSLazyEventListener.cpp"
#include "JSLocationCustom.cpp"
#include "JSMainThreadExecState.cpp"
Deleted: trunk/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp (219690 => 219691)
--- trunk/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp 2017-07-20 16:58:06 UTC (rev 219691)
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Matt Lilek <[email protected]>
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSInspectorFrontendHost.h"
-
-#include "ContextMenuItem.h"
-#include "InspectorController.h"
-#include "InspectorFrontendHost.h"
-#include "JSDOMBinding.h"
-#include "JSEvent.h"
-#include "MouseEvent.h"
-#include <runtime/JSArray.h>
-#include <runtime/JSLock.h>
-#include <runtime/JSObject.h>
-#include <wtf/text/WTFString.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-#if ENABLE(CONTEXT_MENUS)
-static void populateContextMenuItems(ExecState* exec, JSArray* array, ContextMenu& menu)
-{
- VM& vm = exec->vm();
- for (size_t i = 0; i < array->length(); ++i) {
- JSObject* item = asObject(array->getIndex(exec, i));
- JSValue label = item->get(exec, Identifier::fromString(exec, "label"));
- JSValue type = item->get(exec, Identifier::fromString(exec, "type"));
- JSValue id = item->get(exec, Identifier::fromString(exec, "id"));
- JSValue enabled = item->get(exec, Identifier::fromString(exec, "enabled"));
- JSValue checked = item->get(exec, Identifier::fromString(exec, "checked"));
- JSValue subItems = item->get(exec, Identifier::fromString(exec, "subItems"));
- if (!type.isString())
- continue;
-
- String typeString = asString(type)->value(exec);
- if (typeString == "separator") {
- ContextMenuItem item(SeparatorType, ContextMenuItemTagNoAction, String());
- menu.appendItem(item);
- } else if (typeString == "subMenu" && subItems.inherits(vm, JSArray::info())) {
- ContextMenu subMenu;
- JSArray* subItemsArray = asArray(subItems);
- populateContextMenuItems(exec, subItemsArray, subMenu);
- ContextMenuItem item(SubmenuType, ContextMenuItemTagNoAction, label.toWTFString(exec), &subMenu);
- menu.appendItem(item);
- } else {
- ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec));
- ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, label.toWTFString(exec));
- if (!enabled.isUndefined())
- menuItem.setEnabled(enabled.toBoolean(exec));
- if (!checked.isUndefined())
- menuItem.setChecked(checked.toBoolean(exec));
- menu.appendItem(menuItem);
- }
- }
-}
-#endif
-
-JSValue JSInspectorFrontendHost::showContextMenu(ExecState& state)
-{
-#if ENABLE(CONTEXT_MENUS)
- if (state.argumentCount() < 2)
- return jsUndefined();
- VM& vm = state.vm();
- Event* event = JSEvent::toWrapped(vm, state.argument(0));
-
- JSArray* array = asArray(state.argument(1));
- ContextMenu menu;
- populateContextMenuItems(&state, array, menu);
-
- wrapped().showContextMenu(event, menu.items());
-#else
- UNUSED_PARAM(state);
-#endif
- return jsUndefined();
-}
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (219690 => 219691)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2017-07-20 16:58:06 UTC (rev 219691)
@@ -334,8 +334,37 @@
#if ENABLE(CONTEXT_MENUS)
-void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMenuItem>& items)
+static void populateContextMenu(Vector<InspectorFrontendHost::ContextMenuItem>&& items, ContextMenu& menu)
{
+ for (auto& item : items) {
+ if (item.type == "separator") {
+ menu.appendItem({ SeparatorType, ContextMenuItemTagNoAction, { } });
+ continue;
+ }
+
+ if (item.type == "subMenu" && item.subItems) {
+ ContextMenu subMenu;
+ populateContextMenu(WTFMove(*item.subItems), subMenu);
+
+ menu.appendItem({ SubmenuType, ContextMenuItemTagNoAction, item.label, &subMenu });
+ continue;
+ }
+
+ auto type = item.type == "checkbox" ? CheckableActionType : ActionType;
+ auto action = "" + item.id.value_or(0));
+ ContextMenuItem menuItem = { type, action, item.label };
+ if (item.enabled)
+ menuItem.setEnabled(*item.enabled);
+ if (item.checked)
+ menuItem.setChecked(*item.checked);
+ menu.appendItem(menuItem);
+ }
+}
+#endif
+
+void InspectorFrontendHost::showContextMenu(Event* event, Vector<ContextMenuItem>&& items)
+{
+#if ENABLE(CONTEXT_MENUS)
if (!event)
return;
@@ -346,13 +375,19 @@
ASSERT_NOT_REACHED();
return;
}
- auto menuProvider = FrontendMenuProvider::create(this, { &state, frontendApiObject }, items);
+
+ ContextMenu menu;
+ populateContextMenu(WTFMove(items), menu);
+
+ auto menuProvider = FrontendMenuProvider::create(this, { &state, frontendApiObject }, menu.items());
m_menuProvider = menuProvider.ptr();
m_frontendPage->contextMenuController().showContextMenu(*event, menuProvider);
+#else
+ UNUSED_PARAM(event);
+ UNUSED_PARAM(items);
+#endif
}
-#endif
-
void InspectorFrontendHost::dispatchEventAsContextMenuEvent(Event* event)
{
#if ENABLE(CONTEXT_MENUS) && USE(ACCESSIBILITY_CONTEXT_MENUS)
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (219690 => 219691)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2017-07-20 16:58:06 UTC (rev 219691)
@@ -36,7 +36,6 @@
namespace WebCore {
-class ContextMenuItem;
class Event;
class FrontendMenuProvider;
class InspectorFrontendClient;
@@ -85,10 +84,16 @@
void append(const String& url, const String& content);
void close(const String& url);
-#if ENABLE(CONTEXT_MENUS)
- // Called from [Custom] implementations.
- void showContextMenu(Event*, const Vector<ContextMenuItem>& items);
-#endif
+ struct ContextMenuItem {
+ String type;
+ String label;
+ std::optional<int> id;
+ std::optional<bool> enabled;
+ std::optional<bool> checked;
+ std::optional<Vector<ContextMenuItem>> subItems;
+ };
+ void showContextMenu(Event*, Vector<ContextMenuItem>&&);
+
void sendMessageToBackend(const String& message);
void dispatchEventAsContextMenuEvent(Event*);
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (219690 => 219691)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2017-07-20 16:42:39 UTC (rev 219690)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2017-07-20 16:58:06 UTC (rev 219691)
@@ -68,7 +68,7 @@
DOMString platform();
DOMString port();
- [Custom] void showContextMenu(MouseEvent event, any items);
+ void showContextMenu(Event? event, sequence<ContextMenuItem> items);
void dispatchEventAsContextMenuEvent(Event? event);
void sendMessageToBackend(DOMString message);
void unbufferedLog(DOMString message);
@@ -77,3 +77,14 @@
void beep();
};
+
+[
+ JSGenerateToJSObject
+] dictionary ContextMenuItem {
+ DOMString type;
+ DOMString label;
+ long id;
+ boolean enabled;
+ boolean checked;
+ sequence<ContextMenuItem> subItems;
+};