forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1139189: Uplift the Add-on SDK to Firefox a=me
https://github.com/mozilla/addon-sdk/compare/3fbf5a6bdd6b2bfff3b916d9431fc4deab83f4a2..3394ad5d1d3eaa8e27ceea9b448ae39fa5cba0d9 --HG-- rename : addon-sdk/source/test/addons/l10n/locale/en-GB.properties => addon-sdk/source/test/addons/e10s-l10n/locale/en.properties rename : addon-sdk/source/test/addons/l10n/locale/en-GB.properties => addon-sdk/source/test/addons/l10n/locale/en.properties extra : rebase_source : f29b067cf47279b79946d01c510e52780798a64f
- Loading branch information
Showing
108 changed files
with
4,842 additions
and
853 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file modified
0
addon-sdk/source/bin/integration-scripts/buildbot-run-cfx-helper
100755 → 100644
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file modified
0
addon-sdk/source/examples/library-detector/data/icons/closure.ico
100755 → 100644
Empty file.
Empty file modified
0
addon-sdk/source/examples/library-detector/data/icons/jquery.ico
100755 → 100644
Empty file.
Empty file modified
0
addon-sdk/source/examples/library-detector/data/icons/jquery_ui.ico
100755 → 100644
Empty file.
Empty file modified
0
addon-sdk/source/examples/library-detector/data/icons/modernizr.ico
100755 → 100644
Empty file.
Empty file modified
0
addon-sdk/source/examples/library-detector/data/icons/mootools.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file modified
0
addon-sdk/source/examples/library-detector/data/library-detector.js
100755 → 100644
Empty file.
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- 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/. --> | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* 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/. */ | ||
|
||
#devtools-theme-box { | ||
background-color: red !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* 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 { Tool } = require("dev/toolbox"); | ||
const { Class } = require("sdk/core/heritage"); | ||
const { onEnable, onDisable } = require("dev/theme/hooks"); | ||
const { Theme, LightTheme } = require("dev/theme"); | ||
|
||
/** | ||
* This object represents a new theme registered within the Toolbox. | ||
* You can activate it by clicking on "My Light Theme" theme option | ||
* in the Options panel. | ||
* Note that the new theme derives styles from built-in Light theme. | ||
*/ | ||
const MyTheme = Theme({ | ||
name: "mytheme", | ||
label: "My Light Theme", | ||
styles: [LightTheme, "./theme.css"], | ||
|
||
onEnable: function(window, oldTheme) { | ||
console.log("myTheme.onEnable; method override " + | ||
window.location.href); | ||
}, | ||
onDisable: function(window, newTheme) { | ||
console.log("myTheme.onDisable; method override " + | ||
window.location.href); | ||
}, | ||
}); | ||
|
||
// Registration | ||
|
||
const mytheme = new Tool({ | ||
name: "My Tool", | ||
themes: { mytheme: MyTheme } | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "theme", | ||
"title": "theme", | ||
"id": "theme@jetpack", | ||
"description": "How to create new theme for devtools", | ||
"author": "Jan Odvarko", | ||
"license": "MPL 2.0", | ||
"version": "0.1.0", | ||
"main": "lib/main" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* 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"; | ||
|
||
exports.testMain = function(assert) { | ||
assert.pass("TODO: Write some tests."); | ||
}; | ||
|
||
require("sdk/test").run(exports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* 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("../sdk/core/heritage"); | ||
const { EventTarget } = require("../sdk/event/target"); | ||
const { Disposable, setup, dispose } = require("../sdk/core/disposable"); | ||
const { contract, validate } = require("../sdk/util/contract"); | ||
const { id: addonID } = require("../sdk/self"); | ||
const { onEnable, onDisable } = require("dev/theme/hooks"); | ||
const { isString, instanceOf, isFunction } = require("sdk/lang/type"); | ||
const { add } = require("sdk/util/array"); | ||
const { data } = require("../sdk/self"); | ||
const { isLocalURL } = require("../sdk/url"); | ||
|
||
const makeID = name => | ||
("dev-theme-" + addonID + (name ? "-" + name : "")). | ||
split(/[ . /]/).join("-"). | ||
replace(/[^A-Za-z0-9_\-]/g, ""); | ||
|
||
const Theme = Class({ | ||
extends: Disposable, | ||
implements: [EventTarget], | ||
|
||
initialize: function(options) { | ||
this.name = options.name; | ||
this.label = options.label; | ||
this.styles = options.styles; | ||
|
||
// Event handlers | ||
this.onEnable = options.onEnable; | ||
this.onDisable = options.onDisable; | ||
}, | ||
get id() { | ||
return makeID(this.name || this.label); | ||
}, | ||
setup: function() { | ||
// Any initialization steps done at the registration time. | ||
}, | ||
getStyles: function() { | ||
if (!this.styles) { | ||
return []; | ||
} | ||
|
||
if (isString(this.styles)) { | ||
if (isLocalURL(this.styles)) { | ||
return [data.url(this.styles)]; | ||
} | ||
} | ||
|
||
let result = []; | ||
for (let style of this.styles) { | ||
if (isString(style)) { | ||
if (isLocalURL(style)) { | ||
style = data.url(style); | ||
} | ||
add(result, style); | ||
} else if (instanceOf(style, Theme)) { | ||
result = result.concat(style.getStyles()); | ||
} | ||
} | ||
return result; | ||
}, | ||
getClassList: function() { | ||
let result = []; | ||
for (let style of this.styles) { | ||
if (instanceOf(style, Theme)) { | ||
result = result.concat(style.getClassList()); | ||
} | ||
} | ||
|
||
if (this.name) { | ||
add(result, this.name); | ||
} | ||
|
||
return result; | ||
} | ||
}); | ||
|
||
exports.Theme = Theme; | ||
|
||
// Initialization & dispose | ||
|
||
setup.define(Theme, (theme) => { | ||
theme.classList = []; | ||
theme.setup(); | ||
}); | ||
|
||
dispose.define(Theme, function(theme) { | ||
theme.dispose(); | ||
}); | ||
|
||
// Validation | ||
|
||
validate.define(Theme, contract({ | ||
label: { | ||
is: ["string"], | ||
msg: "The `option.label` must be a provided" | ||
}, | ||
})); | ||
|
||
// Support theme events: apply and unapply the theme. | ||
|
||
onEnable.define(Theme, (theme, {window, oldTheme}) => { | ||
if (isFunction(theme.onEnable)) { | ||
theme.onEnable(window, oldTheme); | ||
} | ||
}); | ||
|
||
onDisable.define(Theme, (theme, {window, newTheme}) => { | ||
if (isFunction(theme.onDisable)) { | ||
theme.onDisable(window, newTheme); | ||
} | ||
}); | ||
|
||
// Support for built-in themes | ||
|
||
const LightTheme = Theme({ | ||
name: "theme-light", | ||
styles: "chrome://browser/skin/devtools/light-theme.css", | ||
}); | ||
|
||
const DarkTheme = Theme({ | ||
name: "theme-dark", | ||
styles: "chrome://browser/skin/devtools/dark-theme.css", | ||
}); | ||
|
||
exports.LightTheme = LightTheme; | ||
exports.DarkTheme = DarkTheme; |
Oops, something went wrong.