Backed out changeset b78a97800675 (bug 1105827)
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 11 Aug 2015 10:04:35 -0700
changeset 291590 44204bf72cbfda72113fe91e017fface0d029170
parent 291589 059f102b3567aba630b95833c7f9f4c737f95a1f
child 291591 7b6f60b570c212adbefff135e9a8308280174359
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1105827
milestone43.0a1
backs outb78a97800675cda35b9ac81d4b535b185001c197
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
Backed out changeset b78a97800675 (bug 1105827)
dom/permission/PermissionStatus.cpp
dom/permission/PermissionStatus.h
dom/permission/tests/test_permissions_api.html
--- a/dom/permission/PermissionStatus.cpp
+++ b/dom/permission/PermissionStatus.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "mozilla/dom/PermissionStatus.h"
 
-#include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/Services.h"
 #include "mozilla/UniquePtr.h"
 #include "nsIPermissionManager.h"
 #include "PermissionObserver.h"
 #include "PermissionUtils.h"
 
 namespace mozilla {
 namespace dom {
@@ -109,22 +108,10 @@ PermissionStatus::GetPrincipal() const
   nsIDocument* doc = window->GetExtantDoc();
   if (NS_WARN_IF(!doc)) {
     return nullptr;
   }
 
   return doc->NodePrincipal();
 }
 
-void
-PermissionStatus::PermissionChanged()
-{
-  auto oldState = mState;
-  UpdateState();
-  if (mState != oldState) {
-    nsRefPtr<AsyncEventDispatcher> eventDispatcher =
-      new AsyncEventDispatcher(this, NS_LITERAL_STRING("change"), false);
-    eventDispatcher->PostDOMEvent();
-  }
-}
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/permission/PermissionStatus.h
+++ b/dom/permission/PermissionStatus.h
@@ -39,17 +39,17 @@ private:
   PermissionStatus(nsPIDOMWindow* aWindow, PermissionName aName);
 
   nsresult Init();
 
   nsresult UpdateState();
 
   nsIPrincipal* GetPrincipal() const;
 
-  void PermissionChanged();
+  void PermissionChanged() {}
 
   PermissionName mName;
   PermissionState mState;
 
   nsRefPtr<PermissionObserver> mObserver;
 };
 
 } // namespace dom
--- a/dom/permission/tests/test_permissions_api.html
+++ b/dom/permission/tests/test_permissions_api.html
@@ -63,63 +63,30 @@ function checkUnsupportedPermissions() {
 }
 
 function checkUserVisiblePushPermission() {
   return navigator.permissions.query({ name: 'push', userVisible: true }).then(
     result => ok(false, `query should not have resolved for userVisible push`),
     error => ok(true, `query should have rejected for userVisible push`));
 }
 
-function promiseStateChanged(state) {
-  return Promise.all(PERMISSIONS.map(x => {
-    return navigator.permissions.query({ name: x.name }).then(
-      result => {
-        return new Promise((resolve, reject) => {
-          result.onchange = () => {
-            result.onchange = null;
-            is(result.state, state, `state correctly changed for '${x.name}'`);
-            resolve();
-          };
-        });
-      },
-      error => ok(false, `query should not have rejected for '${x.name}'`));
-  }));
-}
-
-function testStatusOnChange() {
-  return new Promise((resolve, reject) => {
-    SpecialPowers.popPermissions(() => {
-      let permMgr = SpecialPowers.Ci.nsIPermissionManager;
-
-      let promiseGranted = promiseStateChanged('granted');
-      setPermissions(permMgr.ALLOW_ACTION);
-      promiseGranted.then(() => {
-        let promisePrompt = promiseStateChanged('prompt');
-        SpecialPowers.popPermissions();
-        return promisePrompt;
-      }).then(resolve);
-    });
-  });
-}
-
 function runTests() {
   let permMgr = SpecialPowers.Ci.nsIPermissionManager;
 
   setup()
     .then(checkUnsupportedPermissions)
     .then(checkUserVisiblePushPermission)
     .then(() => setPermissions(permMgr.UNKNOWN_ACTION))
     .then(() => checkPermissions('prompt'))
     .then(() => setPermissions(permMgr.PROMPT_ACTION))
     .then(() => checkPermissions('prompt'))
     .then(() => setPermissions(permMgr.ALLOW_ACTION))
     .then(() => checkPermissions('granted'))
     .then(() => setPermissions(permMgr.DENY_ACTION))
     .then(() => checkPermissions('denied'))
-    .then(testStatusOnChange)
     .then(SimpleTest.finish)
     .catch ((e) => {
       ok(false, 'Unexpected error ' + e);
       SimpleTest.finish();
     });
 }
 </script>
 </pre>