Skip to content

Instantly share code, notes, and snippets.

View darkowlzz's full-sized avatar

Sunny darkowlzz

  • ‏‏‏‏‎ ‎
View GitHub Profile
var sec = document.body.id;
$('ul#nav-main-menu > li').each(function( index ) {
if ($(this).text().toUpperCase() == sec.toUpperCase()) {
$('#nav-main-menu [tabindex=0]').get(index).focus();
}
});
let chromeWindow = open('chrome://foo/content/');
assert.ok(~windows().indexOf(chromeWindow), 'chrome URI works');
let resourceWindow = open('resource://foo');
assert.ok(~windows().indexOf(resourceWindow), 'resource URI works');
// Wait for the window unload before ending test
close(chromeWindow).close(resourceWindow).then(done);
let { promise } = require('sdk/window/helpers');
console.log("foo1");
promise(open('chrome://foo/content/'), 'load').then(function(window) {
console.log("foo2");
assert.ok(~windows().indexOf(window), 'chrome URI works');
console.log("foo3");
return window; // pass window to next function
}).then(close).
then(promise.bind(null, 'resource://foo', 'load')).then(function(window) {
assert.ok(~windows().indexOf(window), 'resource URI works');
exports['test new top window with content URI'] = function(assert) {
let msg = 'only chrome, resource and data uris are allowed';
assert.throws(function () {
open('foo');
}, msg);
assert.throws(function () {
open('http://foo');
}, msg);
assert.throws(function () {
open('https://foo');
/* 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': 'unstable'
};
const { Cc, Ci } = require('chrome');
258 let labelledItemRules = mix(baseItemRules, {
259 label: {
260 map: stringOrNull,
261 is: ["string"],
262 ok: function (v) !!v,
263 msg: "The item must have a non-empty string label."
264 },
265 image: {
266 map: stringOrNull,
267 is: ["string", "undefined", "null"],
let Histogram = {
hgramSamplesCaption: bundle.GetStringFromName("histogramSamples"),
hgramAverageCaption: bundle.GetStringFromName("histogramAverage"),
hgramSumCaption: bundle.GetStringFromName("histogramSum"),
hgramCopyCaption: bundle.GetStringFromName("histogramCopy"),
/* 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/. */
const { setTimeout } = require('sdk/timers');
const utils = require('sdk/lang/functional');
const { invoke, defer, curry, partial, compose, memoize, once, delay, wrap } = utils;
const deprecate = require('sdk/util/deprecate');
const { LoaderWithHookedConsole } = require('sdk/test/loader');
/* 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/. */
const { setTimeout } = require('sdk/timers');
const utils = require('sdk/lang/functional');
const { invoke, defer, curry, compose, memoize, once, delay, wrap } = utils;
exports['test forwardApply'] = function(assert) {
function sum(b, c) this.a + b + c
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pebblemerchant;
/**
*
* @author sunny
*/