bug 1351604 - don't ship DER.jsm and X509.jsm until they're actually used in production r?Cykesiopka draft
authorDavid Keeler <dkeeler@mozilla.com>
Thu, 30 Mar 2017 11:00:54 -0700
changeset 554560 8b75cc006d0ce4761774f9ec2125050f6a5494c3
parent 554473 5bd82c644e1fdc15b92ca9e34b31841151b44957
child 622382 3e8a9eaf80e5659e1450c5c3349ca7dc0679972b
push id51984
push userbmo:dkeeler@mozilla.com
push dateFri, 31 Mar 2017 22:25:54 +0000
reviewersCykesiopka
bugs1351604
milestone55.0a1
bug 1351604 - don't ship DER.jsm and X509.jsm until they're actually used in production r?Cykesiopka MozReview-Commit-ID: 2DlMrB5TfKU
CLOBBER
browser/base/content/test/static/browser_all_files_referenced.js
security/manager/ssl/X509.jsm
security/manager/ssl/moz.build
security/manager/ssl/tests/unit/test_der.js
security/manager/ssl/tests/unit/test_x509.js
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 1337331 - Required because of removed cc files like security/sandbox/chromium/base/threading/platform_thread_linux.cc
+Bug 1351604 - required because DER.jsm and X509.jsm are no longer shipped with the browser
--- a/browser/base/content/test/static/browser_all_files_referenced.js
+++ b/browser/base/content/test/static/browser_all_files_referenced.js
@@ -252,18 +252,16 @@ var whitelist = new Set([
   // Bug 1351093
   {file: "resource://gre/modules/Sntp.jsm"},
   // Bug 1351980
   {file: "resource://gre/modules/UserAgentOverrides.jsm"},
   // Bug 1351097
   {file: "resource://gre/modules/accessibility/AccessFu.jsm"},
   // Bug 1351099
   {file: "resource://gre/modules/addons/AddonLogging.jsm"},
-  // Bug 1351604
-  {file: "resource://gre/modules/psm/X509.jsm"},
   // Bug 1351637
   {file: "resource://gre/modules/sdk/bootstrap.js"},
   // Bug 1351657
   {file: "resource://gre/res/langGroups.properties", platforms: ["macosx"]},
 
 ].filter(item =>
   ("isFromDevTools" in item) == isDevtools &&
   (!item.platforms || item.platforms.includes(AppConstants.platform))
--- a/security/manager/ssl/X509.jsm
+++ b/security/manager/ssl/X509.jsm
@@ -1,16 +1,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/. */
 
 "use strict";
 
 const Cu = Components.utils;
-var { DER } = Cu.import("resource://gre/modules/psm/DER.jsm", {});
+// Until DER.jsm is actually used in production code, this is where we have to
+// import it from.
+var { DER } = Cu.import("resource://testing-common/psm/DER.jsm", {});
 
 const ERROR_UNSUPPORTED_ASN1 = "unsupported asn.1";
 const ERROR_TIME_NOT_VALID = "Time not valid";
 const ERROR_LIBRARY_FAILURE = "library failure";
 
 const X509v3 = 2;
 
 /**
--- a/security/manager/ssl/moz.build
+++ b/security/manager/ssl/moz.build
@@ -50,17 +50,19 @@ XPIDL_SOURCES += [
 
 if CONFIG['MOZ_XUL']:
     XPIDL_SOURCES += [
         'nsICertTree.idl',
     ]
 
 XPIDL_MODULE = 'pipnss'
 
-EXTRA_JS_MODULES.psm += [
+# These aren't actually used in production code yet, so we don't want to
+# ship them with the browser.
+TESTING_JS_MODULES.psm += [
     'DER.jsm',
     'X509.jsm',
 ]
 
 EXPORTS += [
     'CryptoTask.h',
     'nsClientAuthRemember.h',
     'nsCrypto.h',
--- a/security/manager/ssl/tests/unit/test_der.js
+++ b/security/manager/ssl/tests/unit/test_der.js
@@ -1,16 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Tests DER.jsm functionality.
 
-var { DER } = Cu.import("resource://gre/modules/psm/DER.jsm", {});
+// Until DER.jsm is actually used in production code, this is where we have to
+// import it from.
+var { DER } = Cu.import("resource://testing-common/psm/DER.jsm", {});
 
 function run_simple_tests() {
   throws(() => new DER.DER("this is not an array"), /invalid input/,
          "should throw given non-array input");
   throws(() => new DER.DER([0, "invalid input", 1]), /invalid input/,
          "should throw given non-byte data (string case)");
   throws(() => new DER.DER([31, 1, {}]), /invalid input/,
          "should throw given non-byte data (object case)");
--- a/security/manager/ssl/tests/unit/test_x509.js
+++ b/security/manager/ssl/tests/unit/test_x509.js
@@ -1,16 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Tests X509.jsm functionality.
 
-var { X509 } = Cu.import("resource://gre/modules/psm/X509.jsm", {});
+// Until X509.jsm is actually used in production code, this is where we have to
+// import it from.
+var { X509 } = Cu.import("resource://testing-common/psm/X509.jsm", {});
 
 function stringToBytes(s) {
   let b = [];
   for (let i = 0; i < s.length; i++) {
     b.push(s.charCodeAt(i));
   }
   return b;
 }