Bug 1350646: Part 11 - Remove SDK stylesheet modules. r=Mossop
authorKris Maglione <maglione.k@gmail.com>
Sat, 05 Aug 2017 21:38:01 -0700
changeset 373709 3580317211c8b92c14f7bb340a8bc8fe031f2c31
parent 373708 2f69296ecc585d12425b124923e85ab0f6970fbe
child 373710 da41fb3ea7a667c7b04888e917f29de84d7a73db
push id93584
push usermaglione.k@gmail.com
push dateThu, 10 Aug 2017 03:41:19 +0000
treeherdermozilla-inbound@24d5dbf3a9dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1350646
milestone57.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 1350646: Part 11 - Remove SDK stylesheet modules. r=Mossop MozReview-Commit-ID: BwWPklao5iS
addon-sdk/moz.build
addon-sdk/source/lib/sdk/stylesheet/style.js
addon-sdk/source/lib/sdk/stylesheet/utils.js
--- a/addon-sdk/moz.build
+++ b/addon-sdk/moz.build
@@ -33,28 +33,25 @@ modules = [
     'sdk/addon/window.js',
     'sdk/base64.js',
     'sdk/browser/events.js',
     'sdk/clipboard.js',
     'sdk/console/plain-text.js',
     'sdk/console/traceback.js',
     'sdk/content/events.js',
     'sdk/content/loader.js',
-    'sdk/content/mod.js',
     'sdk/content/thumbnail.js',
-    'sdk/content/utils.js',
     'sdk/core/disposable.js',
     'sdk/core/heritage.js',
     'sdk/core/namespace.js',
     'sdk/core/observer.js',
     'sdk/core/promise.js',
     'sdk/core/reference.js',
     'sdk/deprecated/api-utils.js',
     'sdk/deprecated/events/assembler.js',
-    'sdk/deprecated/sync-worker.js',
     'sdk/deprecated/unit-test-finder.js',
     'sdk/deprecated/unit-test.js',
     'sdk/deprecated/window-utils.js',
     'sdk/dom/events-shimmed.js',
     'sdk/dom/events.js',
     'sdk/event/chrome.js',
     'sdk/event/core.js',
     'sdk/event/dom.js',
@@ -70,17 +67,16 @@ modules = [
     'sdk/io/stream.js',
     'sdk/io/text-streams.js',
     'sdk/lang/functional.js',
     'sdk/lang/functional/concurrent.js',
     'sdk/lang/functional/core.js',
     'sdk/lang/functional/helpers.js',
     'sdk/lang/type.js',
     'sdk/lang/weak-set.js',
-    'sdk/loader/sandbox.js',
     'sdk/messaging.js',
     'sdk/model/core.js',
     'sdk/net/url.js',
     'sdk/net/xhr.js',
     'sdk/notifications.js',
     'sdk/output/system.js',
     'sdk/passwords.js',
     'sdk/passwords/utils.js',
@@ -90,18 +86,16 @@ modules = [
     'sdk/preferences/utils.js',
     'sdk/private-browsing.js',
     'sdk/private-browsing/utils.js',
     'sdk/querystring.js',
     'sdk/request.js',
     'sdk/self.js',
     'sdk/simple-prefs.js',
     'sdk/simple-storage.js',
-    'sdk/stylesheet/style.js',
-    'sdk/stylesheet/utils.js',
     'sdk/system.js',
     'sdk/system/environment.js',
     'sdk/system/events-shimmed.js',
     'sdk/system/events.js',
     'sdk/system/globals.js',
     'sdk/system/process.js',
     'sdk/system/runtime.js',
     'sdk/system/unload.js',
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/stylesheet/style.js
+++ /dev/null
@@ -1,69 +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/. */
-"use strict";
-
-module.metadata = {
-  "stability": "experimental"
-};
-
-const { Class } = require("../core/heritage");
-lazyRequire(this, "../url", "isLocalURL");
-lazyRequire(this, "./utils", "loadSheet", "removeSheet", "isTypeValid");
-lazyRequire(this, "../lang/type", "isString");
-const { attachTo, detachFrom } = require("../content/mod");
-lazyRequire(this, '../self', "data");
-
-const { freeze, create } = Object;
-
-function Style({ source, uri, type }) {
-  source = source == null ? null : freeze([].concat(source));
-  uri = uri == null ? null : freeze([].concat(uri));
-  type = type == null ? "author" : type;
-
-  if (source && !source.every(isString))
-    throw new Error('Style.source must be a string or an array of strings.');
-
-  if (uri && !uri.every(isLocalURL))
-    throw new Error('Style.uri must be a local URL or an array of local URLs');
-
-  if (type && !isTypeValid(type))
-    throw new Error('Style.type must be "agent", "user" or "author"');
-
-  return freeze(create(Style.prototype, {
-    "source": { value: source, enumerable: true },
-    "uri": { value: uri, enumerable: true },
-    "type": { value: type, enumerable: true }
-  }));
-};
-
-exports.Style = Style;
-
-attachTo.define(Style, function (style, window) {
-  if (style.uri) {
-    for (let uri of style.uri)
-      loadSheet(window, data.url(uri), style.type);
-  }
-
-  if (style.source) {
-    let uri = "data:text/css;charset=utf-8,";
-
-    uri += encodeURIComponent(style.source.join(""));
-
-    loadSheet(window, uri, style.type);
-  }
-});
-
-detachFrom.define(Style, function (style, window) {
-  if (style.uri)
-    for (let uri of style.uri)
-      removeSheet(window, data.url(uri));
-
-  if (style.source) {
-    let uri = "data:text/css;charset=utf-8,";
-
-    uri += encodeURIComponent(style.source.join(""));
-
-    removeSheet(window, uri, style.type);
-  }
-});
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/stylesheet/utils.js
+++ /dev/null
@@ -1,75 +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/. */
-"use strict";
-
-module.metadata =  {
-  "stability": "experimental"
-};
-
-const { Ci } = require("chrome");
-
-const SHEET_TYPE = {
-  "agent": "AGENT_SHEET",
-  "user": "USER_SHEET",
-  "author": "AUTHOR_SHEET"
-};
-
-function getDOMWindowUtils(window) {
-  return window.QueryInterface(Ci.nsIInterfaceRequestor).
-                getInterface(Ci.nsIDOMWindowUtils);
-};
-
-/**
- * Synchronously loads a style sheet from `uri` and adds it to the list of
- * additional style sheets of the document.
- * The sheets added takes effect immediately, and only on the document of the
- * `window` given.
- */
-function loadSheet(window, url, type) {
-  if (!(type && type in SHEET_TYPE))
-    type = "author";
-
-  type = SHEET_TYPE[type];
-
-  if (url instanceof Ci.nsIURI)
-    url = url.spec;
-
-  let winUtils = getDOMWindowUtils(window);
-  try {
-    winUtils.loadSheetUsingURIString(url, winUtils[type]);
-  }
-  catch (e) {};
-};
-exports.loadSheet = loadSheet;
-
-/**
- * Remove the document style sheet at `sheetURI` from the list of additional
- * style sheets of the document.  The removal takes effect immediately.
- */
-function removeSheet(window, url, type) {
-  if (!(type && type in SHEET_TYPE))
-    type = "author";
-
-  type = SHEET_TYPE[type];
-
-  if (url instanceof Ci.nsIURI)
-    url = url.spec;
-
-  let winUtils = getDOMWindowUtils(window);
-
-  try {
-    winUtils.removeSheetUsingURIString(url, winUtils[type]);
-  }
-  catch (e) {};
-};
-exports.removeSheet = removeSheet;
-
-/**
- * Returns `true` if the `type` given is valid, otherwise `false`.
- * The values currently accepted are: "agent", "user" and "author".
- */
-function isTypeValid(type) {
-  return type in SHEET_TYPE;
-}
-exports.isTypeValid = isTypeValid;