Bug 1374847 - Remove nsIPrefBranch2 and nsIPrefBranchInternal. r?njn draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 04 Aug 2017 17:12:58 +0900
changeset 641041 0752391f9ced0e0a1d1dc3e4be1e7b00461d6dee
parent 641040 d86be805002e1490955bf3d4676261a6bdf0f8ed
child 641051 358ea89e767b3c59356e7d77f33af992dd531b44
push id72412
push userVYV03354@nifty.ne.jp
push dateSat, 05 Aug 2017 00:49:20 +0000
reviewersnjn
bugs1374847
milestone57.0a1
Bug 1374847 - Remove nsIPrefBranch2 and nsIPrefBranchInternal. r?njn MozReview-Commit-ID: 2LFhKNVspko
addon-sdk/source/lib/sdk/addon/runner.js
addon-sdk/source/lib/sdk/preferences/event-target.js
devtools/client/commandline/test/browser_cmd_pref1.js
devtools/client/commandline/test/browser_cmd_pref2.js
devtools/client/commandline/test/browser_cmd_pref3.js
devtools/client/commandline/test/browser_cmd_settings.js
devtools/client/shared/developer-toolbar.js
devtools/shared/gcli/commands/cmd.js
devtools/shared/gcli/source/lib/gcli/index.js
devtools/shared/gcli/source/lib/gcli/settings.js
modules/libpref/Preferences.cpp
modules/libpref/Preferences.h
modules/libpref/moz.build
modules/libpref/nsIPrefBranch2.idl
modules/libpref/nsIPrefBranchInternal.idl
modules/libpref/nsPrefBranch.cpp
modules/libpref/nsPrefBranch.h
toolkit/content/widgets/preferences.xml
--- a/addon-sdk/source/lib/sdk/addon/runner.js
+++ b/addon-sdk/source/lib/sdk/addon/runner.js
@@ -23,17 +23,17 @@ XPCOMUtils.defineLazyGetter(this, "DevTo
   return Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {}).
          DevToolsShim;
 });
 
 // Initializes default preferences
 function setDefaultPrefs(prefsURI) {
   const prefs = Cc['@mozilla.org/preferences-service;1'].
                 getService(Ci.nsIPrefService).
-                QueryInterface(Ci.nsIPrefBranch2);
+                QueryInterface(Ci.nsIPrefBranch);
   const branch = prefs.getDefaultBranch('');
   const sandbox = Sandbox({
     name: prefsURI,
     prototype: {
       pref: function(key, val) {
         switch (typeof val) {
           case 'boolean':
             branch.setBoolPref(key, val);
--- a/addon-sdk/source/lib/sdk/preferences/event-target.js
+++ b/addon-sdk/source/lib/sdk/preferences/event-target.js
@@ -21,17 +21,17 @@ const PrefsTarget = Class({
   initialize: function(options) {
     options = options || {};
     EventTarget.prototype.initialize.call(this, options);
 
     let branchName = options.branchName || '';
     let branch = Cc["@mozilla.org/preferences-service;1"].
         getService(Ci.nsIPrefService).
         getBranch(branchName).
-        QueryInterface(Ci.nsIPrefBranch2);
+        QueryInterface(Ci.nsIPrefBranch);
     prefTargetNS(this).branch = branch;
 
     // provides easy access to preference values
     this.prefs = Branch(branchName);
 
     // start listening to preference changes
     let observer = prefTargetNS(this).observer = onChange.bind(this);
     branch.addObserver('', observer);
--- a/devtools/client/commandline/test/browser_cmd_pref1.js
+++ b/devtools/client/commandline/test/browser_cmd_pref1.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the pref commands work
 
 var prefBranch = Cc["@mozilla.org/preferences-service;1"]
                     .getService(Ci.nsIPrefService).getBranch(null)
-                    .QueryInterface(Ci.nsIPrefBranch2);
+                    .QueryInterface(Ci.nsIPrefBranch);
 
 const TEST_URI = "data:text/html;charset=utf-8,gcli-pref1";
 
 function test() {
   return Task.spawn(spawnTest).then(finish, helpers.handleError);
 }
 
 function* spawnTest() {
--- a/devtools/client/commandline/test/browser_cmd_pref2.js
+++ b/devtools/client/commandline/test/browser_cmd_pref2.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the pref commands work
 
 var prefBranch = Cc["@mozilla.org/preferences-service;1"]
                     .getService(Ci.nsIPrefService).getBranch(null)
-                    .QueryInterface(Ci.nsIPrefBranch2);
+                    .QueryInterface(Ci.nsIPrefBranch);
 
 const TEST_URI = "data:text/html;charset=utf-8,gcli-pref2";
 
 function test() {
   return Task.spawn(spawnTest).then(finish, helpers.handleError);
 }
 
 function* spawnTest() {
--- a/devtools/client/commandline/test/browser_cmd_pref3.js
+++ b/devtools/client/commandline/test/browser_cmd_pref3.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the pref commands work
 
 var prefBranch = Cc["@mozilla.org/preferences-service;1"]
                     .getService(Ci.nsIPrefService).getBranch(null)
-                    .QueryInterface(Ci.nsIPrefBranch2);
+                    .QueryInterface(Ci.nsIPrefBranch);
 
 var supportsString = Cc["@mozilla.org/supports-string;1"]
                       .createInstance(Ci.nsISupportsString);
 
 const TEST_URI = "data:text/html;charset=utf-8,gcli-pref3";
 
 function test() {
   return Task.spawn(spawnTest).then(finish, helpers.handleError);
--- a/devtools/client/commandline/test/browser_cmd_settings.js
+++ b/devtools/client/commandline/test/browser_cmd_settings.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Tests that the pref commands work
 
 var prefBranch = Cc["@mozilla.org/preferences-service;1"]
                     .getService(Ci.nsIPrefService).getBranch(null)
-                    .QueryInterface(Ci.nsIPrefBranch2);
+                    .QueryInterface(Ci.nsIPrefBranch);
 
 var supportsString = Cc["@mozilla.org/supports-string;1"]
                       .createInstance(Ci.nsISupportsString);
 
 const TEST_URI = "data:text/html;charset=utf-8,gcli-settings";
 
 function test() {
   return Task.spawn(spawnTest).then(finish, helpers.handleError);
--- a/devtools/client/shared/developer-toolbar.js
+++ b/devtools/client/shared/developer-toolbar.js
@@ -15,17 +15,17 @@ const L10N = new LocalizationHelper("dev
 const {Task} = require("devtools/shared/task");
 
 const NS_XHTML = "http://www.w3.org/1999/xhtml";
 
 const { PluralForm } = require("devtools/shared/plural-form");
 
 loader.lazyGetter(this, "prefBranch", function () {
   return Services.prefs.getBranch(null)
-                    .QueryInterface(Ci.nsIPrefBranch2);
+                    .QueryInterface(Ci.nsIPrefBranch);
 });
 
 loader.lazyRequireGetter(this, "gcliInit", "devtools/shared/gcli/commands/index");
 loader.lazyRequireGetter(this, "util", "gcli/util/util");
 loader.lazyRequireGetter(this, "ConsoleServiceListener", "devtools/server/actors/utils/webconsole-listeners", true);
 loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
 loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
 loader.lazyRequireGetter(this, "nodeConstants", "devtools/shared/dom-node-constants");
--- a/devtools/shared/gcli/commands/cmd.js
+++ b/devtools/shared/gcli/commands/cmd.js
@@ -9,17 +9,17 @@ const { OS } = Cu.import("resource://gre
 const { Task } = require("devtools/shared/task");
 
 const gcli = require("gcli/index");
 const l10n = require("gcli/l10n");
 
 loader.lazyGetter(this, "prefBranch", function () {
   let prefService = Cc["@mozilla.org/preferences-service;1"]
                       .getService(Ci.nsIPrefService);
-  return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
+  return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch);
 });
 
 loader.lazyImporter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
 
 const PREF_DIR = "devtools.commands.dir";
 
 /**
  * Load all the .mozcmd files in the directory pointed to by PREF_DIR
--- a/devtools/shared/gcli/source/lib/gcli/index.js
+++ b/devtools/shared/gcli/source/lib/gcli/index.js
@@ -17,13 +17,13 @@
 'use strict';
 
 var Cc = require('chrome').Cc;
 var Ci = require('chrome').Ci;
 
 
 var prefSvc = Cc['@mozilla.org/preferences-service;1']
                         .getService(Ci.nsIPrefService);
-var prefBranch = prefSvc.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
+var prefBranch = prefSvc.getBranch(null).QueryInterface(Ci.nsIPrefBranch);
 
 exports.hiddenByChromePref = function() {
   return !prefBranch.prefHasUserValue('devtools.chrome.enabled');
 };
--- a/devtools/shared/gcli/source/lib/gcli/settings.js
+++ b/devtools/shared/gcli/source/lib/gcli/settings.js
@@ -23,17 +23,17 @@ var Ci = require('chrome').Ci;
 var Cu = require('chrome').Cu;
 
 var XPCOMUtils = Cu.import('resource://gre/modules/XPCOMUtils.jsm', {}).XPCOMUtils;
 var Services = require("Services");
 
 XPCOMUtils.defineLazyGetter(imports, 'prefBranch', function() {
   var prefService = Cc['@mozilla.org/preferences-service;1']
           .getService(Ci.nsIPrefService);
-  return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
+  return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch);
 });
 
 XPCOMUtils.defineLazyGetter(imports, 'supportsString', function() {
   return Cc['@mozilla.org/supports-string;1']
           .createInstance(Ci.nsISupportsString);
 });
 
 var util = require('./util/util');
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -714,18 +714,16 @@ Preferences::~Preferences()
 NS_IMPL_ADDREF(Preferences)
 NS_IMPL_RELEASE(Preferences)
 
 NS_INTERFACE_MAP_BEGIN(Preferences)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefService)
     NS_INTERFACE_MAP_ENTRY(nsIPrefService)
     NS_INTERFACE_MAP_ENTRY(nsIObserver)
     NS_INTERFACE_MAP_ENTRY(nsIPrefBranch)
-    NS_INTERFACE_MAP_ENTRY(nsIPrefBranch2)
-    NS_INTERFACE_MAP_ENTRY(nsIPrefBranchInternal)
     NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
 /*
  * nsIPrefService Implementation
  */
 
 InfallibleTArray<Preferences::PrefSetting>* gInitPrefs;
--- a/modules/libpref/Preferences.h
+++ b/modules/libpref/Preferences.h
@@ -7,17 +7,16 @@
 #define mozilla_Preferences_h
 
 #ifndef MOZILLA_INTERNAL_API
 #error "This header is only usable from within libxul (MOZILLA_INTERNAL_API)."
 #endif
 
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranchInternal.h"
 #include "nsIObserver.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsWeakReference.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/MemoryReporting.h"
 
 class nsIFile;
@@ -44,17 +43,17 @@ enum pref_initPhase {
 namespace mozilla {
 
 namespace dom {
 class PrefSetting;
 } // namespace dom
 
 class Preferences final : public nsIPrefService,
                           public nsIObserver,
-                          public nsIPrefBranchInternal,
+                          public nsIPrefBranch,
                           public nsSupportsWeakReference
 {
 public:
   typedef mozilla::dom::PrefSetting PrefSetting;
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPREFSERVICE
   NS_FORWARD_NSIPREFBRANCH(sRootBranch->)
--- a/modules/libpref/moz.build
+++ b/modules/libpref/moz.build
@@ -12,18 +12,16 @@ if CONFIG['ENABLE_TESTS']:
 
 XPCSHELL_TESTS_MANIFESTS += [
     'test/unit/xpcshell.ini',
     'test/unit_ipc/xpcshell.ini',
 ]
 
 XPIDL_SOURCES += [
     'nsIPrefBranch.idl',
-    'nsIPrefBranch2.idl',
-    'nsIPrefBranchInternal.idl',
     'nsIPrefLocalizedString.idl',
     'nsIPrefService.idl',
     'nsIRelativeFilePref.idl',
 ]
 
 XPIDL_MODULE = 'pref'
 
 EXPORTS.mozilla += [
deleted file mode 100644
--- a/modules/libpref/nsIPrefBranch2.idl
+++ /dev/null
@@ -1,16 +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/. */
-
-#include "nsIPrefBranch.idl"
-
-/**
- * An empty interface to provide backwards compatibility for existing code.
- *
- * @see nsIPrefBranch
- */
-[scriptable, uuid(8892016d-07f7-4530-b5c1-d73dfcde4a1c)]
-interface nsIPrefBranch2 : nsIPrefBranch
-{
-};
deleted file mode 100644
--- a/modules/libpref/nsIPrefBranchInternal.idl
+++ /dev/null
@@ -1,17 +0,0 @@
-/* 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 "nsIPrefBranch2.idl"
-
-/**
- * An empty interface to provide backwards compatibility for existing code that
- * bsmedberg didn't want to break all at once. Don't use me!
- *
- * @status NON-FROZEN interface WHICH WILL PROBABLY GO AWAY.
- */
-
-[scriptable, uuid(355bd1e9-248a-438b-809d-e0db1b287882)]
-interface nsIPrefBranchInternal : nsIPrefBranch2
-{
-};
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -98,18 +98,16 @@ nsPrefBranch::~nsPrefBranch()
  */
 
 NS_IMPL_ADDREF(nsPrefBranch)
 NS_IMPL_RELEASE(nsPrefBranch)
 
 NS_INTERFACE_MAP_BEGIN(nsPrefBranch)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefBranch)
   NS_INTERFACE_MAP_ENTRY(nsIPrefBranch)
-  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIPrefBranch2, !mIsDefault)
-  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIPrefBranchInternal, !mIsDefault)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
 
 /*
  * nsIPrefBranch Implementation
  */
--- a/modules/libpref/nsPrefBranch.h
+++ b/modules/libpref/nsPrefBranch.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsPrefBranch_h
 #define nsPrefBranch_h
 
 #include "nsCOMPtr.h"
 #include "nsIObserver.h"
 #include "nsIPrefBranch.h"
-#include "nsIPrefBranchInternal.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIRelativeFilePref.h"
 #include "nsIFile.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsWeakReference.h"
@@ -171,25 +170,24 @@ class PrefCallback : public PLDHashEntry
     nsISupports          *mCanonical;
 
     bool IsWeak() const
     {
       return !!mWeakRef;
     }
 };
 
-class nsPrefBranch final : public nsIPrefBranchInternal,
+class nsPrefBranch final : public nsIPrefBranch,
                            public nsIObserver,
                            public nsSupportsWeakReference
 {
   friend class mozilla::PreferenceServiceReporter;
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPREFBRANCH
-  NS_DECL_NSIPREFBRANCH2
   NS_DECL_NSIOBSERVER
 
   nsPrefBranch(const char *aPrefRoot, bool aDefaultBranch);
   nsPrefBranch() = delete;
 
   int32_t GetRootLength() const { return mPrefRoot.Length(); }
 
   nsresult RemoveObserverFromMap(const char *aDomain, nsISupports *aObserver);
--- a/toolkit/content/widgets/preferences.xml
+++ b/toolkit/content/widgets/preferences.xml
@@ -89,17 +89,17 @@
         Components.classes["@mozilla.org/preferences-service;1"]
                   .getService(Components.interfaces.nsIPrefBranch);
       </field>
       <field name="defaultBranch">
         this.service.getDefaultBranch("");
       </field>
       <field name="rootBranchInternal">
         Components.classes["@mozilla.org/preferences-service;1"]
-                  .getService(Components.interfaces.nsIPrefBranchInternal);
+                  .getService(Components.interfaces.nsIPrefBranch);
       </field>
       <property name="type" readonly="true">
         <getter>
           <![CDATA[
             return document.documentElement.type || "";
           ]]>
         </getter>
       </property>