Bug 1456324: Part 2 - Mark infallible nsIPluginTag getters as infallible. r=Gijs
authorKris Maglione <maglione.k@gmail.com>
Tue, 24 Apr 2018 15:04:11 -0700
changeset 469196 cbcb2bea294230c9dcd3edc67b5728a9ae1d9f75
parent 469195 3a593e7961a2d230a729bd9060d2c83ea7ae86e9
child 469197 95b7f4ae23fdaf6d806ffac8a402e5f043dbd1c5
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1456324
milestone61.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 1456324: Part 2 - Mark infallible nsIPluginTag getters as infallible. r=Gijs MozReview-Commit-ID: B7fkZVeDfJZ
dom/plugins/base/nsIPluginTag.idl
dom/plugins/base/nsPluginHost.cpp
--- a/dom/plugins/base/nsIPluginTag.idl
+++ b/dom/plugins/base/nsIPluginTag.idl
@@ -2,17 +2,17 @@
 /* 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 "nsISupports.idl"
 
 interface nsIURI;
 
-[scriptable, uuid(5daa99d5-265a-4397-b429-c943803e2619)]
+[builtinclass, scriptable, uuid(5daa99d5-265a-4397-b429-c943803e2619)]
 interface nsIPluginTag : nsISupports
 {
   // enabledState is stored as one of the following as an integer in prefs,
   // so if new states are added, they must not renumber the existing states.
   const unsigned long STATE_DISABLED = 0;
   const unsigned long STATE_CLICKTOPLAY = 1;
   const unsigned long STATE_ENABLED = 2;
 
@@ -25,31 +25,38 @@ interface nsIPluginTag : nsISupports
   // The 'nice' name of this plugin, e.g. 'flash' 'java'
   readonly attribute AUTF8String niceName;
 
   /**
    * true only if this plugin is "hardblocked" and cannot be enabled.
    */
   // FIXME-jsplugins QI to fakePluginTag possible
   // FIXME-jsplugins implement missing + tests (whatever that means)
+  [infallible]
   readonly attribute boolean blocklisted;
 
   /**
    * true if the state is non-default and locked, false otherwise.
    */
+  [infallible]
   readonly attribute boolean isEnabledStateLocked;
 
   // If this plugin is capable of being used (not disabled, blocklisted, etc)
+  [infallible]
   readonly attribute boolean active;
 
   // Get a specific nsIBlocklistService::STATE_*
+  [infallible]
   readonly attribute unsigned long blocklistState;
 
+  [infallible]
   readonly attribute boolean disabled;
+  [infallible]
   readonly attribute boolean clicktoplay;
+  [infallible]
   readonly attribute boolean loaded;
   // See the STATE_* values above.
            attribute unsigned long enabledState;
 
   readonly attribute PRTime lastModifiedTime;
 
   void getMimeTypes([optional] out unsigned long aCount,
                     [retval, array, size_is(aCount)] out wstring aResults);
@@ -61,17 +68,17 @@ interface nsIPluginTag : nsISupports
                      out wstring aResults);
 };
 
 /**
  * An interface representing a "fake" plugin: one implemented in JavaScript, not
  * as a NPAPI plug-in.  See nsIPluginHost.registerFakePlugin and the
  * documentation for the FakePluginTagInit dictionary.
  */
-[scriptable, uuid(6d22c968-226d-4156-b230-da6ad6bbf6e8)]
+[builtinclass, scriptable, uuid(6d22c968-226d-4156-b230-da6ad6bbf6e8)]
 interface nsIFakePluginTag : nsIPluginTag
 {
   /**
    * The URI that should be loaded into the tag (as a frame) to handle the
    * plugin. Note that the original data/src value for the plugin is not loaded
    * and will need to be requested by the handler via XHR or similar if desired.
    */
   readonly attribute nsIURI handlerURI;
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -300,18 +300,17 @@ class BlocklistPromiseHandler final : pu
         MOZ_ASSERT(false, "Blocklist should always return int32");
         return;
       }
       int32_t newState = aValue.toInt32();
       MOZ_ASSERT(newState >= 0 && newState < nsIBlocklistService::STATE_MAX,
         "Shouldn't get an out of bounds blocklist state");
 
       // Check the old and new state and see if there was a change:
-      uint32_t oldState = nsIBlocklistService::STATE_NOT_BLOCKED;
-      MOZ_ALWAYS_SUCCEEDS(mTag->GetBlocklistState(&oldState));
+      uint32_t oldState = mTag->GetBlocklistState();
       bool changed = oldState != (uint32_t)newState;
       mTag->SetBlocklistState(newState);
 
       if (newState == nsIBlocklistService::STATE_SOFTBLOCKED && mShouldDisableWhenSoftblocked) {
         mTag->SetEnabledState(nsIPluginTag::STATE_DISABLED);
         changed = true;
       }
       sPluginBlocklistStatesChangedSinceLastWrite |= changed;