merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-03-17 11:00:17 +01:00
commit f298917442
658 changed files with 10333 additions and 2302 deletions

View File

@ -43,7 +43,7 @@ LOCAL_INCLUDES += [
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
CFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']

View File

@ -73,10 +73,11 @@ LOCAL_INCLUDES += [
'/layout/xul/tree/',
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'/accessible/windows/ia2',
@ -93,7 +94,4 @@ else:
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_ENABLE_GTK']:
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
include('/ipc/chromium/chromium-config.mozbuild')

View File

@ -36,7 +36,7 @@ LOCAL_INCLUDES += [
'/layout/xul',
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]

View File

@ -24,7 +24,7 @@ LOCAL_INCLUDES += [
'/layout/xul',
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]

View File

@ -27,7 +27,7 @@ if CONFIG['ACCESSIBILITY']:
'../xpcom',
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]

View File

@ -6,7 +6,7 @@
toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in toolkit:
DIRS += ['atk']
elif toolkit == 'windows':
DIRS += ['windows']

View File

@ -33,7 +33,7 @@ LOCAL_INCLUDES += [
'/accessible/generic',
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]

View File

@ -29,7 +29,7 @@ LOCAL_INCLUDES += [
'/layout/xul/tree',
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]

View File

@ -17,8 +17,7 @@ def B2GBranding():
'disk.icns',
'dsstore',
]
if CONFIG['MOZ_WIDGET_GTK']:
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
BRANDING_FILES += [
'default.png',
]

21
b2g/common.configure Normal file
View File

@ -0,0 +1,21 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
# Truetype fonts for B2G
# ==============================================================
option(env='MOZTTDIR', nargs=1, help='Path to truetype fonts for B2G')
@depends('MOZTTDIR')
def mozttdir(value):
if value:
path = value[0]
if not os.path.isdir(path):
error('MOZTTDIR "%s" is not a valid directory' % path)
set_config('MOZTTDIR', path)
set_define('PACKAGE_MOZTT', '1')
include('../toolkit/moz.configure')

View File

@ -4,4 +4,4 @@
# 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/.
include('../../toolkit/moz.configure')
include('../common/moz.configure')

View File

@ -4,4 +4,4 @@
# 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/.
include('../../toolkit/moz.configure')
include('../common.configure')

View File

@ -107,9 +107,9 @@ DEFINES += -DMOZ_SHARED_ICU
endif
DEFINES += -DMOZ_ICU_DBG_SUFFIX=$(MOZ_ICU_DBG_SUFFIX)
ifdef MOZ_WIDGET_GTK
ifneq (,$(filter gtk%,$(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DMOZ_GTK=1
ifdef MOZ_ENABLE_GTK3
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
DEFINES += -DMOZ_GTK3=1
endif
endif

View File

@ -4,4 +4,11 @@
# 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/.
include('../toolkit/moz.configure')
option('--with-gonk', nargs=1, help='Path to the gonk base directory')
@depends('--with-gonk')
def gonkdir(value):
return value[0] if value else ''
include('common.configure')

View File

@ -46,7 +46,7 @@ GARBAGE += $(addprefix $(FINAL_TARGET)/defaults/pref/, firefox.js)
endif
ifdef MOZ_WIDGET_GTK
ifneq (,$(filter gtk%,$(MOZ_WIDGET_TOOLKIT)))
libs::
$(INSTALL) $(IFLAGS1) $(DIST)/branding/mozicon128.png $(FINAL_TARGET)/icons
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(FINAL_TARGET)/chrome/icons/default

View File

@ -36,7 +36,7 @@ def FirefoxBranding():
'dsstore',
'firefox.icns',
]
elif CONFIG['MOZ_WIDGET_GTK']:
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
BRANDING_FILES += [
'default16.png',
'default32.png',

View File

@ -0,0 +1,95 @@
/*global
NewTabWebChannel,
NewTabPrefsProvider,
Preferences,
XPCOMUtils
*/
/* exported NewTabMessages */
"use strict";
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider",
"resource:///modules/NewTabPrefsProvider.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabWebChannel",
"resource:///modules/NewTabWebChannel.jsm");
this.EXPORTED_SYMBOLS = ["NewTabMessages"];
const PREF_ENABLED = "browser.newtabpage.remote";
// Action names are from the content's perspective. in from chrome == out from content
// Maybe replace the ACTION objects by a bi-directional Map a bit later?
const ACTIONS = {
prefs: {
inPrefs: "REQUEST_PREFS",
outPrefs: "RECEIVE_PREFS",
action_types: new Set(["REQUEST_PREFS", "RECEIVE_PREFS"]),
}
};
let NewTabMessages = {
_prefs: {},
/** NEWTAB EVENT HANDLERS **/
/*
* Return to the originator all newtabpage prefs. A point-to-point request.
*/
handlePrefRequest(actionName, {target}) {
if (ACTIONS.prefs.action_types.has(actionName)) {
let results = NewTabPrefsProvider.prefs.newtabPagePrefs;
NewTabWebChannel.send(ACTIONS.prefs.outPrefs, results, target);
}
},
/*
* Broadcast preference changes to all open newtab pages
*/
handlePrefChange(actionName, value) {
let prefChange = {};
prefChange[actionName] = value;
NewTabWebChannel.broadcast(ACTIONS.prefs.outPrefs, prefChange);
},
_handleEnabledChange(prefName, value) {
if (prefName === PREF_ENABLED) {
if (this._prefs.enabled && !value) {
this.uninit();
} else if (!this._prefs.enabled && value) {
this.init();
}
}
},
init() {
this._prefs.enabled = Preferences.get(PREF_ENABLED, false);
if (this._prefs.enabled) {
NewTabWebChannel.on(ACTIONS.prefs.inPrefs, this.handlePrefRequest.bind(this));
NewTabPrefsProvider.prefs.on(PREF_ENABLED, this._handleEnabledChange.bind(this));
for (let pref of NewTabPrefsProvider.newtabPagePrefSet) {
NewTabPrefsProvider.prefs.on(pref, this.handlePrefChange.bind(this));
}
}
},
uninit() {
this._prefs.enabled = Preferences.get(PREF_ENABLED, false);
if (this._prefs.enabled) {
NewTabPrefsProvider.prefs.off(PREF_ENABLED, this._handleEnabledChange);
NewTabWebChannel.off(ACTIONS.prefs.inPrefs, this.handlePrefRequest);
for (let pref of NewTabPrefsProvider.newtabPagePrefSet) {
NewTabPrefsProvider.prefs.off(pref, this.handlePrefChange);
}
}
}
};

View File

@ -21,11 +21,24 @@ const gPrefsMap = new Map([
["browser.newtabpage.remote.mode", "str"],
["browser.newtabpage.enabled", "bool"],
["browser.newtabpage.enhanced", "bool"],
["browser.newtabpage.introShown", "bool"],
["browser.newtabpage.updateIntroShown", "bool"],
["browser.newtabpage.pinned", "str"],
["browser.newtabpage.blocked", "str"],
["intl.locale.matchOS", "bool"],
["general.useragent.locale", "localized"],
]);
// prefs that are important for the newtab page
const gNewtabPagePrefs = new Set([
"browser.newtabpage.enabled",
"browser.newtabpage.enhanced",
"browser.newtabpage.pinned",
"browser.newtabpage.blocked",
"browser.newtabpage.introShown",
"browser.newtabpage.updateIntroShown"
]);
let PrefsProvider = function PrefsProvider() {
EventEmitter.decorate(this);
};
@ -59,6 +72,17 @@ PrefsProvider.prototype = {
}
},
/*
* Return the preferences that are important to the newtab page
*/
get newtabPagePrefs() {
let results = {};
for (let pref of gNewtabPagePrefs) {
results[pref] = Preferences.get(pref, null);
}
return results;
},
get prefsMap() {
return gPrefsMap;
},
@ -83,4 +107,5 @@ const gPrefs = new PrefsProvider();
let NewTabPrefsProvider = {
prefs: gPrefs,
newtabPagePrefSet: gNewtabPagePrefs,
};

View File

@ -1,13 +1,15 @@
/* exported MODE_CHANNEL_MAP */
/* exported NewTabRemoteResources */
"use strict";
this.EXPORTED_SYMBOLS = ["MODE_CHANNEL_MAP"];
this.EXPORTED_SYMBOLS = ["NewTabRemoteResources"];
const MODE_CHANNEL_MAP = {
"production": {origin: "https://content.cdn.mozilla.net"},
"staging": {origin: "https://content-cdn.stage.mozaws.net"},
"test": {origin: "https://example.com"},
"test2": {origin: "http://mochi.test:8888"},
"dev": {origin: "http://localhost:8888"}
const NewTabRemoteResources = {
MODE_CHANNEL_MAP: {
production: {origin: "https://content.cdn.mozilla.net"},
staging: {origin: "https://content-cdn.stage.mozaws.net"},
test: {origin: "https://example.com"},
test2: {origin: "http://mochi.test:8888"},
dev: {origin: "http://localhost:8888"}
}
};

View File

@ -0,0 +1,295 @@
/* global
NewTabPrefsProvider,
Services,
EventEmitter,
Preferences,
XPCOMUtils,
WebChannel,
NewTabRemoteResources
*/
/* exported NewTabWebChannel */
"use strict";
this.EXPORTED_SYMBOLS = ["NewTabWebChannel"];
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider",
"resource:///modules/NewTabPrefsProvider.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabRemoteResources",
"resource:///modules/NewTabRemoteResources.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");
XPCOMUtils.defineLazyGetter(this, "EventEmitter", function() {
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js", {});
return EventEmitter;
});
const CHAN_ID = "newtab";
const PREF_ENABLED = "browser.newtabpage.remote";
const PREF_MODE = "browser.newtabpage.remote.mode";
/**
* NewTabWebChannel is the conduit for all communication with unprivileged newtab instances.
*
* It allows for the ability to broadcast to all newtab browsers.
* If the browser.newtab.remote pref is false, the object will be in an uninitialized state.
*
* Mode choices:
* 'production': pages from our production CDN
* 'staging': pages from our staging CDN
* 'test': intended for tests
* 'test2': intended for tests
* 'dev': intended for development
*
* An unknown mode will result in 'production' mode, which is the default
*
* Incoming messages are expected to be JSON-serialized and in the format:
*
* {
* type: "REQUEST_SCREENSHOT",
* data: {
* url: "https://example.com"
* }
* }
*
* Or:
*
* {
* type: "REQUEST_SCREENSHOT",
* }
*
* Outgoing messages are expected to be objects serializable by structured cloning, in a similar format:
* {
* type: "RECEIVE_SCREENSHOT",
* data: {
* "url": "https://example.com",
* "image": "dataURi:....."
* }
* }
*/
let NewTabWebChannelImpl = function NewTabWebChannelImpl() {
EventEmitter.decorate(this);
this._handlePrefChange = this._handlePrefChange.bind(this);
this._incomingMessage = this._incomingMessage.bind(this);
};
NewTabWebChannelImpl.prototype = {
_prefs: {},
_channel: null,
// a WeakMap containing browsers as keys and a weak ref to their principal
// as value
_principals: null,
// a Set containing weak refs to browsers
_browsers: null,
/*
* Returns current channel's ID
*/
get chanId() {
return CHAN_ID;
},
/*
* Returns the number of browsers currently tracking
*/
get numBrowsers() {
return this._getBrowserRefs().length;
},
/*
* Returns current channel's origin
*/
get origin() {
if (!(this._prefs.mode in NewTabRemoteResources.MODE_CHANNEL_MAP)) {
this._prefs.mode = "production";
}
return NewTabRemoteResources.MODE_CHANNEL_MAP[this._prefs.mode].origin;
},
/*
* Unloads all browsers and principals
*/
_unloadAll() {
if (this._principals != null) {
this._principals = new WeakMap();
}
this._browsers = new Set();
this.emit("targetUnloadAll");
},
/*
* Checks if a browser is known
*
* This will cause an iteration through all known browsers.
* That's ok, we don't expect a lot of browsers
*/
_isBrowserKnown(browser) {
for (let bRef of this._getBrowserRefs()) {
let b = bRef.get();
if (b && b.permanentKey === browser.permanentKey) {
return true;
}
}
return false;
},
/*
* Obtains all known browser refs
*/
_getBrowserRefs() {
let refs = [];
for (let bRef of this._browsers) {
/*
* even though we hold a weak ref to browser, it seems that browser
* objects aren't gc'd immediately after a tab closes. They stick around
* in memory, but thankfully they don't have a documentURI in that case
*/
let browser = bRef.get();
if (browser && browser.documentURI) {
refs.push(bRef);
} else {
// need to clean up principals because the browser object is not gc'ed
// immediately
this._principals.delete(browser);
this._browsers.delete(bRef);
this.emit("targetUnload");
}
}
return refs;
},
/*
* Receives a message from content.
*
* Keeps track of browsers for broadcast, relays messages to listeners.
*/
_incomingMessage(id, message, target) {
if (this.chanId !== id) {
Cu.reportError(new Error("NewTabWebChannel unexpected message destination"));
}
/*
* need to differentiate by browser, because event targets are created each
* time a message is sent.
*/
if (!this._isBrowserKnown(target.browser)) {
this._browsers.add(Cu.getWeakReference(target.browser));
this._principals.set(target.browser, Cu.getWeakReference(target.principal));
this.emit("targetAdd");
}
try {
let msg = JSON.parse(message);
this.emit(msg.type, {data: msg.data, target: target});
} catch (err) {
Cu.reportError(err);
}
},
/*
* Sends a message to all known browsers
*/
broadcast(actionType, message) {
for (let bRef of this._getBrowserRefs()) {
let browser = bRef.get();
try {
let principal = this._principals.get(browser).get();
if (principal && browser && browser.documentURI) {
this._channel.send({type: actionType, data: message}, {browser, principal});
}
} catch (e) {
Cu.reportError(new Error("NewTabWebChannel WeakRef is dead"));
this._principals.delete(browser);
}
}
},
/*
* Sends a message to a specific target
*/
send(actionType, message, target) {
try {
this._channel.send({type: actionType, data: message}, target);
} catch (e) {
// Web Channel might be dead
Cu.reportError(e);
}
},
/*
* Pref change observer callback
*/
_handlePrefChange(prefName, newState, forceState) { // eslint-disable-line no-unused-vars
switch (prefName) {
case PREF_ENABLED:
if (!this._prefs.enabled && newState) {
// changing state from disabled to enabled
this.setupState();
} else if (this._prefs.enabled && !newState) {
// changing state from enabled to disabled
this.tearDownState();
}
break;
case PREF_MODE:
if (this._prefs.mode !== newState) {
// changing modes
this.tearDownState();
this.setupState();
}
break;
}
},
/*
* Sets up the internal state
*/
setupState() {
this._prefs.enabled = Preferences.get(PREF_ENABLED, false);
let mode = Preferences.get(PREF_MODE, "production");
if (!(mode in NewTabRemoteResources.MODE_CHANNEL_MAP)) {
mode = "production";
}
this._prefs.mode = mode;
this._principals = new WeakMap();
this._browsers = new Set();
if (this._prefs.enabled) {
this._channel = new WebChannel(this.chanId, Services.io.newURI(this.origin, null, null));
this._channel.listen(this._incomingMessage);
}
},
tearDownState() {
if (this._channel) {
this._channel.stopListening();
}
this._prefs = {};
this._unloadAll();
this._channel = null;
this._principals = null;
this._browsers = null;
},
init() {
this.setupState();
NewTabPrefsProvider.prefs.on(PREF_ENABLED, this._handlePrefChange);
NewTabPrefsProvider.prefs.on(PREF_MODE, this._handlePrefChange);
},
uninit() {
this.tearDownState();
NewTabPrefsProvider.prefs.off(PREF_ENABLED, this._handlePrefChange);
NewTabPrefsProvider.prefs.off(PREF_MODE, this._handlePrefChange);
}
};
let NewTabWebChannel = new NewTabWebChannelImpl();

View File

@ -5,7 +5,7 @@
*/
/* globals XPCOMUtils, NewTabPrefsProvider, Services,
Locale, UpdateUtils, MODE_CHANNEL_MAP
Locale, UpdateUtils, NewTabRemoteResources
*/
"use strict";
@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider",
"resource:///modules/NewTabPrefsProvider.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Locale",
"resource://gre/modules/Locale.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "MODE_CHANNEL_MAP",
XPCOMUtils.defineLazyModuleGetter(this, "NewTabRemoteResources",
"resource:///modules/NewTabRemoteResources.jsm");
const LOCAL_NEWTAB_URL = "chrome://browser/content/newtab/newTab.xhtml";
@ -168,10 +168,10 @@ AboutNewTabService.prototype = {
.replace("%LOCALE%", Locale.getLocale())
.replace("%CHANNEL%", releaseName);
let mode = Services.prefs.getCharPref(PREF_REMOTE_MODE, "production");
if (!(mode in MODE_CHANNEL_MAP)) {
if (!(mode in NewTabRemoteResources.MODE_CHANNEL_MAP)) {
mode = "production";
}
return MODE_CHANNEL_MAP[mode].origin + path;
return NewTabRemoteResources.MODE_CHANNEL_MAP[mode].origin + path;
},
/*

View File

@ -11,9 +11,11 @@ XPCSHELL_TESTS_MANIFESTS += [
]
EXTRA_JS_MODULES += [
'NewTabMessages.jsm',
'NewTabPrefsProvider.jsm',
'NewTabRemoteResources.jsm',
'NewTabURL.jsm',
'NewTabWebChannel.jsm',
'PlacesProvider.jsm'
]

View File

@ -1,6 +1,10 @@
[DEFAULT]
support-files =
dummy_page.html
newtabwebchannel_basic.html
newtabmessages_prefs.html
[browser_remotenewtab_pageloads.js]
[browser_newtab_overrides.js]
[browser_newtabmessages.js]
[browser_newtabwebchannel.js]

View File

@ -0,0 +1,57 @@
/* globals Cu, XPCOMUtils, Preferences, is, registerCleanupFunction, NewTabWebChannel */
"use strict";
Cu.import("resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabWebChannel",
"resource:///modules/NewTabWebChannel.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabMessages",
"resource:///modules/NewTabMessages.jsm");
function setup() {
Preferences.set("browser.newtabpage.enhanced", true);
Preferences.set("browser.newtabpage.remote.mode", "test");
Preferences.set("browser.newtabpage.remote", true);
NewTabMessages.init();
}
function cleanup() {
NewTabMessages.uninit();
NewTabWebChannel.tearDownState();
Preferences.set("browser.newtabpage.remote", false);
Preferences.set("browser.newtabpage.remote.mode", "production");
}
registerCleanupFunction(cleanup);
/*
* Sanity tests for pref messages
*/
add_task(function* prefMessages_request() {
setup();
let testURL = "https://example.com/browser/browser/components/newtab/tests/browser/newtabmessages_prefs.html";
let tabOptions = {
gBrowser,
url: testURL
};
let prefResponseAck = new Promise(resolve => {
NewTabWebChannel.once("responseAck", () => {
ok(true, "a request response has been received");
resolve();
});
});
yield BrowserTestUtils.withNewTab(tabOptions, function*() {
yield prefResponseAck;
let prefChangeAck = new Promise(resolve => {
NewTabWebChannel.once("responseAck", () => {
ok(true, "a change response has been received");
resolve();
});
});
Preferences.set("browser.newtabpage.enhanced", false);
yield prefChangeAck;
});
cleanup();
});

View File

@ -0,0 +1,232 @@
/* globals XPCOMUtils, Cu, Preferences, NewTabWebChannel, is, registerCleanupFunction */
"use strict";
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabWebChannel",
"resource:///modules/NewTabWebChannel.jsm");
const TEST_URL = "https://example.com/browser/browser/components/newtab/tests/browser/newtabwebchannel_basic.html";
const TEST_URL_2 = "http://mochi.test:8888/browser/browser/components/newtab/tests/browser/newtabwebchannel_basic.html";
function cleanup() {
NewTabWebChannel.tearDownState();
Preferences.set("browser.newtabpage.remote", false);
Preferences.set("browser.newtabpage.remote.mode", "production");
}
registerCleanupFunction(cleanup);
/*
* Tests flow of messages from newtab to chrome and chrome to newtab
*/
add_task(function* open_webchannel_basic() {
Preferences.set("browser.newtabpage.remote.mode", "test");
Preferences.set("browser.newtabpage.remote", true);
let tabOptions = {
gBrowser,
url: TEST_URL
};
let messagePromise = new Promise(resolve => {
NewTabWebChannel.once("foo", function(name, msg) {
is(name, "foo", "Correct message type sent: foo");
is(msg.data, "bar", "Correct data sent: bar");
resolve(msg.target);
});
});
let replyPromise = new Promise(resolve => {
NewTabWebChannel.once("reply", function(name, msg) {
is(name, "reply", "Correct message type sent: reply");
is(msg.data, "quuz", "Correct data sent: quuz");
resolve(msg.target);
});
});
let unloadPromise = new Promise(resolve => {
NewTabWebChannel.once("targetUnload", function(name) {
is(name, "targetUnload", "Correct message type sent: targetUnload");
resolve();
});
});
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
yield BrowserTestUtils.withNewTab(tabOptions, function*(browser) {
let target = yield messagePromise;
is(NewTabWebChannel.numBrowsers, 1, "One target expected");
is(target.browser, browser, "Same browser");
NewTabWebChannel.send("respond", null, target);
yield replyPromise;
});
Cu.forceGC();
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
yield unloadPromise;
cleanup();
});
/*
* Tests message broadcast reaches all open newtab pages
*/
add_task(function* webchannel_broadcast() {
Preferences.set("browser.newtabpage.remote.mode", "test");
Preferences.set("browser.newtabpage.remote", true);
let countingMessagePromise = new Promise(resolve => {
let count = 0;
NewTabWebChannel.on("foo", function test_message(name, msg) {
count += 1;
if (count === 2) {
NewTabWebChannel.off("foo", test_message);
resolve(msg.target);
}
}.bind(this));
});
let countingReplyPromise = new Promise(resolve => {
let count = 0;
NewTabWebChannel.on("reply", function test_message(name, msg) {
count += 1;
if (count === 2) {
NewTabWebChannel.off("reply", test_message);
resolve(msg.target);
}
}.bind(this));
});
let countingUnloadPromise = new Promise(resolve => {
let count = 0;
NewTabWebChannel.on("targetUnload", function test_message() {
count += 1;
if (count === 2) {
NewTabWebChannel.off("targetUnload", test_message);
resolve();
}
});
});
let tabs = [];
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
tabs.push(yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL));
tabs.push(yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL));
yield countingMessagePromise;
is(NewTabWebChannel.numBrowsers, 2, "Two targets expected");
NewTabWebChannel.broadcast("respond", null);
yield countingReplyPromise;
for (let tab of tabs) {
yield BrowserTestUtils.removeTab(tab);
}
Cu.forceGC();
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
yield countingUnloadPromise;
cleanup();
});
/*
* Tests switching modes
*/
add_task(function* webchannel_switch() {
Preferences.set("browser.newtabpage.remote.mode", "test");
Preferences.set("browser.newtabpage.remote", true);
function newMessagePromise() {
return new Promise(resolve => {
NewTabWebChannel.once("foo", function(name, msg) {
resolve(msg.target);
}.bind(this));
});
}
let replyCount = 0;
let replyPromise = new Promise(resolve => {
NewTabWebChannel.on("reply", function() {
replyCount += 1;
resolve();
}.bind(this));
});
let unloadPromise = new Promise(resolve => {
NewTabWebChannel.once("targetUnload", function() {
resolve();
});
});
let unloadAllPromise = new Promise(resolve => {
NewTabWebChannel.once("targetUnloadAll", function() {
resolve();
});
});
let tabs = [];
let messagePromise;
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
messagePromise = newMessagePromise();
tabs.push(yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL));
yield messagePromise;
is(NewTabWebChannel.numBrowsers, 1, "Correct number of targets");
messagePromise = newMessagePromise();
Preferences.set("browser.newtabpage.remote.mode", "test2");
tabs.push(yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL_2));
yield unloadAllPromise;
yield messagePromise;
is(NewTabWebChannel.numBrowsers, 1, "Correct number of targets");
NewTabWebChannel.broadcast("respond", null);
yield replyPromise;
is(replyCount, 1, "only current channel is listened to for replies");
for (let tab of tabs) {
yield BrowserTestUtils.removeTab(tab);
}
Cu.forceGC();
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
yield unloadPromise;
cleanup();
});
add_task(function* open_webchannel_reload() {
Preferences.set("browser.newtabpage.remote.mode", "test");
Preferences.set("browser.newtabpage.remote", true);
let tabOptions = {
gBrowser,
url: TEST_URL
};
let messagePromise = new Promise(resolve => {
NewTabWebChannel.once("foo", function(name, msg) {
is(name, "foo", "Correct message type sent: foo");
is(msg.data, "bar", "Correct data sent: bar");
resolve(msg.target);
});
});
let unloadPromise = new Promise(resolve => {
NewTabWebChannel.once("targetUnload", function() {
resolve();
});
});
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
yield BrowserTestUtils.withNewTab(tabOptions, function*(browser) {
let target = yield messagePromise;
is(NewTabWebChannel.numBrowsers, 1, "One target expected");
is(target.browser, browser, "Same browser");
browser.contentWindow.location.reload();
});
Cu.forceGC();
is(NewTabWebChannel.numBrowsers, 0, "Sanity check");
yield unloadPromise;
cleanup();
});

View File

@ -0,0 +1,32 @@
<html>
<head>
<meta charset="utf8">
<title>Newtab WebChannel test</title>
</head>
<body>
<script>
window.addEventListener("WebChannelMessageToContent", function(e) {
if (e.detail.message && e.detail.message.type === "RECEIVE_PREFS") {
let reply = new window.CustomEvent("WebChannelMessageToChrome", {
detail: {
id: "newtab",
message: JSON.stringify({type: "responseAck"}),
}
});
window.dispatchEvent(reply);
}
}, true);
document.onreadystatechange = function () {
let msg = new window.CustomEvent("WebChannelMessageToChrome", {
detail: {
id: "newtab",
message: JSON.stringify({type: "REQUEST_PREFS"}),
}
});
window.dispatchEvent(msg);
};
</script>
</body>
</html>

View File

@ -0,0 +1,32 @@
<html>
<head>
<meta charset="utf8">
<title>Newtab WebChannel test</title>
</head>
<body>
<script>
document.onreadystatechange = function () {
let msg = new window.CustomEvent("WebChannelMessageToChrome", {
detail: {
id: "newtab",
message: JSON.stringify({type: "foo", data: "bar"}),
}
});
window.dispatchEvent(msg);
};
window.addEventListener("WebChannelMessageToContent", function(e) {
if (e.detail.message && e.detail.message.type === "respond") {
let reply = new window.CustomEvent("WebChannelMessageToChrome", {
detail: {
id: "newtab",
message: JSON.stringify({type: "reply", data: "quuz"}),
}
});
window.dispatchEvent(reply);
}
}, true);
</script>
</body>
</html>

View File

@ -28,6 +28,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider",
"resource:///modules/NewTabPrefsProvider.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabWebChannel",
"resource:///modules/NewTabWebChannel.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabMessages",
"resource:///modules/NewTabMessages.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UITour",
"resource:///modules/UITour.jsm");
@ -749,6 +755,8 @@ BrowserGlue.prototype = {
AboutNewTab.init();
NewTabPrefsProvider.prefs.init();
NewTabWebChannel.init();
NewTabMessages.init();
SessionStore.init();
BrowserUITelemetry.init();
@ -1054,6 +1062,9 @@ BrowserGlue.prototype = {
SelfSupportBackend.uninit();
NewTabPrefsProvider.prefs.uninit();
NewTabWebChannel.uninit();
NewTabMessages.uninit();
AboutNewTab.uninit();
webrtcUI.uninit();
FormValidationHandler.uninit();

View File

@ -21,7 +21,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
XPIDL_SOURCES += [
'nsIMacShellService.idl',
]
elif CONFIG['MOZ_WIDGET_GTK']:
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
XPIDL_SOURCES += [
'nsIGNOMEShellService.idl',
]
@ -36,7 +36,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
SOURCES += [
'nsMacShellService.cpp',
]
elif CONFIG['MOZ_WIDGET_GTK']:
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
SOURCES += [
'nsGNOMEShellService.cpp',
]

View File

@ -6,6 +6,7 @@
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/UpdateUtils.jsm");
// The amount of people to be part of e10s, in %
@ -55,12 +56,15 @@ function defineCohort() {
let userOptedOut = optedOut();
let userOptedIn = optedIn();
let disqualified = (Services.appinfo.multiprocessBlockPolicy != 0);
let testGroup = (getUserSample() < TEST_THRESHOLD[updateChannel]);
if (userOptedOut) {
setCohort("optedOut");
} else if (userOptedIn) {
setCohort("optedIn");
} else if (disqualified) {
setCohort("disqualified");
} else if (testGroup) {
setCohort("test");
Preferences.set(PREF_TOGGLE_E10S, true);
@ -89,6 +93,9 @@ function getUserSample() {
function setCohort(cohortName) {
Preferences.set(PREF_COHORT_NAME, cohortName);
try {
Services.appinfo.annotateCrashReport("E10SCohort", cohortName);
} catch (e) {}
}
function optedIn() {

View File

@ -24,9 +24,9 @@ ifdef MOZ_DEBUG
DEFINES += -DMOZ_DEBUG=1
endif
ifdef MOZ_WIDGET_GTK
ifneq (,$(filter gtk%,$(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DMOZ_GTK=1
ifdef MOZ_ENABLE_GTK3
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
DEFINES += -DMOZ_GTK3=1
endif
endif

View File

@ -366,11 +366,6 @@
list-style-image: url(chrome://mozapps/skin/passwordmgr/key-16@2x.png);
}
.webapps-notification-icon,
#webapps-notification-icon {
list-style-image: url(chrome://global/skin/icons/webapps-16@2x.png);
}
#plugins-notification-icon {
list-style-image: url(chrome://browser/skin/notification-pluginNormal@2x.png);
}

View File

@ -24,6 +24,7 @@ Important Concepts
preprocessor
jar-manifests
defining-binaries
toolchains
integrated development environment (IDE)
========================================

53
build/docs/toolchains.rst Normal file
View File

@ -0,0 +1,53 @@
.. _build_toolchains:
===========================
Creating Toolchain Archives
===========================
There are various scripts in the repository for producing archives
of the build tools (e.g. compilers and linkers) required to build.
Clang
=====
See the ``build/build-clang`` directory. Read ``build/build-clang/README``
for more.
Windows
=======
The ``build/windows_toolchain.py`` script is used to build and manage
Windows toolchain archives containing Visual Studio executables, SDKs,
etc.
The way Firefox build automation works is an archive containing the
toolchain is produced and uploaded to an internal Mozilla server. The
build automation will download, verify, and extract this archive before
building. The archive is self-contained so machines don't need to install
Visual Studio, SDKs, or various other dependencies. Unfortunately,
Microsoft's terms don't allow Mozilla to distribute this archive
publicly. However, the same tool can be used to create your own copy.
Configuring Your System
-----------------------
It is **highly** recommended to perform this process on a fresh installation
of Windows 7 or 10 (such as in a VM). Installing all updates through
Windows Update is not only acceptable - it is encouraged. Although it
shouldn't matter.
Next, install Visual Studio 2015 Community. The download link can be
found at https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx.
Be sure to follow these install instructions:
1. Choose a ``Custom`` installation and click ``Next``
2. Select ``Programming Languages`` -> ``Visual C++`` (make sure all sub items are
selected)
3. Under ``Windows and Web Development`` uncheck everything except
``Universal Windows App Development Tools`` and the items under it
(should be ``Tools (1.2)...`` and the ``Windows 10 SDK``).
Once Visual Studio 2015 Community has been installed, from a checkout
of mozilla-central, run the following to produce a ZIP archive::
$ ./mach python build/windows_toolchain.py create-zip vs2015.zip

View File

@ -69,7 +69,7 @@ def check_prog(var, progs, allow_missing=False):
@advanced
def postcheck(value):
set_config(var, ':' if value is not_found else value)
if not value and not allow_missing:
if value is not_found and not allow_missing:
from mozbuild.shellutil import quote
error('Cannot find %s (tried: %s)'
% (var.lower(), ', '.join(quote(p) for p in progs)))

View File

@ -255,13 +255,19 @@ def wanted_mozconfig_variables(help):
'DSYMUTIL',
'EXTERNAL_SOURCE_DIR',
'GENISOIMAGE',
'L10NBASEDIR',
'MOZILLABUILD',
'MOZ_ARTIFACT_BUILDS',
'MOZ_BUILD_APP',
'MOZ_FMP4',
'MOZ_INSTRUMENT_EVENT_LOOP',
'MOZTTDIR',
'PERL',
'RPMBUILD',
'TAR',
'UNZIP',
'USE_FC_FREETYPE',
'WITHOUT_X',
'XARGS',
'ZIP',
])
@ -360,7 +366,11 @@ def split_triplet(triplet):
elif os.startswith('mingw'):
canonical_os = canonical_kernel = 'WINNT'
elif os.startswith('darwin'):
canonical_os = canonical_kernel = 'Darwin'
canonical_kernel = 'Darwin'
canonical_os = 'OSX'
elif os.startswith('ios'):
canonical_kernel = 'Darwin'
canonical_os = 'iOS'
elif os.startswith('dragonfly'):
canonical_os = canonical_kernel = 'DragonFly'
elif os.startswith('freebsd'):
@ -434,7 +444,13 @@ def target(value, host):
def host_and_target_for_old_configure(host, target):
# Autoconf needs these set
add_old_configure_arg('--host=%s' % host.alias)
add_old_configure_arg('--target=%s' % target.alias)
target_alias = target.alias
# old-configure does plenty of tests against $target and $target_os
# and expects darwin for iOS, so make it happy.
if target.os == 'iOS':
target_alias = target_alias.replace('-ios', '-darwin')
add_old_configure_arg('--target=%s' % target_alias)
# These variables are for compatibility with the current moz.builds and
@ -444,7 +460,8 @@ def target_variables(target):
if target.kernel == 'kFreeBSD':
os_target = 'GNU/kFreeBSD'
os_arch = 'GNU_kFreeBSD'
elif target.kernel == 'Linux' and target.os == 'GNU':
elif target.kernel == 'Darwin' or (target.kernel == 'Linux' and
target.os == 'GNU'):
os_target = target.kernel
os_arch = target.kernel
else:
@ -542,4 +559,20 @@ def js_option(*args, **kwargs):
add_old_configure_arg(value.format(opt.option))
# This is overridden in b2g/moz.configure with an option. No other project
# needs the option directly, but it's used to influence some other things in
# toolkit/moz.configure (and possibly top-level moz.configure later on), so
# define a dummy default here.
@depends('--help')
def gonkdir(help):
return ''
include(include_project_configure)
# By now, gonkdir is either the dummy function above or a real function
# depending on --with-gonk from b2g/moz.configure.
@depends(gonkdir)
def gonkdir_for_old_configure(value):
if value:
add_old_configure_assignment('gonkdir', value)

View File

@ -191,18 +191,14 @@ def old_configure_options(*options):
'--enable-debug',
'--enable-debug-js-modules',
'--enable-debug-symbols',
'--enable-default-toolkit',
'--enable-directshow',
'--enable-dmd',
'--enable-dtrace',
'--enable-dump-painting',
'--enable-elf-hack',
'--enable-eme',
'--enable-extensions',
'--enable-faststripe',
'--enable-feeds',
'--enable-ffmpeg',
'--enable-fmp4',
'--enable-gamepad',
'--enable-gc-trace',
'--enable-gconf',
@ -299,7 +295,6 @@ def old_configure_options(*options):
'--enable-websms-backend',
'--enable-webspeech',
'--enable-webspeechtestbackend',
'--enable-wmf',
'--enable-xul',
'--enable-zipwriter',
'--no-create',
@ -332,8 +327,6 @@ def old_configure_options(*options):
'--with-doc-output-dir',
'--with-float-abi',
'--with-fpu',
'--with-gl-provider',
'--with-gonk',
'--with-gonk-toolchain-prefix',
'--with-google-api-keyfile',
'--with-google-oauth-api-keyfile',
@ -342,8 +335,6 @@ def old_configure_options(*options):
'--with-ios-sdk',
'--with-java-bin-path',
'--with-jitreport-granularity',
'--with-l10n-base',
'--with-libxul-sdk',
'--with-linux-headers',
'--with-macbundlename-prefix',
'--with-macos-private-frameworks',
@ -372,7 +363,6 @@ def old_configure_options(*options):
'--with-unify-dist',
'--with-user-appdir',
'--with-windows-version',
'--with-x',
'--with-xulrunner-stub-name',
'--x-includes',
'--x-libraries',

261
build/windows_toolchain.py Normal file
View File

@ -0,0 +1,261 @@
#!/usr/bin/env python2.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/.
# This script is used to create and manipulate archives containing
# files necessary to build Firefox on Windows (referred to as the
# "Windows toolchain").
#
# When updating behavior of this script, remember to update the docs
# in ``build/docs/toolchains.rst``.
from __future__ import absolute_import, unicode_literals
import hashlib
import os
import sys
from mozpack.files import (
FileFinder,
)
from mozpack.mozjar import (
JarWriter,
)
import mozpack.path as mozpath
# mozpack.match patterns for files under "Microsoft Visual Studio 14.0".
VS_PATTERNS = [
{
'pattern': 'DIA SDK/bin/**',
# Various tools don't like spaces in filenames. So remove it.
'rewrite': [('DIA SDK/', 'DIASDK/')],
'ignore': (
'DIA SDK/bin/arm/**',
),
},
{
'pattern': 'DIA SDK/idl/**',
'rewrite': [('DIA SDK/', 'DIASDK/')],
},
{
'pattern': 'DIA SDK/include/**',
'rewrite': [('DIA SDK/', 'DIASDK/')],
},
{
'pattern': 'DIA SDK/lib/**',
'rewrite': [('DIA SDK/', 'DIASDK/')],
'ignore': (
'DIA SDK/lib/arm/**',
),
},
# ATL is needed by Breakpad.
{
'pattern': 'VC/atlmfc/include/**',
},
{
'pattern': 'VC/atlmfc/lib/atls.*',
},
{
'pattern': 'VC/atlmfc/lib/amd64/atls.*',
},
{
'pattern': 'VC/bin/**',
# We only care about compiling on amd64 for amd64 or x86 targets.
'ignore': (
'VC/bin/amd64_arm/**',
'VC/bin/arm/**',
'VC/bin/x86_arm/**',
'VC/bin/x86_amd64/**',
),
},
{
'pattern': 'VC/include/**',
},
{
'pattern': 'VC/lib/**',
'ignore': (
'VC/lib/arm/**',
'VC/lib/onecore/**',
'VC/lib/store/**',
),
},
{
'pattern': 'VC/redist/x64/Microsoft.VC140.CRT/**',
},
{
'pattern': 'VC/redist/x86/Microsoft.VC140.CRT/**',
},
]
SDK_RELEASE = '10.0.10586.0'
# Files from the Windows 10 SDK to install.
SDK_PATTERNS = [
{
'pattern': 'bin/x64/**',
},
{
'pattern': 'Include/%s/**' % SDK_RELEASE,
},
{
'pattern': 'Lib/%s/ucrt/x64/**' % SDK_RELEASE,
},
{
'pattern': 'Lib/%s/ucrt/x86/**' % SDK_RELEASE,
},
{
'pattern': 'Lib/%s/um/x64/**' % SDK_RELEASE,
},
{
'pattern': 'Lib/%s/um/x86/**' % SDK_RELEASE,
},
{
'pattern': 'Redist/D3D/**',
},
{
'pattern': 'Redist/ucrt/DLLs/x64/**',
},
{
'pattern': 'Redist/ucrt/DLLs/x86/**',
},
]
def find_vs_paths():
"""Resolve source locations of files.
Returns a 2-tuple of (Visual Studio Path, SDK Path).
"""
pf = os.environ.get('ProgramFiles(x86)')
if not pf:
raise Exception('No "ProgramFiles(x86)" environment variable. '
'Not running on 64-bit Windows?')
vs_path = os.path.join(pf, 'Microsoft Visual Studio 14.0')
if not os.path.exists(vs_path):
raise Exception('%s does not exist; Visual Studio 2015 not installed?' %
vs_path)
sdk_path = os.path.join(pf, 'Windows Kits', '10')
if not os.path.exists(sdk_path):
raise Exception('%s does not exist; Windows 10 SDK not installed?' %
sdk_path)
return vs_path, sdk_path
def resolve_files():
"""Resolve the files that constitute a standalone toolchain.
This is a generator of (dest path, file) where the destination
path is relative and the file instance is a BaseFile from mozpack.
"""
vs_path, sdk_path = find_vs_paths()
for entry in VS_PATTERNS:
finder = FileFinder(vs_path, find_executables=False,
ignore=entry.get('ignore', []))
for p, f in finder.find(entry['pattern']):
assert p.startswith(('VC/', 'DIA SDK/'))
for source, dest in entry.get('rewrite', []):
p = p.replace(source, dest)
yield p.encode('utf-8'), f
for entry in SDK_PATTERNS:
finder = FileFinder(sdk_path, find_executables=False,
ignore=entry.get('ignore', []))
for p, f in finder.find(entry['pattern']):
# We remove the SDK version from the path so we don't have
# to update other configs when we change the SDK version.
p = p.replace('/%s/' % SDK_RELEASE, '/')
relpath = 'SDK/%s' % p
yield relpath.encode('utf-8'), f
def resolve_files_and_hash(manifest):
"""Resolve files and hash their data.
This is a generator of 3-tuples of (relpath, data, mode).
As data is read, the manifest is populated with metadata.
Keys are set to the relative file path. Values are 2-tuples
of (data length, sha-256).
"""
assert manifest == {}
for p, f in resolve_files():
data = f.read()
sha256 = hashlib.sha256()
sha256.update(data)
manifest[p] = (len(data), sha256.hexdigest())
yield p, data, f.mode
def format_manifest(manifest):
"""Return formatted SHA-256 manifests as a byte strings."""
sha256_lines = []
for path, (length, sha256) in sorted(manifest.items()):
sha256_lines.append(b'%s\t%d\t%s' % (sha256, length, path))
# Trailing newline.
sha256_lines.append(b'')
return b'\n'.join(sha256_lines)
def write_zip(zip_path, prefix=None):
"""Write toolchain data to a zip file."""
if isinstance(prefix, unicode):
prefix = prefix.encode('utf-8')
with JarWriter(file=zip_path, optimize=False, compress=5) as zip:
manifest = {}
for p, data, mode in resolve_files_and_hash(manifest):
print(p)
if prefix:
p = mozpath.join(prefix, p)
zip.add(p, data, mode=mode)
sha256_manifest = format_manifest(manifest)
sdk_path = b'SDK_VERSION'
sha256_path = b'MANIFEST.SHA256'
if prefix:
sdk_path = mozpath.join(prefix, sdk_path)
sha256_path = mozpath.join(prefix, sha256_path)
zip.add(sdk_path, SDK_RELEASE.encode('utf-8'))
zip.add(sha256_path, sha256_manifest)
if __name__ == '__main__':
if len(sys.argv) != 3:
print('usage: %s create-zip <filename.zip>' % sys.argv[0])
sys.exit(1)
assert sys.argv[1] == 'create-zip'
destzip = sys.argv[2]
# TODO make prefix a CLI argument
write_zip(destzip, prefix='vs2015u1')
sha1 = hashlib.sha1()
sha256 = hashlib.sha256()
sha512 = hashlib.sha512()
with open(destzip, 'rb') as fh:
data = fh.read()
sha1.update(data)
sha256.update(data)
sha512.update(data)
print('Hashes of %s (size=%d)' % (destzip, len(data)))
print('SHA-1: %s' % sha1.hexdigest())
print('SHA-256: %s' % sha256.hexdigest())
print('SHA-512: %s' % sha512.hexdigest())

View File

@ -36,5 +36,5 @@ LOCAL_INCLUDES += [
'/xpcom/components'
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
CXXFLAGS += CONFIG['TK_CFLAGS']

View File

@ -62,18 +62,28 @@ XPCOMUtils.defineLazyGetter(loaderModules, "xpcInspector", () => {
XPCOMUtils.defineLazyGetter(loaderModules, "indexedDB", () => {
// On xpcshell, we can't instantiate indexedDB without crashing
try {
return Cu.Sandbox(this, {wantGlobalProperties:["indexedDB"]}).indexedDB;
let sandbox
= Cu.Sandbox(CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')(),
{wantGlobalProperties: ["indexedDB"]});
return sandbox.indexedDB;
} catch(e) {
return {};
}
});
XPCOMUtils.defineLazyGetter(loaderModules, "CSS", () => {
return Cu.Sandbox(this, {wantGlobalProperties: ["CSS"]}).CSS;
let sandbox
= Cu.Sandbox(CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')(),
{wantGlobalProperties: ["CSS"]});
return sandbox.CSS;
});
XPCOMUtils.defineLazyGetter(loaderModules, "URL", () => {
return Cu.Sandbox(this, {wantGlobalProperties: ["URL"]}).URL;
let sandbox
= Cu.Sandbox(CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')(),
{wantGlobalProperties: ["URL"]});
return sandbox.URL;
});
var sharedGlobalBlocklist = ["sdk/indexed-db"];

View File

@ -15,7 +15,7 @@ namespace mozilla {
class WorkerTimelineMarker : public TimelineMarker
{
public:
WorkerTimelineMarker(ProfileTimelineWorkerOperationType aOperationType,
WorkerTimelineMarker(dom::ProfileTimelineWorkerOperationType aOperationType,
MarkerTracingType aTracingType)
: TimelineMarker("Worker", aTracingType, MarkerStackRequest::NO_STACK)
, mOperationType(aOperationType)
@ -38,7 +38,7 @@ public:
}
private:
ProfileTimelineWorkerOperationType mOperationType;
dom::ProfileTimelineWorkerOperationType mOperationType;
};
} // namespace mozilla

View File

@ -880,7 +880,6 @@ WebappsApplicationMgmt.prototype = {
"Webapps:Uninstall:Broadcast:Return:OK",
"Webapps:Uninstall:Return:KO",
"Webapps:Install:Return:OK",
"Webapps:GetNotInstalled:Return:OK",
"Webapps:GetIcon:Return",
"Webapps:Import:Return",
"Webapps:ExtractManifest:Return",
@ -895,7 +894,6 @@ WebappsApplicationMgmt.prototype = {
);
if (!aHasFullMgmtPrivilege) {
this.getNotInstalled = null;
this.applyDownload = null;
}
},
@ -961,19 +959,6 @@ WebappsApplicationMgmt.prototype = {
});
},
getNotInstalled: function() {
let request = this.createRequest();
let principal = this._window.document.nodePrincipal;
cpmm.sendAsyncMessage("Webapps:GetNotInstalled", {
oid: this._id,
topId: this._topId,
requestID: this.getRequestId(request)
}, null, principal);
return request;
},
import: function(aBlob) {
let principal = this._window.document.nodePrincipal;
return this.createPromiseWithId((aResolverId) => {
@ -1054,9 +1039,6 @@ WebappsApplicationMgmt.prototype = {
}
switch (aMessage.name) {
case "Webapps:GetNotInstalled:Return:OK":
Services.DOMRequest.fireSuccess(req, convertAppsArray(msg.apps, this._window));
break;
case "Webapps:Install:Return:OK":
{
let app = createContentApplicationObject(this._window, msg.app);

View File

@ -208,7 +208,6 @@ this.DOMApplicationRegistry = {
"Webapps:GetSelf",
"Webapps:CheckInstalled",
"Webapps:GetInstalled",
"Webapps:GetNotInstalled",
"Webapps:Launch",
"Webapps:LocationChange",
"Webapps:InstallPackage",
@ -1304,7 +1303,6 @@ this.DOMApplicationRegistry = {
(checkPermission("homescreen-webapps-manage") && isCurrentHomescreen);
break;
case "Webapps:GetNotInstalled":
case "Webapps:ApplyDownload":
case "Webapps:Import":
case "Webapps:ExtractManifest":
@ -1396,9 +1394,6 @@ this.DOMApplicationRegistry = {
case "Webapps:GetInstalled":
this.getInstalled(msg, mm);
break;
case "Webapps:GetNotInstalled":
this.getNotInstalled(msg, mm);
break;
case "Webapps:InstallPackage": {
if (AppConstants.platform == "android" && !AppConstants.MOZ_B2GDROID) {
Services.obs.notifyObservers(mm, "webapps-runtime-install-package", JSON.stringify(msg));
@ -4338,11 +4333,6 @@ this.DOMApplicationRegistry = {
});
},
getNotInstalled: function(aData, aMm) {
aData.apps = [];
aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", this.formatMessage(aData));
},
getIcon: function(aData, aMm) {
let sendError = (aError) => {
debug("getIcon error: " + aError);

View File

@ -47,7 +47,6 @@ var mgmtProps = {
getEventHandler: "function",
getAll: "function",
getIcon: "function",
getNotInstalled: "function",
uninstall: "function",
oninstall: "object",
onuninstall: "object",

View File

@ -91,7 +91,6 @@ function runApp(aApp, aCallback) {
is(typeof mgmt.onenabledstatechange, "object", "get onenabledstatechange");
[
"getNotInstalled",
"applyDownload",
"import",
"extractManifest",

View File

@ -180,22 +180,24 @@ WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx,
nsGlobalWindow* outer = win->GetOuterWindowInternal();
if (outer) {
nsDOMWindowList* childWindows = outer->GetWindowList();
uint32_t length = childWindows->GetLength();
for (uint32_t i = 0; i < length; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item =
childWindows->GetDocShellTreeItemAt(i);
// This is a bit silly, since we could presumably just do
// item->GetWindow(). But it's not obvious whether this does the same
// thing as GetChildWindow() with the item's name (due to the complexity
// of FindChildWithName). Since GetChildWindow is what we use in
// getOwnPropDescriptor, let's try to be consistent.
nsString name;
item->GetName(name);
if (!names.Contains(name)) {
// Make sure we really would expose it from getOwnPropDescriptor.
nsCOMPtr<nsPIDOMWindowOuter> childWin = win->GetChildWindow(name);
if (childWin && ShouldExposeChildWindow(name, childWin)) {
names.AppendElement(name);
if (childWindows) {
uint32_t length = childWindows->GetLength();
for (uint32_t i = 0; i < length; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item =
childWindows->GetDocShellTreeItemAt(i);
// This is a bit silly, since we could presumably just do
// item->GetWindow(). But it's not obvious whether this does the same
// thing as GetChildWindow() with the item's name (due to the complexity
// of FindChildWithName). Since GetChildWindow is what we use in
// getOwnPropDescriptor, let's try to be consistent.
nsString name;
item->GetName(name);
if (!names.Contains(name)) {
// Make sure we really would expose it from getOwnPropDescriptor.
nsCOMPtr<nsPIDOMWindowOuter> childWin = win->GetChildWindow(name);
if (childWin && ShouldExposeChildWindow(name, childWin)) {
names.AppendElement(name);
}
}
}
}

View File

@ -1586,6 +1586,17 @@ nsDocument::~nsDocument()
/* no mixed object subrequests loaded on page*/
Accumulate(Telemetry::MIXED_CONTENT_OBJECT_SUBREQUEST, 0);
}
// record CSP telemetry on this document
if (mHasCSP) {
Accumulate(Telemetry::CSP_DOCUMENTS_COUNT, 1);
}
if (mHasUnsafeInlineCSP) {
Accumulate(Telemetry::CSP_UNSAFE_INLINE_DOCUMENTS_COUNT, 1);
}
if (mHasUnsafeEvalCSP) {
Accumulate(Telemetry::CSP_UNSAFE_EVAL_DOCUMENTS_COUNT, 1);
}
}
}

View File

@ -631,6 +631,30 @@ public:
mHasMixedContentObjectSubrequest = aHasMixedContentObjectSubrequest;
}
/**
* Set CSP flag for this document.
*/
void SetHasCSP(bool aHasCSP)
{
mHasCSP = aHasCSP;
}
/**
* Set unsafe-inline CSP flag for this document.
*/
void SetHasUnsafeInlineCSP(bool aHasUnsafeInlineCSP)
{
mHasUnsafeInlineCSP = aHasUnsafeInlineCSP;
}
/**
* Set unsafe-eval CSP flag for this document.
*/
void SetHasUnsafeEvalCSP(bool aHasUnsafeEvalCSP)
{
mHasUnsafeEvalCSP = aHasUnsafeEvalCSP;
}
/**
* Get tracking content blocked flag for this document.
*/
@ -2934,6 +2958,15 @@ protected:
// True if a document loads a plugin object that attempts to load mixed content subresources through necko(see nsMixedContentBlocker.cpp)
bool mHasMixedContentObjectSubrequest : 1;
// True if a document load has a CSP attached.
bool mHasCSP : 1;
// True if a document load has a CSP with unsafe-eval attached.
bool mHasUnsafeEvalCSP : 1;
// True if a document load has a CSP with unsafe-inline attached.
bool mHasUnsafeInlineCSP : 1;
// True if a document has blocked Tracking Content
bool mHasTrackingContentBlocked : 1;

View File

@ -2452,7 +2452,10 @@ ConvertJSValueToByteString(JSContext* cx, JS::Handle<JS::Value> v,
static_assert(js::MaxStringLength < UINT32_MAX,
"length+1 shouldn't overflow");
result.SetLength(length);
if (!result.SetLength(length, fallible)) {
return false;
}
JS_EncodeStringToBuffer(cx, s, result.BeginWriting(), length);
return true;

View File

@ -505,7 +505,6 @@ DOMInterfaces = {
},
'FileReaderSync': {
'workers': True,
'wrapperCache': False,
},
@ -936,13 +935,11 @@ DOMInterfaces = {
'PushEvent': {
'headerFile': 'ServiceWorkerEvents.h',
'nativeType': 'mozilla::dom::workers::PushEvent',
'workers': True
},
'PushMessageData': {
'headerFile': 'ServiceWorkerEvents.h',
'nativeType': 'mozilla::dom::workers::PushMessageData',
'workers': True
},
'PushManager': [{
@ -1614,11 +1611,6 @@ DOMInterfaces = {
},
},
'WorkerLocation': {
'headerFile': 'mozilla/dom/workers/bindings/Location.h',
'workers': True,
},
'WorkerNavigator': {
'headerFile': 'mozilla/dom/workers/bindings/Navigator.h',
'workers': True,

View File

@ -996,9 +996,10 @@ CanvasRenderingContext2D::~CanvasRenderingContext2D()
}
#ifdef USE_SKIA_GPU
if (mVideoTexture) {
MOZ_ASSERT(gfxPlatform::GetPlatform()->GetSkiaGLGlue(), "null SkiaGLGlue");
gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext()->MakeCurrent();
gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext()->fDeleteTextures(1, &mVideoTexture);
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);
glue->GetGLContext()->MakeCurrent();
glue->GetGLContext()->fDeleteTextures(1, &mVideoTexture);
}
#endif
@ -4474,8 +4475,9 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
mIsSkiaGL &&
!srcSurf &&
aImage.IsHTMLVideoElement() &&
gfxPlatform::GetPlatform()->GetSkiaGLGlue()) {
gfxPlatform::GetPlatform()->UseAcceleratedCanvas()) {
mozilla::gl::GLContext* gl = gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext();
MOZ_ASSERT(gl);
HTMLVideoElement* video = &aImage.GetAsHTMLVideoElement();
if (!video) {
@ -5646,7 +5648,7 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasLayer::Data data;
GLuint skiaGLTex = SkiaGLTex();
if (skiaGLTex) {
if (mIsSkiaGL && skiaGLTex) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);
@ -5700,7 +5702,7 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
GLuint skiaGLTex = SkiaGLTex();
if (skiaGLTex) {
if (mIsSkiaGL && skiaGLTex) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);

View File

@ -740,10 +740,11 @@ IMEContentObserver::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
mIsHandlingQueryContentEvent = true;
ContentEventHandler handler(GetPresContext());
nsresult rv = handler.HandleQueryContentEvent(aEvent);
if (aEvent->mSucceeded) {
// We need to guarantee that mRootContent should be always same value for
// the observing editor.
aEvent->mReply.mContentsRoot = mRootContent;
if (!IsInitializedWithPlugin() &&
NS_WARN_IF(aEvent->mReply.mContentsRoot != mRootContent)) {
// Focus has changed unexpectedly, so make the query fail.
aEvent->mSucceeded = false;
}
return rv;
}
@ -1261,7 +1262,8 @@ IMEContentObserver::UpdateSelectionCache()
WidgetQueryContentEvent selection(true, eQuerySelectedText, mWidget);
ContentEventHandler handler(GetPresContext());
handler.OnQuerySelectedText(&selection);
if (NS_WARN_IF(!selection.mSucceeded)) {
if (NS_WARN_IF(!selection.mSucceeded) ||
NS_WARN_IF(selection.mReply.mContentsRoot != mRootContent)) {
return false;
}

View File

@ -3,5 +3,4 @@ skip-if = buildapp == 'b2g' || os == 'android'
support-files =
file_anchor_ping.html
[test_allowMedia.html]
[test_anchor_ping.html]

View File

@ -608,3 +608,4 @@ skip-if = buildapp == 'b2g' || (e10s && debug && os == 'win') # bug 1129014
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android'
[test_bug1233598.html]
[test_bug1250401.html]
[test_allowMedia.html]

View File

@ -6,8 +6,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=759964
<head>
<meta charset="utf-8">
<title>Test for Bug 759964</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 759964 **/
@ -35,7 +35,7 @@ var tests = [
// doesn't load its source.
function basic() {
var iframe = insertIframe();
docshellForWindow(iframe.contentWindow).allowMedia = false;
SpecialPowers.allowMedia(iframe.contentWindow, false);
loadIframe(iframe, TEST_PAGE, function () {
verifyPass();
iframe.remove();
@ -46,14 +46,13 @@ var tests = [
// Set allowMedia = false on parent docshell, load a page with <audio> in a
// child iframe, verify the <audio> doesn't load its source.
function inherit() {
var docshell = docshellForWindow(window);
docshell.allowMedia = false;
SpecialPowers.allowMedia(window, false);
var iframe = insertIframe();
loadIframe(iframe, TEST_PAGE, function () {
verifyPass();
iframe.remove();
docshell.allowMedia = true;
SpecialPowers.allowMedia(window, true);
runNextTest();
});
},
@ -63,7 +62,7 @@ var tests = [
function displayNone() {
var iframe = insertIframe();
iframe.style.display = "none";
docshellForWindow(iframe.contentWindow).allowMedia = false;
SpecialPowers.allowMedia(iframe.contentWindow, false);
loadIframe(iframe, TEST_PAGE, function () {
verifyPass();
iframe.remove();
@ -72,13 +71,6 @@ var tests = [
},
];
function docshellForWindow(win) {
return win.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIWebNavigation).
QueryInterface(Ci.nsIDocShell);
}
function insertIframe() {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);

View File

@ -205,6 +205,10 @@ BenchmarkPlayback::MainThreadShutdown()
{
MOZ_ASSERT(OnThread());
if (mFinished) {
// Nothing more to do.
return;
}
mFinished = true;
if (mDecoder) {

View File

@ -15,8 +15,6 @@ MOCHITEST_MANIFESTS += [
'test/mochitest.ini',
]
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
TEST_HARNESS_FILES.testing.mochitest.tests.dom.media.webaudio.test.blink += [
'test/blink/audio-testing.js',
'test/blink/convolution-testing.js',

View File

@ -1,7 +0,0 @@
[DEFAULT]
skip-if = buildapp == 'b2g'
[test_AudioNodeDevtoolsAPI.html]
[test_bug1027864.html]
[test_AudioParamDevtoolsAPI.html]
[test_ScriptProcessorCollected1.html]

View File

@ -55,6 +55,8 @@ skip-if = buildapp == 'mulet'
tags=capturestream
[test_audioDestinationNode.html]
[test_AudioListener.html]
[test_AudioNodeDevtoolsAPI.html]
[test_AudioParamDevtoolsAPI.html]
[test_audioParamExponentialRamp.html]
[test_audioParamGain.html]
[test_audioParamLinearRamp.html]
@ -88,6 +90,7 @@ tags=capturestream
tags=capturestream
[test_bug972678.html]
[test_bug1118372.html]
[test_bug1027864.html]
[test_bug1056032.html]
skip-if = toolkit == 'android' # bug 1056706
[test_channelMergerNode.html]
@ -168,6 +171,7 @@ skip-if = (toolkit == 'gonk' && !debug) || android_version == '10' || android_ve
[test_stereoPannerNodePassThrough.html]
[test_periodicWave.html]
[test_periodicWaveBandLimiting.html]
[test_ScriptProcessorCollected1.html]
[test_scriptProcessorNode.html]
[test_scriptProcessorNodeChannelCount.html]
[test_scriptProcessorNodePassThrough.html]

View File

@ -2,28 +2,30 @@
<html>
<head>
<title>Test the devtool AudioNode API</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
Components.utils.import('resource://gre/modules/Services.jsm');
SimpleTest.waitForExplicitFinish();
function id(node) {
return SpecialPowers.getPrivilegedProps(node, "id");
}
var ac = new AudioContext();
var ids;
var weak;
(function() {
var src1 = ac.createBufferSource();
var src2 = ac.createBufferSource();
ok(src2.id > src1.id, "The ID should be monotonic");
ok(src1.id > ac.destination.id, "The ID of the destination node should be the lowest");
ids = [src1.id, src2.id];
weak = Components.utils.getWeakReference(src1);
is(weak.get(), src1, "The node should support a weak reference");
ok(id(src2) > id(src1), "The ID should be monotonic");
ok(id(src1) > id(ac.destination), "The ID of the destination node should be the lowest");
ids = [id(src1), id(src2)];
weak = SpecialPowers.Cu.getWeakReference(src1);
is(SpecialPowers.unwrap(weak.get()), src1, "The node should support a weak reference");
})();
function observer(subject, topic, data) {
var id = parseInt(data);
@ -34,13 +36,13 @@
if (ids.length == 0) {
SimpleTest.executeSoon(function() {
is(weak.get(), null, "The weak reference must be dropped now");
Services.obs.removeObserver(observer, "webaudio-node-demise");
SpecialPowers.removeObserver(observer, "webaudio-node-demise");
SimpleTest.finish();
});
}
}
}
Services.obs.addObserver(observer, "webaudio-node-demise", false);
SpecialPowers.addObserver(observer, "webaudio-node-demise", false);
forceCC();
forceCC();

View File

@ -2,18 +2,19 @@
<html>
<head>
<title>Test the devtool AudioParam API</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
Components.utils.import('resource://gre/modules/Services.jsm');
function checkIdAndName(node, name) {
is(node.id, node[name].parentNodeId, "The parent id should be correct");
is(node[name].name, name, "The name of the AudioParam should be correct.");
is(SpecialPowers.getPrivilegedProps(node, "id"),
SpecialPowers.getPrivilegedProps(node[name], "parentNodeId"),
"The parent id should be correct");
is(SpecialPowers.getPrivilegedProps(node[name], "name"), name,
"The name of the AudioParam should be correct.");
}
var ac = new AudioContext(),

View File

@ -2,13 +2,12 @@
<html>
<head>
<title>Test ScriptProcessorNode in cycle with no listener is collected</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="text/javascript">
Components.utils.import('resource://gre/modules/Services.jsm');
SimpleTest.waitForExplicitFinish();
var observer = function(subject, topic, data) {
@ -20,11 +19,11 @@ var observer = function(subject, topic, data) {
}
}
Services.obs.addObserver(observer, "webaudio-node-demise", false);
SpecialPowers.addObserver(observer, "webaudio-node-demise", false);
SimpleTest.registerCleanupFunction(function() {
if (observer) {
Services.obs.removeObserver(observer, "webaudio-node-demise");
SpecialPowers.removeObserver(observer, "webaudio-node-demise");
}
});
@ -59,7 +58,7 @@ testProcessor.onaudioprocess = function(event) {
// Expect that webaudio-demise has been queued.
// Queue another event to check.
SimpleTest.executeSoon(function() {
Services.obs.removeObserver(observer, "webaudio-node-demise");
SpecialPowers.removeObserver(observer, "webaudio-node-demise");
observer = null;
event.target.onaudioprocess = null;
ok(ids.length == 0, "All expected nodes should be collected");
@ -69,8 +68,12 @@ testProcessor.onaudioprocess = function(event) {
}
};
function id(node) {
return SpecialPowers.getPrivilegedProps(node, "id");
}
// Nodes with these ids should be collected.
var ids = [ testProcessor.id, delay.id, gain.id ];
var ids = [ id(testProcessor), id(delay), id(gain) ];
testProcessor = null;
delay = null;
gain = null;

View File

@ -2,14 +2,13 @@
<html>
<head>
<title>Test bug 1027864</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
Components.utils.import('resource://gre/modules/Services.jsm');
SimpleTest.waitForExplicitFinish();
function observer(subject, topic, data) {
@ -26,10 +25,14 @@ function observer(subject, topic, data) {
}
}
Services.obs.addObserver(observer, "webaudio-node-demise", false);
function id(node) {
return SpecialPowers.getPrivilegedProps(node, "id");
}
SpecialPowers.addObserver(observer, "webaudio-node-demise", false);
SimpleTest.registerCleanupFunction(function() {
Services.obs.removeObserver(observer, "webaudio-node-demise");
SpecialPowers.removeObserver(observer, "webaudio-node-demise");
});
var ac = new AudioContext();
@ -53,7 +56,7 @@ var ids;
source.start(ac.currentTime);
source.stop(ac.currentTime + 0.1);
ids = [ delay.id, gain.id, source.id ];
ids = [ id(delay), id(gain), id(source) ];
})();
setInterval(function() {

View File

@ -17,7 +17,13 @@
#include "nsThreadUtils.h"
#include "prlink.h"
#define URI_PREFIX "urn:moz-tts:sapi:"
#include <math.h>
#include <stdlib.h>
#define URI_PREFIX "urn:moz-tts:speechd:"
#define MAX_RATE static_cast<float>(2.5)
#define MIN_RATE static_cast<float>(0.5)
// Some structures for libspeechd
typedef enum {
@ -473,17 +479,18 @@ SpeechDispatcherService::Speak(const nsAString& aText, const nsAString& aUri,
// We provide a volume of 0.0 to 1.0, speech-dispatcher expects 0 - 100.
spd_set_volume(mSpeechdClient, static_cast<int>(aVolume * 100));
// We provide a rate of 0.1 to 10 with 1 being default.
// speech-dispatcher expects -100 to 100 with 0 being default.
int rate = 0;
// aRate is a value of 0.1 (0.1x) to 10 (10x) with 1 (1x) being normal rate.
// speechd expects -100 to 100 with 0 being normal rate.
float rate = 0;
if (aRate > 1) {
rate = static_cast<int>((aRate - 1) * 10);
} else if (aRate <= 1) {
rate = static_cast<int>((aRate - 1) * (100/0.9));
// Each step to 100 is logarithmically distributed up to 2.5x.
rate = log10(std::min(aRate, MAX_RATE)) / log10(MAX_RATE) * 100;
} else if (aRate < 1) {
// Each step to -100 is logarithmically distributed down to 0.5x.
rate = log10(std::max(aRate, MIN_RATE)) / log10(MIN_RATE) * -100;
}
spd_set_voice_rate(mSpeechdClient, rate);
spd_set_voice_rate(mSpeechdClient, static_cast<int>(rate));
// We provide a pitch of 0 to 2 with 1 being the default.
// speech-dispatcher expects -100 to 100 with 0 being default.

View File

@ -331,10 +331,21 @@ SapiService::Speak(const nsAString& aText, const nsAString& aUri,
if (FAILED(mSapiClient->SetVoice(voiceToken))) {
return NS_ERROR_FAILURE;
}
if (FAILED(mSapiClient->SetVolume(static_cast<USHORT>(aVolume * 100)))) {
return NS_ERROR_FAILURE;
}
if (FAILED(mSapiClient->SetRate(static_cast<long>(10 * log10(aRate))))) {
// The max supported rate in SAPI engines is 3x, and the min is 1/3x. It is
// expressed by an integer. 0 being normal rate, -10 is 1/3 and 10 is 3x.
// Values below and above that are allowed, but the engine may clip the rate
// to its maximum capable value.
// "Each increment between -10 and +10 is logarithmically distributed such
// that incrementing or decrementing by 1 is multiplying or dividing the
// rate by the 10th root of 3"
// https://msdn.microsoft.com/en-us/library/ee431826(v=vs.85).aspx
long rate = aRate != 0 ? static_cast<long>(10 * log10(aRate) / log10(3)) : 0;
if (FAILED(mSapiClient->SetRate(rate))) {
return NS_ERROR_FAILURE;
}

View File

@ -72,7 +72,7 @@ else:
UNIFIED_SOURCES += [
'nsPluginsDirUnix.cpp',
]
if CONFIG['MOZ_ENABLE_GTK']:
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
# This file cannot be built in unified mode because of name clashes in X11 headers.
SOURCES += [
'nsPluginNativeWindowGtk.cpp',

View File

@ -204,7 +204,7 @@ static void LoadExtraSharedLibs()
}
}
}
#endif //MOZ_WIDGET_GTK2
#endif //MOZ_WIDGET_GTK == 2
/* nsPluginsDir implementation */
@ -302,7 +302,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
#else
*outLibrary = PR_LoadLibraryWithFlags(libSpec, 0);
pLibrary = *outLibrary;
#endif // MOZ_WIDGET_GTK2
#endif // MOZ_WIDGET_GTK == 2
#ifdef DEBUG
printf("LoadPlugin() %s returned %lx\n",

View File

@ -0,0 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function handleRequest(request, response) {
try {
var cookie = request.getHeader("Cookie");
} catch (e) {
cookie = "EMPTY_COOKIE";
}
// avoid confusing cache behaviors.
response.setHeader("Cache-Control", "no-cache", false);
// allow XHR requests accross origin.
response.setHeader("Access-control-allow-origin", "*");
response.setHeader("Content-type", "text/plain", false);
response.setStatusLine(request.httpVersion, "200", "OK");
response.write(cookie);
}

View File

@ -0,0 +1,9 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<meta charset=UTF-8>
<body>
<script>document.cookie = "found=another_cookie";</script>
</body>
</html>

View File

@ -96,6 +96,10 @@ skip-if = toolkit != "gtk2"
support-files = plugin_scroll_invalidation.html
[test_plugin_scroll_painting.html]
skip-if = true # Bug 596491
[test_pluginstream_3rdparty.html]
support-files =
file_checkcookie.sjs
file_setcookie.html
[test_pluginstream_asfile.html]
[test_pluginstream_asfileonly.html]
[test_pluginstream_err.html]
@ -133,4 +137,4 @@ skip-if = toolkit == "cocoa"
[test_zero_opacity.html]
[test_bug1165981.html]
skip-if = !(os == "win" && processor == "x86_64" && !e10s) # Bug 1253957
[test_bug1245545.html]
[test_bug1245545.html]

View File

@ -1,10 +1,15 @@
SimpleTest.waitForExplicitFinish();
function frameLoaded() {
function frameLoaded(finishWhenCalled = true, lastObject = false) {
var testframe = document.getElementById('testframe');
var embed = document.getElementsByTagName('embed')[0];
function getNode(list) {
if (list.length === 0)
return undefined;
return lastObject ? list[list.length - 1] : list[0];
}
var embed = getNode(document.getElementsByTagName('embed'));
if (undefined === embed)
embed = document.getElementsByTagName('object')[0];
embed = getNode(document.getElementsByTagName('object'));
// In the file:// URI case, this ends up being cross-origin.
// Skip these checks in that case.
@ -28,5 +33,7 @@
}
is(embed.getError(), "pass", "plugin reported error");
SimpleTest.finish();
if (finishWhenCalled) {
SimpleTest.finish();
}
}

View File

@ -0,0 +1,76 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<head>
<title>NPAPI NPN_GetURL NPStream Test</title>
<meta charset=UTF-8>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="pluginstream.js"></script>
<script type="text/javascript" src="plugin-utils.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript">
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<iframe id="testframe" name="testframe"></iframe>
<script>
/**
* Tests that we still properly do or don't send cookies for requests from
* plugins when the user has disabled 3rd-party cookies. See
* pluginstream.js where we verify that we get the same content as for XHR
* requests.
*/
SimpleTest.waitForExplicitFinish();
function get_embed_elt() {
var e = document.createElement("embed");
e.setAttribute("streammode", "normal");
e.setAttribute("streamchunksize", "1024");
e.setAttribute("frame", "testframe");
e.setAttribute("id", "embedtest");
e.setAttribute("style", "width: 400px; height: 100px;");
e.setAttribute("type", "application/x-test");
return e;
}
function* test_runner() {
function create_embed(host) {
var e = get_embed_elt();
const url =
`http://${host}/tests/dom/plugins/test/mochitest/file_checkcookie.sjs`;
e.setAttribute('geturl', url);
document.body.appendChild(e);
return new Promise(resolve => {
$('testframe').addEventListener("load", function loaded() {
$('testframe').removeEventListener("load", loaded);
resolve();
});
});
}
// Same origin
yield create_embed("mochi.test:8888");
yield create_embed("example.org");
}
document.cookie = "found=a_cookie";
var example_iframe = document.createElement("iframe");
example_iframe.src = "http://example.org/tests/dom/plugins/test/mochitest/file_setcookie.html";
example_iframe.addEventListener("load", () => {
$('testframe').addEventListener("load", () => frameLoaded(false, true));
SpecialPowers.pushPrefEnv({ set: [[ 'network.cookie.cookieBehavior', 1 ]] },
() => (spawn_task(test_runner).then(SimpleTest.finish)));
});
document.body.appendChild(example_iframe);
</script>
</body>
</html>

View File

@ -106,6 +106,9 @@ this.PushService = {
// reduce the quota for a record. Used for testing purposes.
_updateQuotaTestCallback: null,
// Set of timeout ID of tasks to reduce quota.
_updateQuotaTimeouts: new Set(),
// When serverURI changes (this is used for testing), db is cleaned up and a
// a new db is started. This events must be sequential.
_stateChangeProcessQueue: null,
@ -239,7 +242,7 @@ this.PushService = {
* aren't very good at automatically cleaning up, so we don't get shutdown
* leaks on browser shutdown.
*/
case "xpcom-shutdown":
case "quit-application":
this.uninit();
break;
case "network-active-changed": /* On B2G. */
@ -423,7 +426,7 @@ this.PushService = {
/**
* PushService initialization is divided into 4 parts:
* init() - start listening for xpcom-shutdown and serverURL changes.
* init() - start listening for quit-application and serverURL changes.
* state is change to PUSH_SERVICE_INIT
* startService() - if serverURL is present this function is called. It starts
* listening for broadcasted messages, starts db and
@ -445,7 +448,7 @@ this.PushService = {
this._setState(PUSH_SERVICE_ACTIVATING);
Services.obs.addObserver(this, "xpcom-shutdown", false);
Services.obs.addObserver(this, "quit-application", false);
if (options.serverURI) {
// this is use for xpcshell test.
@ -541,7 +544,7 @@ this.PushService = {
* stopService() - It stops listening for broadcasted messages, stops db and
* PushService connection (WebSocket).
* state is changed to PUSH_SERVICE_INIT.
* uninit() - stop listening for xpcom-shutdown and serverURL changes.
* uninit() - stop listening for quit-application and serverURL changes.
* state is change to PUSH_SERVICE_UNINIT
*/
_stopService: function(event) {
@ -557,6 +560,9 @@ this.PushService = {
this._service.uninit();
this._service = null;
this._updateQuotaTimeouts.forEach((timeoutID) => clearTimeout(timeoutID));
this._updateQuotaTimeouts.clear();
if (!this._db) {
return Promise.resolve();
}
@ -600,7 +606,7 @@ this.PushService = {
}
prefs.ignore("serverURL", this);
Services.obs.removeObserver(this, "xpcom-shutdown");
Services.obs.removeObserver(this, "quit-application");
this._stateChangeProcessEnqueue(_ =>
{
@ -801,8 +807,14 @@ this.PushService = {
}
// Update quota after the delay, at which point
// we check for visible notifications.
setTimeout(() => this._updateQuota(keyID),
prefs.get("quotaUpdateDelay"));
let timeoutID = setTimeout(_ =>
{
this._updateQuota(keyID);
if (!this._updateQuotaTimeouts.delete(timeoutID)) {
console.debug("receivedPushMessage: quota update timeout missing?");
}
}, prefs.get("quotaUpdateDelay"));
this._updateQuotaTimeouts.add(timeoutID);
return notified;
}, error => {
console.error("receivedPushMessage: Error decrypting message", error);

View File

@ -219,6 +219,7 @@ var SubscriptionListener = function(aSubInfo, aResolve, aReject,
this._serverURI = aServerURI;
this._service = aPushServiceHttp2;
this._ctime = Date.now();
this._retryTimeoutID = null;
};
SubscriptionListener.prototype = {
@ -261,12 +262,17 @@ SubscriptionListener.prototype = {
if (this._subInfo.retries < prefs.get("http2.maxRetries")) {
this._subInfo.retries++;
var retryAfter = retryAfterParser(aRequest);
setTimeout(_ => this._reject(
this._retryTimeoutID = setTimeout(_ =>
{
retry: true,
subInfo: this._subInfo
}),
retryAfter);
this._reject(
{
retry: true,
subInfo: this._subInfo
});
this._service.removeListenerPendingRetry(this);
this._retryTimeoutID = null;
}, retryAfter);
this._service.addListenerPendingRetry(this);
} else {
this._reject(new Error("Unexpected server response: " + statusCode));
}
@ -329,6 +335,15 @@ SubscriptionListener.prototype = {
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_HTTP2_TIME").add(Date.now() - this._ctime);
this._resolve(reply);
},
abortRetry: function() {
if (this._retryTimeoutID != null) {
clearTimeout(this._retryTimeoutID);
this._retryTimeoutID = null;
} else {
console.debug("SubscriptionListener.abortRetry: aborting non-existent retry?");
}
},
};
function retryAfterParser(aRequest) {
@ -402,6 +417,9 @@ this.PushServiceHttp2 = {
_conns: {},
_started: false,
// Set of SubscriptionListeners that are pending a subscription retry attempt.
_listenersPendingRetry: new Set(),
newPushDB: function() {
return new PushDB(kPUSHHTTP2DB_DB_NAME,
kPUSHHTTP2DB_DB_VERSION,
@ -678,10 +696,15 @@ this.PushServiceHttp2 = {
uninit: function() {
console.debug("uninit()");
this._abortPendingSubscriptionRetries();
this._shutdownConnections(true);
this._mainPushService = null;
},
_abortPendingSubscriptionRetries: function() {
this._listenersPendingRetry.forEach((listener) => listener.abortRetry());
this._listenersPendingRetry.clear();
},
request: function(action, aRecord) {
switch (action) {
@ -752,6 +775,16 @@ this.PushServiceHttp2 = {
}
},
addListenerPendingRetry: function(aListener) {
this._listenersPendingRetry.add(aListener);
},
removeListenerPendingRetry: function(aListener) {
if (!this._listenersPendingRetry.remove(aListener)) {
console.debug("removeListenerPendingRetry: listener not in list?");
}
},
_pushChannelOnStop: function(aUri, aAckUri, aMessage, cryptoParams) {
console.debug("pushChannelOnStop()");

View File

@ -614,6 +614,9 @@ nsCSPContext::SetRequestContext(nsIDOMDocument* aDOMDocument,
// console messages until it becomes available, see flushConsoleMessages
mQueueUpMessages = !mInnerWindowID;
mCallingChannelLoadGroup = doc->GetDocumentLoadGroup();
// set the flag on the document for CSP telemetry
doc->SetHasCSP(true);
}
else {
NS_WARNING("No Document in SetRequestContext; can not query loadgroup; sending reports may fail.");

View File

@ -81,6 +81,10 @@ class nsCSPContext : public nsIContentSecurityPolicy
mLoadingPrincipal = nullptr;
}
nsWeakPtr GetLoadingContext(){
return mLoadingContext;
}
private:
bool permitsInternal(CSPDirective aDir,
nsIURI* aContentLocation,

View File

@ -578,6 +578,10 @@ nsCSPParser::keywordSource()
}
if (CSP_IsKeyword(mCurToken, CSP_UNSAFE_INLINE)) {
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mCSPContext->GetLoadingContext());
if (doc) {
doc->SetHasUnsafeInlineCSP(true);
}
// make sure script-src only contains 'unsafe-inline' once;
// ignore duplicates and log warning
if (mUnsafeInlineKeywordSrc) {
@ -593,6 +597,10 @@ nsCSPParser::keywordSource()
}
if (CSP_IsKeyword(mCurToken, CSP_UNSAFE_EVAL)) {
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mCSPContext->GetLoadingContext());
if (doc) {
doc->SetHasUnsafeEvalCSP(true);
}
return new nsCSPKeywordSrc(CSP_KeywordToEnum(mCurToken));
}
return nullptr;

View File

@ -74,18 +74,23 @@ function getNewY(aWindow)
* If times < 0, the event loop will be hitten as long as the condition isn't
* true or the test doesn't time out.
*/
function hitEventLoop(condition, test, times, next) {
if (condition() || times == 0) {
test();
next();
return;
}
function hitEventLoop(condition, test, times) {
return new Promise(function(resolve, reject) {
function doMagic() {
if (condition() || times == 0) {
test();
resolve();
return;
}
setTimeout(hitEventLoop, 0, condition, test, times - 1, next);
setTimeout(doMagic, 0, condition, test, times - 1);
}
doMagic();
});
}
function checkChangeIsDisabled(aWindow, aNext)
{
function checkChangeIsDisabled(aWindow) {
// We want to check that nothing has changed. Having a high value would take
// too much time. Worse thing that could happen is random green.
var hits = 5;
@ -165,7 +170,7 @@ function checkChangeIsDisabled(aWindow, aNext)
// happens.
// NOTE: if this happens to fail, you will have to check manually which
// operation has been accepted.
hitEventLoop(changeCondition, changeTest, hits, aNext);
return hitEventLoop(changeCondition, changeTest, hits);
}
function checkChangeIsEnabled(aWindow, aNext)
@ -246,59 +251,74 @@ function checkChangeIsEnabled(aWindow, aNext)
aWindow.innerWidth = getNewWidth(aWindow);
aWindow.innerHeight = getNewHeight(aWindow);
hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
hitEventLoop(sizeChangeCondition, sizeChangeTest, hits)
.then(function() {
aWindow.resizeTo(getNewWidth(aWindow), getNewHeight(aWindow));
hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
})
.then(function() {
return hitEventLoop(sizeChangeCondition, sizeChangeTest, hits);
})
.then(function () {
aWindow.resizeBy(getNewWidth(aWindow) - aWindow.innerWidth,
getNewHeight(aWindow) - aWindow.innerHeight);
hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
})
.then(function() {
return hitEventLoop(sizeChangeCondition, sizeChangeTest, hits);
})
.then(function () {
prevWidth = aWindow.innerWidth = getNewWidth(aWindow);
prevHeight = aWindow.innerHeight = getNewHeight(aWindow);
aWindow.sizeToContent();
hitEventLoop(sizeChangeCondition, sizeChangeTest, hits, function () {
/**
* Position checks.
*/
})
.then(function() {
hitEventLoop(sizeChangeCondition, sizeChangeTest, hits);
})
.then(function() {
/**
* Position checks.
*/
prevX = aWindow.screenX;
prevY = aWindow.screenY;
aWindow.screenX = getNewX(aWindow);
aWindow.screenY = getNewY(aWindow);
hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
})
.then(function() {
return hitEventLoop(posChangeCondition, posChangeTest, hits);
})
.then(function() {
prevX = aWindow.screenX;
prevY = aWindow.screenY;
aWindow.moveTo(getNewX(aWindow), getNewY(aWindow));
hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
})
.then(function() {
return hitEventLoop(posChangeCondition, posChangeTest, hits);
})
.then(function() {
prevX = aWindow.screenX;
prevY = aWindow.screenY;
aWindow.moveBy(getNewX(aWindow) - aWindow.screenX,
getNewY(aWindow) - aWindow.screenY);
hitEventLoop(posChangeCondition, posChangeTest, hits, function () {
/**
* Outer width/height checks.
*/
})
.then(function() {
return hitEventLoop(posChangeCondition, posChangeTest, hits);
})
.then(function() {
/**
* Outer width/height checks.
*/
oWidth = aWindow.outerWidth;
oHeight = aWindow.outerHeight;
aWindow.outerWidth = oWidth * 2;
aWindow.outerHeight = oHeight * 2;
hitEventLoop(outerChangeCondition, outerChangeTest, hits, aNext);
});
});
});
});
});
});
});
})
.then(function() {
return hitEventLoop(outerChangeCondition, outerChangeTest, hits);
})
.then(aNext);
}
SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_move_resize", false]]}, function() {
@ -312,7 +332,7 @@ SimpleTest.waitForFocus(function() {
backValues();
// The current window can't change it's own size and position.
checkChangeIsDisabled(window, function() {
checkChangeIsDisabled(window).then(function() {
// We create a window and check that it can change its own size and position.
// However, passing size/position parameters to window.open should work.
var w = window.open("data:text/html,<script>" +
@ -339,14 +359,14 @@ SimpleTest.waitForFocus(function() {
// In that case, we shouldn't allow the caller to change the size/position.
w = window.open("data:text/html,<script>" +
"function check(next) {" +
" window.opener.checkChangeIsDisabled(window, next);" +
" window.opener.checkChangeIsDisabled(window).then(next);" +
"} <\/script>", '', '');
SimpleTest.waitForFocus(function() {
w.check(function() {
// The current window can't change the size and position of the new tab.
checkChangeIsDisabled(w, function() {
checkChangeIsDisabled(w).then(function() {
w.close();
restoreValues();

View File

@ -120,8 +120,6 @@ interface DOMApplication : EventTarget {
interface DOMApplicationsManager : EventTarget {
DOMRequest getAll();
[CheckAnyPermissions="webapps-manage"]
DOMRequest getNotInstalled();
[CheckAnyPermissions="webapps-manage"]
void applyDownload(DOMApplication app);
DOMRequest uninstall(DOMApplication app);

View File

@ -27,7 +27,6 @@
#include "RuntimeService.h"
USING_WORKERS_NAMESPACE
using namespace mozilla;
using namespace mozilla::dom;
using mozilla::dom::Optional;
@ -47,7 +46,7 @@ FileReaderSync::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aReflector)
{
return FileReaderSyncBinding_workers::Wrap(aCx, this, aGivenProto, aReflector);
return FileReaderSyncBinding::Wrap(aCx, this, aGivenProto, aReflector);
}
void

View File

@ -4,8 +4,8 @@
* 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/. */
#ifndef mozilla_dom_workers_filereadersync_h__
#define mozilla_dom_workers_filereadersync_h__
#ifndef mozilla_dom_filereadersync_h__
#define mozilla_dom_filereadersync_h__
#include "Workers.h"
@ -18,10 +18,6 @@ namespace dom {
class Blob;
class GlobalObject;
template<typename> class Optional;
} // namespace dom
} // namespace mozilla
BEGIN_WORKERS_NAMESPACE
class FileReaderSync final
{
@ -51,6 +47,7 @@ public:
void ReadAsDataURL(Blob& aBlob, nsAString& aResult, ErrorResult& aRv);
};
END_WORKERS_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_workers_filereadersync_h__
#endif // mozilla_dom_filereadersync_h__

View File

@ -49,6 +49,7 @@
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsISupportsImpl.h"
#include "nsLayoutStatics.h"
#include "nsNetUtil.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "nsXPCOM.h"
@ -65,6 +66,7 @@
#include "WorkerDebuggerManager.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
#include "WorkerThread.h"
using namespace mozilla;

View File

@ -31,6 +31,7 @@
#include "nsNetUtil.h"
#include "nsIPipe.h"
#include "nsIOutputStream.h"
#include "nsPrintfCString.h"
#include "nsScriptLoader.h"
#include "nsString.h"
#include "nsStreamUtils.h"
@ -41,6 +42,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/LoadContext.h"
#include "mozilla/Maybe.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/dom/CacheBinding.h"
#include "mozilla/dom/cache/CacheTypes.h"
@ -52,6 +54,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseNativeHandler.h"
#include "mozilla/dom/Response.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/UniquePtr.h"
#include "Principal.h"
#include "WorkerFeature.h"
@ -63,13 +66,11 @@
USING_WORKERS_NAMESPACE
using namespace mozilla;
using namespace mozilla::dom;
using mozilla::dom::cache::Cache;
using mozilla::dom::cache::CacheStorage;
using mozilla::dom::Promise;
using mozilla::dom::PromiseNativeHandler;
using mozilla::ErrorResult;
using mozilla::ipc::PrincipalInfo;
using mozilla::UniquePtr;
namespace {

View File

@ -13,7 +13,10 @@
#include "mozilla/dom/ServiceWorkerMessageEvent.h"
#include "mozilla/dom/ServiceWorkerMessageEventBinding.h"
#include "nsGlobalWindow.h"
#include "nsIBrowserDOMWindow.h"
#include "nsIDocument.h"
#include "ServiceWorker.h"
#include "ServiceWorkerPrivate.h"
#include "WorkerPrivate.h"
using namespace mozilla;

View File

@ -4,18 +4,22 @@
* 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/. */
#include "ServiceWorkerClients.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseWorkerProxy.h"
#include "ServiceWorkerClient.h"
#include "ServiceWorkerClients.h"
#include "ServiceWorkerManager.h"
#include "ServiceWorkerPrivate.h"
#include "ServiceWorkerWindowClient.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
#include "nsContentUtils.h"
#include "nsIBrowserDOMWindow.h"
#include "nsIDocShell.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMWindow.h"
@ -24,6 +28,7 @@
#include "nsIWebProgressListener.h"
#include "nsIWindowMediator.h"
#include "nsIWindowWatcher.h"
#include "nsNetUtil.h"
#include "nsPIWindowWatcher.h"
#include "nsWindowWatcher.h"
#include "nsWeakReference.h"

View File

@ -6,6 +6,7 @@
#include "ServiceWorkerContainer.h"
#include "nsContentUtils.h"
#include "nsIDocument.h"
#include "nsIServiceWorkerManager.h"
#include "nsIURL.h"

View File

@ -10,6 +10,7 @@
#include "nsIHttpChannelInternal.h"
#include "nsINetworkInterceptController.h"
#include "nsIOutputStream.h"
#include "nsIScriptError.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
#include "nsComponentManagerUtils.h"
@ -19,6 +20,8 @@
#include "nsNetUtil.h"
#include "nsSerializationHelper.h"
#include "nsQueryObject.h"
#include "ServiceWorkerClient.h"
#include "ServiceWorkerManager.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Preferences.h"
@ -34,6 +37,9 @@
#include "mozilla/dom/workers/bindings/ServiceWorker.h"
#ifndef MOZ_SIMPLEPUSH
#include "mozilla/dom/PushEventBinding.h"
#include "mozilla/dom/PushMessageDataBinding.h"
#include "nsIUnicodeDecoder.h"
#include "nsIUnicodeEncoder.h"
@ -48,6 +54,7 @@
#include "xpcpublic.h"
using namespace mozilla::dom;
using namespace mozilla::dom::workers;
BEGIN_WORKERS_NAMESPACE
@ -1018,6 +1025,12 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PushMessageData)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
JSObject*
PushMessageData::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return mozilla::dom::PushMessageDataBinding::Wrap(aCx, this, aGivenProto);
}
void
PushMessageData::Json(JSContext* cx, JS::MutableHandle<JS::Value> aRetval,
ErrorResult& aRv)
@ -1127,6 +1140,12 @@ NS_INTERFACE_MAP_END_INHERITING(ExtendableEvent)
NS_IMPL_CYCLE_COLLECTION_INHERITED(PushEvent, ExtendableEvent, mData)
JSObject*
PushEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return mozilla::dom::PushEventBinding::Wrap(aCx, this, aGivenProto);
}
#endif /* ! MOZ_SIMPLEPUSH */
ExtendableMessageEvent::ExtendableMessageEvent(EventTarget* aOwner)

View File

@ -16,8 +16,6 @@
#include "mozilla/dom/workers/bindings/ServiceWorker.h"
#ifndef MOZ_SIMPLEPUSH
#include "mozilla/dom/PushEventBinding.h"
#include "mozilla/dom/PushMessageDataBinding.h"
#include "mozilla/dom/File.h"
#endif
@ -33,6 +31,8 @@ class MessagePort;
class MessagePortList;
class Request;
class ResponseOrPromise;
struct PushEventInit;
} // namespace dom
} // namespace mozilla
@ -188,10 +188,7 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PushMessageData)
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
return mozilla::dom::PushMessageDataBinding_workers::Wrap(aCx, this, aGivenProto);
}
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
nsISupports* GetParentObject() const {
return mOwner;
@ -228,10 +225,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PushEvent, ExtendableEvent)
NS_FORWARD_TO_EVENT
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
return mozilla::dom::PushEventBinding_workers::Wrap(aCx, this, aGivenProto);
}
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<PushEvent>
Constructor(mozilla::dom::EventTarget* aOwner,

View File

@ -25,12 +25,6 @@ namespace {
uint64_t sServiceWorkerManagerParentID = 0;
void
AssertIsInMainProcess()
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
}
class RegisterServiceWorkerCallback final : public nsRunnable
{
public:

View File

@ -7,6 +7,7 @@
#include "ServiceWorkerManagerService.h"
#include "ServiceWorkerManagerParent.h"
#include "ServiceWorkerRegistrar.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/unused.h"

View File

@ -5,11 +5,29 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ServiceWorkerPrivate.h"
#include "ServiceWorkerManager.h"
#include "nsContentUtils.h"
#include "nsIHttpChannelInternal.h"
#include "nsIHttpHeaderVisitor.h"
#include "nsINetworkInterceptController.h"
#include "nsISupportsImpl.h"
#include "nsIUploadChannel2.h"
#include "nsNetUtil.h"
#include "nsProxyRelease.h"
#include "nsQueryObject.h"
#include "nsStreamUtils.h"
#include "nsStringStream.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
#include "mozilla/Assertions.h"
#include "mozilla/dom/FetchUtil.h"
#include "mozilla/dom/IndexedDatabaseManager.h"
#include "mozilla/dom/InternalHeaders.h"
#include "mozilla/dom/NotificationEvent.h"
#include "mozilla/dom/PromiseNativeHandler.h"
#include "mozilla/dom/PushEventBinding.h"
#include "mozilla/dom/RequestBinding.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -11,11 +11,14 @@
#include "WorkerPrivate.h"
class nsIInterceptedChannel;
namespace mozilla {
namespace dom {
namespace workers {
class ServiceWorkerInfo;
class ServiceWorkerRegistrationInfo;
class KeepAliveToken;
class LifeCycleEventCallback : public nsRunnable

View File

@ -24,6 +24,7 @@
#include "mozilla/StaticPtr.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsAutoPtr.h"
#include "nsContentUtils.h"
#include "nsDirectoryServiceUtils.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"

View File

@ -19,8 +19,10 @@
#include "nsIThreadRetargetableRequest.h"
#include "nsIPrincipal.h"
#include "nsContentUtils.h"
#include "nsNetUtil.h"
#include "nsScriptLoader.h"
#include "ServiceWorkerManager.h"
#include "Workers.h"
#include "nsStringStream.h"

View File

@ -16,6 +16,8 @@ namespace mozilla {
namespace dom {
namespace workers {
class ServiceWorkerRegistrationInfo;
namespace serviceWorkerScriptCache {
nsresult

View File

@ -12,9 +12,12 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseWorkerProxy.h"
#include "mozilla/UniquePtr.h"
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"
#include "WorkerPrivate.h"
#include "WorkerScope.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::workers;

View File

@ -21,6 +21,7 @@
using mozilla::dom::Optional;
using mozilla::dom::Sequence;
using mozilla::dom::MessagePort;
using namespace mozilla;
USING_WORKERS_NAMESPACE

View File

@ -14,6 +14,7 @@
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
#define WORKERDEBUGGERMANAGER_CID \
{ 0x62ec8731, 0x55ad, 0x4246, \

View File

@ -4,11 +4,12 @@
* 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/. */
#include "Location.h"
#include "mozilla/dom/WorkerLocation.h"
#include "mozilla/dom/WorkerLocationBinding.h"
BEGIN_WORKERS_NAMESPACE
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerLocation)
@ -16,7 +17,7 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WorkerLocation, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WorkerLocation, Release)
/* static */ already_AddRefed<WorkerLocation>
WorkerLocation::Create(WorkerPrivate::LocationInfo& aInfo)
WorkerLocation::Create(workers::WorkerPrivate::LocationInfo& aInfo)
{
RefPtr<WorkerLocation> location =
new WorkerLocation(NS_ConvertUTF8toUTF16(aInfo.mHref),
@ -35,7 +36,8 @@ WorkerLocation::Create(WorkerPrivate::LocationInfo& aInfo)
JSObject*
WorkerLocation::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return WorkerLocationBinding_workers::Wrap(aCx, this, aGivenProto);
return WorkerLocationBinding::Wrap(aCx, this, aGivenProto);
}
END_WORKERS_NAMESPACE
} // namespace dom
} // namespace mozilla

View File

@ -4,14 +4,15 @@
* 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/. */
#ifndef mozilla_dom_workers_location_h__
#define mozilla_dom_workers_location_h__
#ifndef mozilla_dom_location_h__
#define mozilla_dom_location_h__
#include "Workers.h"
#include "WorkerPrivate.h"
#include "nsWrapperCache.h"
BEGIN_WORKERS_NAMESPACE
namespace mozilla {
namespace dom {
class WorkerLocation final : public nsWrapperCache
{
@ -58,7 +59,7 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation)
static already_AddRefed<WorkerLocation>
Create(WorkerPrivate::LocationInfo& aInfo);
Create(workers::WorkerPrivate::LocationInfo& aInfo);
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@ -109,6 +110,7 @@ public:
}
};
END_WORKERS_NAMESPACE
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_workers_location_h__
#endif // mozilla_dom_location_h__

Some files were not shown because too many files have changed in this diff Show More