Bug 1003095 - Refactor css-logic to be require friendly;r=past

This commit is contained in:
Eddy Bruel 2014-05-30 16:43:05 +02:00
parent 0a8a7fcd69
commit 16067dcdb8
2 changed files with 11 additions and 8 deletions

View File

@ -38,7 +38,9 @@
* @constructor
*/
const {Cc, Ci, Cu} = require("chrome");
const { Cc, Ci, Cu } = require("chrome");
const Services = require("Services");
const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
const RX_UNIVERSAL_SELECTOR = /\s*\*\s*/g;
const RX_NOT = /:not\((.*?)\)/g;
@ -48,9 +50,11 @@ const RX_ID = /\s*#\w+\s*/g;
const RX_CLASS_OR_ATTRIBUTE = /\s*(?:\.\w+|\[.+?\])\s*/g;
const RX_PSEUDO = /\s*:?:([\w-]+)(\(?\)?)\s*/g;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.importGlobalProperties(['CSS']);
// This should be ok because none of the functions that use this should be used
// on the worker thread, where Cu is not available.
if (Cu) {
Cu.importGlobalProperties(['CSS']);
}
function CssLogic()
{
@ -730,8 +734,8 @@ CssLogic.getSelectors = function CssLogic_getSelectors(aDOMRule)
*/
CssLogic.l10n = function(aName) CssLogic._strings.GetStringFromName(aName);
XPCOMUtils.defineLazyGetter(CssLogic, "_strings", function() Services.strings
.createBundle("chrome://global/locale/devtools/styleinspector.properties"));
DevToolsUtils.defineLazyGetter(CssLogic, "_strings", function() Services.strings
.createBundle("chrome://global/locale/devtools/styleinspector.properties"));
/**
* Is the given property sheet a content stylesheet?
@ -1801,6 +1805,6 @@ CssSelectorInfo.prototype = {
},
};
XPCOMUtils.defineLazyGetter(this, "domUtils", function() {
DevToolsUtils.defineLazyGetter(this, "domUtils", function() {
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
});

View File

@ -104,7 +104,6 @@ function createModule(id) {
let chromeWhitelist = [
"devtools/toolkit/DevToolsUtils",
"devtools/toolkit/event-emitter",
"devtools/styleinspector/css-logic",
];
// Create a CommonJS loader with the following options: