Bug 982460 - privileged-request-sans-event. r=spenrose
authorJed Parsons <jedp@mozilla.com>
Tue, 22 Apr 2014 14:16:39 -0700
changeset 199301 4f69b95c714fdac4d9c70146aac90801e157e13b
parent 199300 20eb244eae3b9ac3fe504ca6e4fe4bf5b02c676c
child 199302 0930742ce5c6e9c2ee97ef7e8037cbd7c7c853c0
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspenrose
bugs982460
milestone31.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 982460 - privileged-request-sans-event. r=spenrose
dom/identity/nsDOMIdentity.js
dom/identity/tests/mochitest/file_syntheticEvents.html
dom/identity/tests/mochitest/test_syntheticEvents.html
--- a/dom/identity/nsDOMIdentity.js
+++ b/dom/identity/nsDOMIdentity.js
@@ -164,24 +164,23 @@ nsDOMIdentity.prototype = {
     }
 
     let util = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
 
     let message = this.DOMIdentityMessage(aOptions);
 
     // We permit calling of request() outside of a user input handler only when
-    // we are handling the (deprecated) get() or getVerifiedEmail() calls,
-    // which make use of an RP context marked as _internal, or when a certified
-    // app is calling.
-    //
-    // XXX Bug 982460 - grant the same privilege to packaged apps
+    // a certified or privileged app is calling, or when we are handling the
+    // (deprecated) get() or getVerifiedEmail() calls, which make use of an RP
+    // context marked as _internal.
 
     if (!aOptions._internal &&
-        this._appStatus !== Ci.nsIPrincipal.APP_STATUS_CERTIFIED) {
+        this._appStatus !== Ci.nsIPrincipal.APP_STATUS_CERTIFIED &&
+        this._appStatus !== Ci.nsIPrincipal.APP_STATUS_PRIVILEGED) {
 
       // If the caller is not special in one of those ways, see if the user has
       // preffed on 'syntheticEventsOk' (useful for testing); otherwise, if
       // this is a non-native event, reject it.
       let util = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
                              .getInterface(Ci.nsIDOMWindowUtils);
 
       if (!util.isHandlingUserInput && this.nativeEventsRequired) {
--- a/dom/identity/tests/mochitest/file_syntheticEvents.html
+++ b/dom/identity/tests/mochitest/file_syntheticEvents.html
@@ -2,17 +2,18 @@
   * 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/. */
  -->
 <!DOCTYPE html>
 <html>
   <!--
   Certified and privileged apps can call mozId outside an event handler
-  https://bugzilla.mozilla.org/show_bug.cgi?id=971379
+  Certified apps:  https://bugzilla.mozilla.org/show_bug.cgi?id=971379
+  Privileged apps: https://bugzilla.mozilla.org/show_bug.cgi?id=982460
   -->
 <head>
   <meta charset="utf-8">
   <title>Test app for bug 971379</title>
 </head>
 
 <body>
     <div id='test'>
--- a/dom/identity/tests/mochitest/test_syntheticEvents.html
+++ b/dom/identity/tests/mochitest/test_syntheticEvents.html
@@ -89,26 +89,23 @@ let apps = [
     expected: {
       success: false,
       errors: [
         "ERROR_NOT_AUTHORIZED_FOR_FIREFOX_ACCOUNTS",
       ],
     },
   },
   {
-    title: "a privileged app, which may not use synthetic events (until bug 982460 lands)",
+    title: "a privileged app, which may use synthetic events",
     manifest: "https://example.com/manifest_priv.webapp",
     origin: "https://example.com",
     uri: "https://example.com/chrome/dom/identity/tests/mochitest/file_syntheticEvents.html",
     wantIssuer: "firefox-accounts",
     expected: {
-      success: false,
-      errors: [
-        "ERROR_REQUEST_WHILE_NOT_HANDLING_USER_INPUT",
-      ],
+      success: true,
     },
   },
   {
     title: "a certified app, which may use synthetic events",
     manifest: "https://example.com/manifest_cert.webapp",
     origin: "https://example.com",
     uri: "https://example.com/chrome/dom/identity/tests/mochitest/file_syntheticEvents.html",
     wantIssuer: "firefox-accounts",