Bug 1299500 - Get rid of DeviceStorage API - part 1 - DeviceStorageAreaChangedEvent, r=ehsan a=gchang
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 08 Mar 2017 20:15:44 +0100
changeset 395380 f53f7fbff21d9ffc63ea9ecbe7ac31e1059532dc
parent 395379 7145a7655e18e809812776f4b5511df35a9138f4
child 395381 e2612175b358a4a5c24f6cb511b55ca41f810233
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, gchang
bugs1299500
milestone54.0a2
Bug 1299500 - Get rid of DeviceStorage API - part 1 - DeviceStorageAreaChangedEvent, r=ehsan a=gchang
dom/devicestorage/DeviceStorageAreaListener.cpp
dom/events/test/test_all_synthetic_events.html
dom/tests/mochitest/general/test_interfaces.js
dom/webidl/DeviceStorageAreaChangedEvent.webidl
dom/webidl/moz.build
--- a/dom/devicestorage/DeviceStorageAreaListener.cpp
+++ b/dom/devicestorage/DeviceStorageAreaListener.cpp
@@ -127,28 +127,15 @@ DeviceStorageAreaListener::DispatchStora
     return;
   }
   if (iter != mStorageAreaStateMap.end() &&
       iter->second == aOperation) {
     // No need to disptach the event if the state is unchanged.
     return;
   }
 
-  DeviceStorageAreaChangedEventInit init;
-  init.mOperation = aOperation;
-  init.mStorageName = aStorageName;
-
-  RefPtr<DeviceStorageAreaChangedEvent> event =
-    DeviceStorageAreaChangedEvent::Constructor(this,
-                                               NS_LITERAL_STRING("storageareachanged"),
-                                               init);
-  event->SetTrusted(true);
-
   mStorageAreaStateMap[aStorageName] = aOperation;
 
   nsDOMDeviceStorage::InvalidateVolumeCaches();
-
-  bool ignore;
-  DOMEventTargetHelper::DispatchEvent(event, &ignore);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -111,20 +111,16 @@ const kEventConstructors = {
   DeviceOrientationEvent:                    { create: function (aName, aProps) {
                                                          return new DeviceOrientationEvent(aName, aProps);
                                                        },
                                              },
   DeviceProximityEvent:                      { create: function (aName, aProps) {
                                                          return new DeviceProximityEvent(aName, aProps);
                                                        },
                                              },
-  DeviceStorageAreaChangedEvent:             { create: function (aName, aProps) {
-                                                         return new DeviceStorageAreaChangedEvent(aName, aProps);
-                                                       },
-                                             },
   DeviceStorageChangeEvent:                  { create: function (aName, aProps) {
                                                          return new DeviceStorageChangeEvent(aName, aProps);
                                                        },
                                              },
   DownloadEvent:                             { create: function (aName, aProps) {
                                                          return new DownloadEvent(aName, aProps);
                                                        },
                                              },
--- a/dom/tests/mochitest/general/test_interfaces.js
+++ b/dom/tests/mochitest/general/test_interfaces.js
@@ -277,18 +277,16 @@ var interfaceNamesInGlobalScope =
     "DeviceLightEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DeviceMotionEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DeviceOrientationEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "DeviceProximityEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    { name: "DeviceStorageAreaChangedEvent", desktop: false},
-// IMPORTANT: Do not change this list without review from a DOM peer!
     { name: "DeviceStorageAreaListener", desktop: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     { name: "DeviceStorage", desktop: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     { name: "DeviceStorageChangeEvent", desktop: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "Directory",
 // IMPORTANT: Do not change this list without review from a DOM peer!
deleted file mode 100644
--- a/dom/webidl/DeviceStorageAreaChangedEvent.webidl
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-enum DeviceStorageAreaChangedEventOperation {
-  "added",
-  "removed",
-  "unknown"
-};
-
-/*
- * For the EventHandler - onstorageareachanged, new event is introduced and called
- * DeviceStorageAreaChangedEvent.
- * The attribute - operation indicates that there is a storage area has been
- * added or removed.
- * 1. If a storage area is added, then the 'storageName' attribute will contain the
- * name of the storage area. To access this new storage area, a user needs to pass
- * storageName to navigator.getDeviceStorageByNameAndType to get a DeviceStorage object.
- * 2. If a storage area is removed, then the 'storageName' attribute indicates
- * which storage area was removed.
- */
-[Pref="device.storage.enabled",
- Constructor(DOMString type, optional DeviceStorageAreaChangedEventInit eventInitDict)]
-interface DeviceStorageAreaChangedEvent : Event {
-  readonly attribute DeviceStorageAreaChangedEventOperation operation;
-  readonly attribute DOMString                              storageName;
-};
-
-dictionary DeviceStorageAreaChangedEventInit : EventInit {
-  DeviceStorageAreaChangedEventOperation operation = "unknown";
-  DOMString                              storageName = "";
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -1062,17 +1062,16 @@ GENERATED_EVENTS_WEBIDL_FILES = [
     'AnimationPlaybackEvent.webidl',
     'AutocompleteErrorEvent.webidl',
     'BlobEvent.webidl',
     'CaretStateChangedEvent.webidl',
     'CloseEvent.webidl',
     'DeviceLightEvent.webidl',
     'DeviceOrientationEvent.webidl',
     'DeviceProximityEvent.webidl',
-    'DeviceStorageAreaChangedEvent.webidl',
     'DeviceStorageChangeEvent.webidl',
     'ErrorEvent.webidl',
     'FontFaceSetLoadEvent.webidl',
     'GamepadAxisMoveEvent.webidl',
     'GamepadButtonEvent.webidl',
     'GamepadEvent.webidl',
     'GroupedHistoryEvent.webidl',
     'HashChangeEvent.webidl',