Title: [219735] trunk/Source/WebCore
Revision
219735
Author
[email protected]
Date
2017-07-21 12:39:57 -0700 (Fri, 21 Jul 2017)

Log Message

[WebIDL] Make a few parameters non-nullable in inspector IDL files
https://bugs.webkit.org/show_bug.cgi?id=174719

Patch by Sam Weinig <[email protected]> on 2017-07-21
Reviewed by Joseph Pecoraro.

* inspector/CommandLineAPIHost.cpp:
(WebCore::CommandLineAPIHost::databaseId):
(WebCore::CommandLineAPIHost::storageId):
* inspector/CommandLineAPIHost.h:
* inspector/CommandLineAPIHost.idl:
* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::storageId):
* inspector/InspectorDOMStorageAgent.h:
* inspector/InspectorDatabaseAgent.cpp:
(WebCore::InspectorDatabaseAgent::databaseId):
* inspector/InspectorDatabaseAgent.h:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::showContextMenu):
(WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent):
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
Remove nullability from arguments that should never be null.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219734 => 219735)


--- trunk/Source/WebCore/ChangeLog	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/ChangeLog	2017-07-21 19:39:57 UTC (rev 219735)
@@ -1,3 +1,28 @@
+2017-07-21  Sam Weinig  <[email protected]>
+
+        [WebIDL] Make a few parameters non-nullable in inspector IDL files
+        https://bugs.webkit.org/show_bug.cgi?id=174719
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/CommandLineAPIHost.cpp:
+        (WebCore::CommandLineAPIHost::databaseId):
+        (WebCore::CommandLineAPIHost::storageId):
+        * inspector/CommandLineAPIHost.h:
+        * inspector/CommandLineAPIHost.idl:
+        * inspector/InspectorDOMStorageAgent.cpp:
+        (WebCore::InspectorDOMStorageAgent::storageId):
+        * inspector/InspectorDOMStorageAgent.h:
+        * inspector/InspectorDatabaseAgent.cpp:
+        (WebCore::InspectorDatabaseAgent::databaseId):
+        * inspector/InspectorDatabaseAgent.h:
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::showContextMenu):
+        (WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent):
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+        Remove nullability from arguments that should never be null.
+
 2017-07-21  Brady Eidson  <[email protected]>
 
         Get rid of WebCore IconDatabase code.

Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp (219734 => 219735)


--- trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp	2017-07-21 19:39:57 UTC (rev 219735)
@@ -173,7 +173,7 @@
     return scriptValue ? scriptValue : jsUndefined();
 }
 
-String CommandLineAPIHost::databaseId(Database* database)
+String CommandLineAPIHost::databaseId(Database& database)
 {
     if (m_databaseAgent)
         return m_databaseAgent->databaseId(database);
@@ -180,7 +180,7 @@
     return { };
 }
 
-String CommandLineAPIHost::storageId(Storage* storage)
+String CommandLineAPIHost::storageId(Storage& storage)
 {
     if (m_domStorageAgent)
         return m_domStorageAgent->storageId(storage);

Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.h (219734 => 219735)


--- trunk/Source/WebCore/inspector/CommandLineAPIHost.h	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.h	2017-07-21 19:39:57 UTC (rev 219735)
@@ -99,8 +99,8 @@
     using EventListenersRecord = Vector<WTF::KeyValuePair<String, Vector<ListenerEntry>>>;
     EventListenersRecord getEventListeners(JSC::ExecState&, Node*);
 
-    String databaseId(Database*);
-    String storageId(Storage*);
+    String databaseId(Database&);
+    String storageId(Storage&);
 
     JSC::JSValue wrapper(JSC::ExecState*, JSDOMGlobalObject*);
     void clearAllWrappers();

Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.idl (219734 => 219735)


--- trunk/Source/WebCore/inspector/CommandLineAPIHost.idl	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.idl	2017-07-21 19:39:57 UTC (rev 219735)
@@ -42,8 +42,8 @@
 
     [CallWith=ScriptState] record<DOMString, sequence<ListenerEntry>> getEventListeners(Node? node);
 
-    DOMString databaseId(Database? database);
-    DOMString storageId(Storage? storage);
+    DOMString databaseId(Database database);
+    DOMString storageId(Storage storage);
 };
 
 [

Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp (219734 => 219735)


--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp	2017-07-21 19:39:57 UTC (rev 219735)
@@ -139,15 +139,14 @@
     storageArea->removeItem(frame, key);
 }
 
-String InspectorDOMStorageAgent::storageId(Storage* storage)
+String InspectorDOMStorageAgent::storageId(Storage& storage)
 {
-    ASSERT(storage);
-    Document* document = storage->frame()->document();
+    Document* document = storage.frame()->document();
     ASSERT(document);
     DOMWindow* window = document->domWindow();
     ASSERT(window);
     Ref<SecurityOrigin> securityOrigin = document->securityOrigin();
-    bool isLocalStorage = window->optionalLocalStorage() == storage;
+    bool isLocalStorage = window->optionalLocalStorage() == &storage;
     return storageId(securityOrigin.ptr(), isLocalStorage)->toJSONString();
 }
 

Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h (219734 => 219735)


--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h	2017-07-21 19:39:57 UTC (rev 219735)
@@ -65,7 +65,7 @@
     void removeDOMStorageItem(ErrorString&, const Inspector::InspectorObject& storageId, const String& key) override;
 
     // Called from the injected script.
-    String storageId(Storage*);
+    String storageId(Storage&);
     RefPtr<Inspector::Protocol::DOMStorage::StorageId> storageId(SecurityOrigin*, bool isLocalStorage);
 
     // InspectorInstrumentation

Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp (219734 => 219735)


--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp	2017-07-21 19:39:57 UTC (rev 219735)
@@ -273,10 +273,10 @@
         TransactionSuccessCallback::create());
 }
 
-String InspectorDatabaseAgent::databaseId(Database* database)
+String InspectorDatabaseAgent::databaseId(Database& database)
 {
     for (auto& resource : m_resources) {
-        if (resource.value->database() == database)
+        if (resource.value->database() == &database)
             return resource.key;
     }
     return String();

Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h (219734 => 219735)


--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h	2017-07-21 19:39:57 UTC (rev 219735)
@@ -60,7 +60,7 @@
     void executeSQL(ErrorString&, const String& databaseId, const String& query, Ref<ExecuteSQLCallback>&&) override;
 
     // Called from the injected script.
-    String databaseId(Database*);
+    String databaseId(Database&);
 
     void didOpenDatabase(RefPtr<Database>&&, const String& domain, const String& name, const String& version);
 private:

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (219734 => 219735)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2017-07-21 19:39:57 UTC (rev 219735)
@@ -362,12 +362,9 @@
 }
 #endif
 
-void InspectorFrontendHost::showContextMenu(Event* event, Vector<ContextMenuItem>&& items)
+void InspectorFrontendHost::showContextMenu(Event& event, Vector<ContextMenuItem>&& items)
 {
 #if ENABLE(CONTEXT_MENUS)
-    if (!event)
-        return;
-
     ASSERT(m_frontendPage);
     auto& state = *execStateFromPage(debuggerWorld(), m_frontendPage);
     JSC::JSObject* frontendApiObject;
@@ -381,7 +378,7 @@
 
     auto menuProvider = FrontendMenuProvider::create(this, { &state, frontendApiObject }, menu.items());
     m_menuProvider = menuProvider.ptr();
-    m_frontendPage->contextMenuController().showContextMenu(*event, menuProvider);
+    m_frontendPage->contextMenuController().showContextMenu(event, menuProvider);
 #else
     UNUSED_PARAM(event);
     UNUSED_PARAM(items);
@@ -388,17 +385,17 @@
 #endif
 }
 
-void InspectorFrontendHost::dispatchEventAsContextMenuEvent(Event* event)
+void InspectorFrontendHost::dispatchEventAsContextMenuEvent(Event& event)
 {
 #if ENABLE(CONTEXT_MENUS) && USE(ACCESSIBILITY_CONTEXT_MENUS)
     if (!is<MouseEvent>(event))
         return;
 
-    Frame* frame = event->target()->toNode()->document().frame();
-    MouseEvent& mouseEvent = downcast<MouseEvent>(*event);
-    IntPoint mousePoint = IntPoint(mouseEvent.clientX(), mouseEvent.clientY());
+    auto& mouseEvent = downcast<MouseEvent>(event);
+    IntPoint mousePoint { mouseEvent.clientX(), mouseEvent.clientY() };
+    auto& frame = *mouseEvent.target()->toNode()->document().frame();
 
-    m_frontendPage->contextMenuController().showContextMenuAt(*frame, mousePoint);
+    m_frontendPage->contextMenuController().showContextMenuAt(frame, mousePoint);
 #else
     UNUSED_PARAM(event);
 #endif

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (219734 => 219735)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2017-07-21 19:39:57 UTC (rev 219735)
@@ -92,10 +92,10 @@
         std::optional<bool> checked;
         std::optional<Vector<ContextMenuItem>> subItems;
     };
-    void showContextMenu(Event*, Vector<ContextMenuItem>&&);
+    void showContextMenu(Event&, Vector<ContextMenuItem>&&);
 
     void sendMessageToBackend(const String& message);
-    void dispatchEventAsContextMenuEvent(Event*);
+    void dispatchEventAsContextMenuEvent(Event&);
 
     bool isUnderTest();
     void unbufferedLog(const String& message);

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (219734 => 219735)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2017-07-21 19:36:40 UTC (rev 219734)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2017-07-21 19:39:57 UTC (rev 219735)
@@ -68,8 +68,8 @@
     DOMString platform();
     DOMString port();
 
-    void showContextMenu(Event? event, sequence<ContextMenuItem> items);
-    void dispatchEventAsContextMenuEvent(Event? event);
+    void showContextMenu(Event event, sequence<ContextMenuItem> items);
+    void dispatchEventAsContextMenuEvent(Event event);
     void sendMessageToBackend(DOMString message);
     void unbufferedLog(DOMString message);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to