Bug 1372276 - Part 2: Remove onshow HTML Event; r?bz draft
authorGordon P. Hemsley <gphemsley@gmail.com>
Sat, 29 Jul 2017 03:47:19 -0400
changeset 618197 60e629d4f6b7a2ccc01d24f1f69ac47a2b7dcf4e
parent 618196 06a3ac5234e2c3ea1b2df4f4e52d710fbb1f50c2
child 618198 dbd69656c41b73ec0e0e78924474dd3d3068f4e2
push id71235
push userbmo:gphemsley@gphemsley.org
push dateSun, 30 Jul 2017 14:44:40 +0000
reviewersbz
bugs1372276
milestone56.0a1
Bug 1372276 - Part 2: Remove onshow HTML Event; r?bz MozReview-Commit-ID: 6qXZHOvHeLf
dom/html/HTMLMenuElement.cpp
dom/html/HTMLMenuElement.h
dom/webidl/EventHandler.webidl
dom/webidl/HTMLMenuElement.webidl
testing/web-platform/meta/html/browsers/the-window-object/security-window/window-security.html.ini
testing/web-platform/meta/html/browsers/the-window-object/window-properties.html.ini
testing/web-platform/meta/html/semantics/interactive-elements/contextmenu-historical.html.ini
--- a/dom/html/HTMLMenuElement.cpp
+++ b/dom/html/HTMLMenuElement.cpp
@@ -61,39 +61,16 @@ NS_IMPL_ISUPPORTS_INHERITED(HTMLMenuElem
 NS_IMPL_ELEMENT_CLONE(HTMLMenuElement)
 
 NS_IMPL_BOOL_ATTR(HTMLMenuElement, Compact, compact)
 NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMenuElement, Type, type,
                                 kMenuDefaultType->tag)
 NS_IMPL_STRING_ATTR(HTMLMenuElement, Label, label)
 
 
-void
-HTMLMenuElement::SendShowEvent()
-{
-  nsCOMPtr<nsIDocument> document = GetComposedDoc();
-  if (!document) {
-    return;
-  }
-
-  WidgetEvent event(true, eShow);
-  event.mFlags.mBubbles = false;
-  event.mFlags.mCancelable = false;
-
-  nsCOMPtr<nsIPresShell> shell = document->GetShell();
-  if (!shell) {
-    return;
-  }
-
-  RefPtr<nsPresContext> presContext = shell->GetPresContext();
-  nsEventStatus status = nsEventStatus_eIgnore;
-  EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
-                            &event, nullptr, &status);
-}
-
 already_AddRefed<nsIMenuBuilder>
 HTMLMenuElement::CreateBuilder()
 {
   if (mType != MENU_TYPE_CONTEXT) {
     return nullptr;
   }
 
   nsCOMPtr<nsIMenuBuilder> builder = do_CreateInstance(HTMLMENUBUILDER_CONTRACTID);
--- a/dom/html/HTMLMenuElement.h
+++ b/dom/html/HTMLMenuElement.h
@@ -62,18 +62,16 @@ public:
   {
     return GetBoolAttr(nsGkAtoms::compact);
   }
   void SetCompact(bool aCompact, ErrorResult& aError)
   {
     SetHTMLBoolAttr(nsGkAtoms::compact, aCompact, aError);
   }
 
-  void SendShowEvent();
-
   already_AddRefed<nsIMenuBuilder> CreateBuilder();
 
   void Build(nsIMenuBuilder* aBuilder);
 
 protected:
   virtual ~HTMLMenuElement();
 
   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
--- a/dom/webidl/EventHandler.webidl
+++ b/dom/webidl/EventHandler.webidl
@@ -75,17 +75,16 @@ interface GlobalEventHandlers {
            attribute EventHandler onprogress;
            attribute EventHandler onratechange;
            attribute EventHandler onreset;
            attribute EventHandler onresize;
            attribute EventHandler onscroll;
            attribute EventHandler onseeked;
            attribute EventHandler onseeking;
            attribute EventHandler onselect;
-           attribute EventHandler onshow;
            //(Not implemented)attribute EventHandler onsort;
            attribute EventHandler onstalled;
            attribute EventHandler onsubmit;
            attribute EventHandler onsuspend;
            attribute EventHandler ontimeupdate;
            attribute EventHandler onvolumechange;
            attribute EventHandler onwaiting;
 
--- a/dom/webidl/HTMLMenuElement.webidl
+++ b/dom/webidl/HTMLMenuElement.webidl
@@ -27,24 +27,16 @@ interface HTMLMenuElement : HTMLElement 
 partial interface HTMLMenuElement {
            [CEReactions, SetterThrows]
            attribute boolean compact;
 };
 
 // Mozilla specific stuff
 partial interface HTMLMenuElement {
   /**
-   * Creates and dispatches a trusted event named "show".
-   * The event is not cancelable and does not bubble.
-   * See http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus
-   */
-  [ChromeOnly]
-  void sendShowEvent();
-
-  /**
    * Creates a native menu builder. The builder type is dependent on menu type.
    * Currently, it returns the @mozilla.org/content/html-menu-builder;1
    * component. Toolbar menus are not yet supported (the method returns null).
    */
   [ChromeOnly]
   MenuBuilder? createBuilder();
 
   /*
--- a/testing/web-platform/meta/html/browsers/the-window-object/security-window/window-security.html.ini
+++ b/testing/web-platform/meta/html/browsers/the-window-object/security-window/window-security.html.ini
@@ -4,8 +4,11 @@
     expected: FAIL
 
   [A SecurityError exception must be thrown when window.oncuechange is accessed from a different origin.]
     expected: FAIL
 
   [A SecurityError exception must be thrown when window.onmousewheel is accessed from a different origin.]
     expected: FAIL
 
+  [A SecurityError exception must be thrown when window.onshow is accessed from a different origin.]
+    expected: FAIL
+
--- a/testing/web-platform/meta/html/browsers/the-window-object/window-properties.html.ini
+++ b/testing/web-platform/meta/html/browsers/the-window-object/window-properties.html.ini
@@ -4,8 +4,11 @@
     expected: FAIL
 
   [Window attribute: oncuechange]
     expected: FAIL
 
   [Window attribute: onmousewheel]
     expected: FAIL
 
+  [Window attribute: onshow]
+    expected: FAIL
+
--- a/testing/web-platform/meta/html/semantics/interactive-elements/contextmenu-historical.html.ini
+++ b/testing/web-platform/meta/html/semantics/interactive-elements/contextmenu-historical.html.ini
@@ -1,15 +1,15 @@
 [contextmenu-historical.html]
   type: testharness
   [HTMLMenuItemElement must not be not present]
     expected: FAIL
 
   [onshow must not be present on the GlobalEventHandlers locations]
-    expected: FAIL
+    expected: PASS
 
   [el.contextMenu must not be present]
     expected: PASS
 
   [menu.type must not exist or reflect the content attribute]
     expected: FAIL
 
   [menu.label must not exist or reflect the content attribute]