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
var proto = Element.prototype; | |
var slice = Function.call.bind(Array.prototype.slice); | |
var matches = Function.call.bind(proto.matchesSelector || | |
proto.mozMatchesSelector || proto.webkitMatchesSelector || | |
proto.msMatchesSelector || proto.oMatchesSelector); | |
// Returns true if a DOM Element matches a cssRule | |
var elementMatchCSSRule = function(element, cssRule) { | |
return matches(element, cssRule.selectorText); | |
}; |
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
let { events: windowEvents } = require('sdk/window/events'); | |
let { on } = require('sdk/event/core'); | |
let { filter } = require('sdk/event/utils'); | |
let ready = filter(windowEvents, ({type}) => type === 'DOMContentLoaded'); | |
let certificateWindows = filter(ready, ({target}) => | |
target.document.documentElement.mozMatchesSelector('dialog#certDetails')); | |
on(certificateWindows, 'data', ({target: window}) => { |
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
<!doctype html> | |
<html> | |
<div> | |
<button>click A</button> | |
<button>click B</button> | |
</div> | |
<output></output> | |
<script> | |
let buttons = document.querySelector("div"); | |
let output = document.querySelector("output"); |
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
diff --git a/lib/sdk/deprecated/unit-test-finder.js b/lib/sdk/deprecated/unit-test-finder.js | |
index 0d13265..c2268d5 100644 | |
--- a/lib/sdk/deprecated/unit-test-finder.js | |
+++ b/lib/sdk/deprecated/unit-test-finder.js | |
@@ -55,8 +55,20 @@ TestFinder.prototype = { | |
function(suite) { | |
// Load each test file as a main module in its own loader instance | |
// `suite` is defined by cuddlefish/manifest.py:ManifestBuilder.build | |
- var loader = Loader(module); | |
- var module = cuddlefish.main(loader, suite); |
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
let { Button } = require("sdk/ui"); | |
let button = Button({ | |
id: "my-button", | |
// assuming automatically `data` folder for "./" | |
image: "./beer.png", | |
// required as tooltip and overflow | |
label: "My Button", | |
type: "checked" | |
}); |
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
let cm = require("sdk/context-menu"); | |
let item = cm.Item({ | |
label: "My Menu Item", | |
context: cm.SelectionContext() | |
}); | |
require("sdk/selection").on("select", function(){ | |
item.label = this.text | |
}) |
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
// main.js | |
PageMod({ | |
onAttach: function(worker) { | |
worker.addEventListener("message", function(event){ | |
if (event.origin === "good.com") // page script | |
event.source.postMessage(event.data + " addon!", "good.com"); | |
else if(event.origin === worker.origin) // content script | |
event.source.postMessage("content script, hello!", worker.origin); | |
}); |
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
function RulersHighlighter2(highlighterEnv) { | |
CanvasHighlighter.call(this, highlighterEnv); | |
} | |
RulersHighlighter2.prototype = extend(CanvasHighlighter.prototype, { | |
typeName: "RulersHighlighter", | |
textStep: 100, | |
graduationStep: 5, | |
stepScale: 1, |
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
JPM [info] Starting jpm test on addon-sdk | |
Creating XPI | |
JPM [info] XPI created at /var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/@addon-sdk-0.1.18.xpi (1173ms) | |
Created XPI at /var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/@addon-sdk-0.1.18.xpi | |
JPM [info] Creating a new profile | |
Shumway is registered | |
Running tests on Firefox 42.0a1/Gecko 42.0a1 (Build 20150805030208) ({ec8030f7-c20a-464f-9b0e-13a3a9e97384}) under darwin/x86_64. | |
console.error: addon-sdk: | |
JPM [error] Message: TypeError: FakeCu is not a constructor | |
Stack: |
NewerOlder