Bug 1299500 - Get rid of DeviceStorage API - part 1 - DeviceStorageAreaChangedEvent, r=ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 08 Mar 2017 20:15:44 +0100
changeset 346609 92606f748fcb41826443bf226c824929b5c39100
parent 346608 ec475e2b19154c4b1c3fa06365bdfc669bb6d05d
child 346610 41cbf92cfad2d34768272a5a4dedf9758d92a5a4
push id31472
push userkwierso@gmail.com
push dateThu, 09 Mar 2017 01:08:10 +0000
treeherdermozilla-central@19289cc8bf6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1299500
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1299500 - Get rid of DeviceStorage API - part 1 - DeviceStorageAreaChangedEvent, r=ehsan
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
@@ -1063,17 +1063,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',