This commit is contained in:
Ryan VanderMeulen 2015-01-23 12:33:22 -05:00
Родитель e67db31d2d f6ca65e867
Коммит c9c4f1d6bc
307 изменённых файлов: 2921 добавлений и 26672 удалений

10
addon-sdk/source/app-extension/bootstrap.js поставляемый
Просмотреть файл

@ -50,7 +50,15 @@ function setResourceSubstitution(domain, uri) {
function readURI(uri) {
let ioservice = Cc['@mozilla.org/network/io-service;1'].
getService(Ci.nsIIOService);
let channel = ioservice.newChannel(uri, 'UTF-8', null);
let channel = ioservice.newChannel2(uri,
'UTF-8',
null,
null, // aLoadingNode
systemPrincipal,
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = channel.open();
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].

Просмотреть файл

@ -15,6 +15,7 @@ const IOService = Cc["@mozilla.org/network/io-service;1"].
const { deprecateFunction } = require('../util/deprecate');
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm");
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
const FaviconService = Cc["@mozilla.org/browser/favicon-service;1"].
getService(Ci.nsIFaviconService);
@ -51,7 +52,14 @@ exports.getFaviconURIForLocation = getFaviconURIForLocation;
* @returns {String}
*/
function getChromeURIContent(chromeURI) {
let channel = IOService.newChannel(chromeURI, null, null);
let channel = IOService.newChannel2(chromeURI,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let input = channel.open();
let stream = Cc["@mozilla.org/binaryinputstream;1"].
createInstance(Ci.nsIBinaryInputStream);

Просмотреть файл

@ -8,11 +8,13 @@ module.metadata = {
"stability": "experimental"
};
const { Cu, components } = require("chrome");
const { Ci, Cu, components } = require("chrome");
const { defer } = require("../core/promise");
const { merge } = require("../util/object");
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
/**
* Reads a URI and returns a promise.
@ -33,12 +35,19 @@ function readURI(uri, options) {
options = options || {};
let charset = options.charset || 'UTF-8';
let channel = NetUtil.newChannel(uri, charset, null);
let channel = NetUtil.newChannel2(uri,
charset,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let { promise, resolve, reject } = defer();
try {
NetUtil.asyncFetch(channel, function (stream, result) {
NetUtil.asyncFetch2(channel, function (stream, result) {
if (components.isSuccessCode(result)) {
let count = stream.available();
let data = NetUtil.readInputStreamToString(stream, count, { charset : charset });
@ -74,7 +83,14 @@ exports.readURI = readURI;
function readURISync(uri, charset) {
charset = typeof charset === "string" ? charset : "UTF-8";
let channel = NetUtil.newChannel(uri, charset, null);
let channel = NetUtil.newChannel2(uri,
charset,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = channel.open();
let count = stream.available();

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { Cc, Ci } = require("chrome");
const { Cc, Ci, Cu } = require("chrome");
const system = require("sdk/system");
const file = require("sdk/io/file");
@ -12,6 +12,8 @@ const unload = require("sdk/system/unload");
// Retrieve the path to the OS temporary directory:
const tmpDir = require("sdk/system").pathFor("TmpD");
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
// List of all tmp file created
let files = [];
@ -33,7 +35,14 @@ unload.when(function () {
// `uri` and returns content string. Read in binary mode.
function readBinaryURI(uri) {
let ioservice = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
let channel = ioservice.newChannel(uri, "UTF-8", null);
let channel = ioservice.newChannel2(uri,
"UTF-8",
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = Cc["@mozilla.org/binaryinputstream;1"].
createInstance(Ci.nsIBinaryInputStream);
stream.setInputStream(channel.open());

Просмотреть файл

@ -7,7 +7,7 @@ module.metadata = {
"stability": "experimental"
};
const { Cc, Ci, Cr } = require("chrome");
const { Cc, Ci, Cr, Cu } = require("chrome");
const { Class } = require("./core/heritage");
const base64 = require("./base64");
@ -23,6 +23,8 @@ var resProt = ios.getProtocolHandler("resource")
var URLParser = Cc["@mozilla.org/network/url-parser;1?auth=no"]
.getService(Ci.nsIURLParser);
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
function newURI(uriStr, base) {
try {
let baseURI = base ? ios.newURI(base, null, null) : null;
@ -64,7 +66,12 @@ let toFilename = exports.toFilename = function toFilename(url) {
if (uri.scheme == "resource")
uri = newURI(resolveResourceURI(uri));
if (uri.scheme == "chrome") {
var channel = ios.newChannelFromURI(uri);
var channel = ios.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
try {
channel = channel.QueryInterface(Ci.nsIFileChannel);
return channel.file.path;

Просмотреть файл

@ -172,7 +172,14 @@ function serializeStack(frames) {
exports.serializeStack = serializeStack;
function readURI(uri) {
let stream = NetUtil.newChannel(uri, 'UTF-8', null).open();
let stream = NetUtil.newChannel2(uri,
'UTF-8',
null,
null, // aLoadingNode
systemPrincipal,
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER).open();
let count = stream.available();
let data = NetUtil.readInputStreamToString(stream, count, {
charset: 'UTF-8'

Просмотреть файл

@ -26,6 +26,7 @@ const appInfo = Cc["@mozilla.org/xre/app-info;1"].
const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
getService(Ci.nsIVersionComparator);
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
const REASON = [ 'unknown', 'startup', 'shutdown', 'enable', 'disable',
'install', 'uninstall', 'upgrade', 'downgrade' ];
@ -42,7 +43,14 @@ let nukeTimer = null;
function readURI(uri) {
let ioservice = Cc['@mozilla.org/network/io-service;1'].
getService(Ci.nsIIOService);
let channel = ioservice.newChannel(uri, 'UTF-8', null);
let channel = ioservice.newChannel2(uri,
'UTF-8',
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = channel.open();
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].

Просмотреть файл

@ -26,6 +26,7 @@ const appInfo = Cc["@mozilla.org/xre/app-info;1"].
const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
getService(Ci.nsIVersionComparator);
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
const REASON = [ 'unknown', 'startup', 'shutdown', 'enable', 'disable',
'install', 'uninstall', 'upgrade', 'downgrade' ];
@ -42,7 +43,14 @@ let nukeTimer = null;
function readURI(uri) {
let ioservice = Cc['@mozilla.org/network/io-service;1'].
getService(Ci.nsIIOService);
let channel = ioservice.newChannel(uri, 'UTF-8', null);
let channel = ioservice.newChannel2(uri,
'UTF-8',
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = channel.open();
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].

Просмотреть файл

@ -66,7 +66,14 @@ exports.testIsPrivateBrowsingFalseDefault = function(assert) {
};
exports.testNSIPrivateBrowsingChannel = function(assert) {
let channel = Services.io.newChannel("about:blank", null, null);
let channel = Services.io.newChannel2("about:blank",
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
assert.equal(isPrivate(channel), false, 'isPrivate detects non-private channels');
channel.setPrivate(true);

Просмотреть файл

@ -132,10 +132,15 @@ function testRegister(assert, text) {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var channel = ios.newChannel(
var channel = ios.newChannel2(
"data:text/plain;charset=utf-8," + text,
null,
null
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER
);
channel.originalURI = aURI;
@ -162,7 +167,12 @@ function testRegister(assert, text) {
);
var aboutURI = ios.newURI("about:boop", null, null);
var channel = ios.newChannelFromURI(aboutURI);
var channel = ios.newChannelFromURI2(aboutURI,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var iStream = channel.open();
var siStream = Cc['@mozilla.org/scriptableinputstream;1']
.createInstance(Ci.nsIScriptableInputStream);

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -116,10 +116,10 @@
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="f7d9bf71cf6693474f3f2a81a4ba62c0fc5646aa"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="cfcef469537869947abb9aa1d656774cc2678d4c"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="d8040bc7850e326b297045ccbd51bfd7bf566a53"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="f0d6ce5f727eca4b10850c610a06a45772689a75"/>
<project name="platform/system/extras" path="system/extras" revision="10e78a05252b3de785f88c2d0b9ea8a428009c50"/>
<project name="platform/system/media" path="system/media" revision="7ff72c2ea2496fa50b5e8a915e56e901c3ccd240"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="8fcd25d64f0f67d1a6f7037a4c83ce6d95466770"/>
<project name="platform/system/netd" path="system/netd" revision="3ae56364946d4a5bf5a5f83f12f9a45a30398e33"/>
<project name="platform/system/security" path="system/security" revision="ee8068b9e7bfb2770635062fc9c2035be2142bd8"/>
<project name="platform/system/vold" path="system/vold" revision="2e43efe1b30d0b98574d293059556aebd2f46454"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>
@ -118,10 +118,10 @@
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="842e33e43a55ea44833b9e23e4d180fa17c843af"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5db24726f0f42124304195a6bdea129039eeeaeb"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="930ae098543881f47eac054677726ee4b998b2f8"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="d8040bc7850e326b297045ccbd51bfd7bf566a53"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="f0d6ce5f727eca4b10850c610a06a45772689a75"/>
<project name="platform_system_core" path="system/core" remote="b2g" revision="542d1f59dc331b472307e5bd043101d14d5a3a3e"/>
<project name="platform/system/extras" path="system/extras" revision="18c1180e848e7ab8691940481f5c1c8d22c37b3e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="8fcd25d64f0f67d1a6f7037a4c83ce6d95466770"/>
<project name="platform/system/media" path="system/media" revision="d90b836f66bf1d9627886c96f3a2d9c3007fbb80"/>
<project name="platform/system/netd" path="system/netd" revision="56112dd7b811301b718d0643a82fd5cac9522073"/>
<project name="platform/system/security" path="system/security" revision="f48ff68fedbcdc12b570b7699745abb6e7574907"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -116,10 +116,10 @@
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="f7d9bf71cf6693474f3f2a81a4ba62c0fc5646aa"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="b562b01c93de9578d5db537b6a602a38e1aaa0ce"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="387f03e815f57d536dd922706db1622bddba8d81"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="d8040bc7850e326b297045ccbd51bfd7bf566a53"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="f0d6ce5f727eca4b10850c610a06a45772689a75"/>
<project name="platform/system/extras" path="system/extras" revision="5356165f67f4a81c2ef28671c13697f1657590df"/>
<project name="platform/system/media" path="system/media" revision="be0e2fe59a8043fa5200f75697df9220a99abe9d"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="8fcd25d64f0f67d1a6f7037a4c83ce6d95466770"/>
<project name="platform/system/netd" path="system/netd" revision="36704b0da24debcab8090156568ac236315036bb"/>
<project name="platform/system/security" path="system/security" revision="583374f69f531ba68fc3dcbff1f74893d2a96406"/>
<project name="platform/system/vold" path="system/vold" revision="d4455b8cf361f8353e8aebac15ffd64b4aedd2b9"/>
@ -130,9 +130,9 @@
<!-- Emulator specific things -->
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="f5f7fa2fc26b96d2cbd0af4569c0036fe034bb43"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="a510f2d2d579e76421b0c84cd225c249b2da6f8a"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="fbd2becab3825c49e756db5149552f85049c66e2"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="694cecf256122d0cb3b6a1a4efb4b5c7401db223"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="97d63c256a047b491565d624aea1dd5f1f8593ea"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="7de2e90f8d27aa7047978aa10c911f1035fe57dd"/>
<project name="platform/development" path="development" revision="5968ff4e13e0d696ad8d972281fc27ae5a12829b"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="0951179277915335251c5e11d242e4e1a8c2236f"/>
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -111,9 +111,9 @@
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="f7d9bf71cf6693474f3f2a81a4ba62c0fc5646aa"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="69d524e80cdf3981006627c65ac85f3a871238a3"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="d8040bc7850e326b297045ccbd51bfd7bf566a53"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="f0d6ce5f727eca4b10850c610a06a45772689a75"/>
<project name="platform/system/extras" path="system/extras" revision="576f57b6510de59c08568b53c0fb60588be8689e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="8fcd25d64f0f67d1a6f7037a4c83ce6d95466770"/>
<project name="platform/system/netd" path="system/netd" revision="a6531f7befb49b1c81bc0de7e51c5482b308e1c5"/>
<project name="platform/system/security" path="system/security" revision="ee8068b9e7bfb2770635062fc9c2035be2142bd8"/>
<project name="platform/system/vold" path="system/vold" revision="42fa2a0f14f965970a4b629a176bbd2666edf017"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>

Просмотреть файл

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4",
"git_revision": "2535321f1bd55e68fd52291b193693a8995f8e62",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "23474274d441d400d43cdec6eaef41ff23443d80",
"revision": "885e5176711ceb1401648c571a1a9290325582e7",
"repo_path": "integration/gaia-central"
}

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>

Просмотреть файл

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>
@ -118,10 +118,10 @@
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="842e33e43a55ea44833b9e23e4d180fa17c843af"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5db24726f0f42124304195a6bdea129039eeeaeb"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="930ae098543881f47eac054677726ee4b998b2f8"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="d8040bc7850e326b297045ccbd51bfd7bf566a53"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="f0d6ce5f727eca4b10850c610a06a45772689a75"/>
<project name="platform_system_core" path="system/core" remote="b2g" revision="542d1f59dc331b472307e5bd043101d14d5a3a3e"/>
<project name="platform/system/extras" path="system/extras" revision="18c1180e848e7ab8691940481f5c1c8d22c37b3e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="8fcd25d64f0f67d1a6f7037a4c83ce6d95466770"/>
<project name="platform/system/media" path="system/media" revision="d90b836f66bf1d9627886c96f3a2d9c3007fbb80"/>
<project name="platform/system/netd" path="system/netd" revision="56112dd7b811301b718d0643a82fd5cac9522073"/>
<project name="platform/system/security" path="system/security" revision="f48ff68fedbcdc12b570b7699745abb6e7574907"/>

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cba2f0bf49b882e0044c3cc583de8fcf83d2ffa4"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2535321f1bd55e68fd52291b193693a8995f8e62"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

Просмотреть файл

@ -1182,6 +1182,12 @@ pref("browser.tabs.remote.desktopbehavior", true);
// This will require a restart.
pref("security.sandbox.windows.log", false);
// Controls whether the Windows NPAPI plugin process is sandboxed by default.
// To get a different setting for a particular plugin replace "default", with
// the plugin's nice file name, see: nsPluginTag::GetNiceFileName.
pref("dom.ipc.plugins.sandbox.default", false);
pref("dom.ipc.plugins.sandbox.flash", false);
#if defined(MOZ_CONTENT_SANDBOX)
// This controls whether the Windows content process sandbox is using a more
// strict sandboxing policy. This will require a restart.
@ -1803,7 +1809,14 @@ pref("dom.ipc.cpow.timeout", 500);
// Enable e10s hang monitoring (slow script checking and plugin hang
// detection).
pref("dom.ipc.processHangMonitor", true);
#ifdef DEBUG
// Don't report hangs in DEBUG builds. They're too slow and often a
// debugger is attached.
pref("dom.ipc.reportProcessHangs", false);
#else
pref("dom.ipc.reportProcessHangs", true);
#endif
// Disable reader mode by default.
pref("reader.parse-on-load.enabled", false);

Просмотреть файл

@ -653,7 +653,7 @@ function runTest(testNum) {
"context-cut", false,
"context-copy", false,
"context-paste", null, // ignore clipboard state
"context-delete", false,
"context-delete", true,
"---", null,
"context-selectall", true,
"---", null,

Просмотреть файл

@ -9,7 +9,7 @@ Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var stringBundle = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService)
.createBundle("chrome://browser/locale/aboutPrivateBrowsing.properties");
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
if (!PrivateBrowsingUtils.isContentWindowPrivate(window)) {
document.title = stringBundle.GetStringFromName("title.normal");
setFavIcon("chrome://global/skin/icons/question-16.png");
} else {
@ -34,7 +34,7 @@ function setFavIcon(url) {
}
document.addEventListener("DOMContentLoaded", function () {
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
if (!PrivateBrowsingUtils.isContentWindowPrivate(window)) {
document.body.setAttribute("class", "normal");
}

Просмотреть файл

@ -23,7 +23,7 @@ add_task(function*() {
let {toolbox, inspector, view} = yield openRuleView();
let value = getRuleViewProperty(view, "body", "background").valueSpan;
let swatch = value.querySelector(".ruleview-colorswatch");
let swatch = value.querySelectorAll(".ruleview-colorswatch")[1];
let url = value.querySelector(".theme-link");
yield testImageTooltipAfterColorChange(swatch, url, view);
});

Просмотреть файл

@ -167,7 +167,7 @@ function* testParagraph(inspector, view) {
is
(
convertTextPropsToString(elementFirstLineRule.textProps),
"background: none repeat scroll 0% 0% blue",
"background: blue none repeat scroll 0% 0%",
"Paragraph first-line properties are correct"
);
@ -191,7 +191,7 @@ function* testParagraph(inspector, view) {
is
(
convertTextPropsToString(elementSelectionRule.textProps),
"color: white; background: none repeat scroll 0% 0% black",
"color: white; background: black none repeat scroll 0% 0%",
"Paragraph first-letter properties are correct"
);
}
@ -244,4 +244,4 @@ function assertGutters(view) {
is (gutters[2].textContent, "Inherited from body", "Gutter heading is correct");
return gutters;
}
}

Просмотреть файл

@ -96,14 +96,14 @@ function* testPropertyChange5(inspector, ruleView, testElement) {
function* testPropertyChange6(inspector, ruleView, testElement) {
info("Add an entirely new property again");
yield changeElementStyle(testElement, "background: url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0% red", inspector);
yield changeElementStyle(testElement, "background: red url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0%", inspector);
let rule = ruleView._elementStyle.rules[0];
is(rule.editor.element.querySelectorAll(".ruleview-property").length, 5, "Added a property");
validateTextProp(rule.textProps[4], true, "background",
"url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0% red",
"red url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0%",
"shortcut property correctly set",
"url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0% #F00");
"#F00 url(\"chrome://branding/content/about-logo.png\") repeat scroll 0% 0%");
}
function* changeElementStyle(testElement, style, inspector) {

Просмотреть файл

@ -74,12 +74,18 @@ private:
virtual void run(const MatchFinder::MatchResult &Result);
};
class NoAddRefReleaseOnReturnChecker : public MatchFinder::MatchCallback {
public:
virtual void run(const MatchFinder::MatchResult &Result);
};
ScopeChecker stackClassChecker;
ScopeChecker globalClassChecker;
NonHeapClassChecker nonheapClassChecker;
ArithmeticArgChecker arithmeticArgChecker;
TrivialCtorDtorChecker trivialCtorDtorChecker;
NaNExprChecker nanExprChecker;
NoAddRefReleaseOnReturnChecker noAddRefReleaseOnReturnChecker;
MatchFinder astMatcher;
};
@ -389,6 +395,12 @@ AST_MATCHER(CXXRecordDecl, hasTrivialCtorDtor) {
return MozChecker::hasCustomAnnotation(&Node, "moz_trivial_ctor_dtor");
}
/// This matcher will match any function declaration that is marked to prohibit
/// calling AddRef or Release on its return value.
AST_MATCHER(FunctionDecl, hasNoAddRefReleaseOnReturnAttr) {
return MozChecker::hasCustomAnnotation(&Node, "moz_no_addref_release_on_return");
}
/// This matcher will match all arithmetic binary operators.
AST_MATCHER(BinaryOperator, binaryArithmeticOperator) {
BinaryOperatorKind opcode = Node.getOpcode();
@ -458,6 +470,17 @@ AST_MATCHER(BinaryOperator, isInSkScalarDotH) {
return llvm::sys::path::rbegin(FileName)->equals("SkScalar.h");
}
/// This matcher will match all accesses to AddRef or Release methods.
AST_MATCHER(MemberExpr, isAddRefOrRelease) {
ValueDecl *Member = Node.getMemberDecl();
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Member);
if (Method) {
std::string Name = Method->getNameAsString();
return Name == "AddRef" || Name == "Release";
}
return false;
}
}
}
@ -548,6 +571,12 @@ DiagnosticsMatcher::DiagnosticsMatcher()
unless(anyOf(isInSystemHeader(), isInSkScalarDotH()))
)).bind("node"),
&nanExprChecker);
astMatcher.addMatcher(callExpr(callee(functionDecl(hasNoAddRefReleaseOnReturnAttr()).bind("func")),
hasParent(memberExpr(isAddRefOrRelease(),
hasParent(callExpr())).bind("member")
)).bind("node"),
&noAddRefReleaseOnReturnChecker);
}
void DiagnosticsMatcher::ScopeChecker::run(
@ -733,6 +762,19 @@ void DiagnosticsMatcher::NaNExprChecker::run(
}
}
void DiagnosticsMatcher::NoAddRefReleaseOnReturnChecker::run(
const MatchFinder::MatchResult &Result) {
DiagnosticsEngine &Diag = Result.Context->getDiagnostics();
unsigned errorID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Error, "%1 cannot be called on the return value of %0");
const Stmt *node = Result.Nodes.getNodeAs<Stmt>("node");
const FunctionDecl *func = Result.Nodes.getNodeAs<FunctionDecl>("func");
const MemberExpr *member = Result.Nodes.getNodeAs<MemberExpr>("member");
const CXXMethodDecl *method = dyn_cast<CXXMethodDecl>(member->getMemberDecl());
Diag.Report(node->getLocStart(), errorID) << func << method;
}
class MozCheckAction : public PluginASTAction {
public:
ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI, StringRef fileName) override {

Просмотреть файл

@ -3,9 +3,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Build without any warning flags, and with clang verify flag for a
# syntax-only build (no codegen).
OS_CFLAGS := $(filter-out -W%,$(OS_CFLAGS)) -fsyntax-only -Xclang -verify
OS_CXXFLAGS := $(filter-out -W%,$(OS_CXXFLAGS)) -fsyntax-only -Xclang -verify
# syntax-only build (no codegen), without a limit on the number of errors.
OS_CFLAGS := $(filter-out -W%,$(OS_CFLAGS)) -fsyntax-only -Xclang -verify -ferror-limit=0
OS_CXXFLAGS := $(filter-out -W%,$(OS_CXXFLAGS)) -fsyntax-only -Xclang -verify -ferror-limit=0
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,65 @@
#define MOZ_NO_ADDREF_RELEASE_ON_RETURN __attribute__((annotate("moz_no_addref_release_on_return")))
struct Test {
void AddRef();
void Release();
void foo();
};
struct S {
Test* f() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
Test& g() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
Test h() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
};
template<class T>
struct X {
T* f() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
T& g() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
T h() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
};
template<class T>
struct SP {
T* operator->() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
};
Test* f() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
Test& g() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
Test h() MOZ_NO_ADDREF_RELEASE_ON_RETURN;
void test() {
S s;
s.f()->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'f'}}
s.f()->Release(); // expected-error{{'Release' cannot be called on the return value of 'f'}}
s.f()->foo();
s.g().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'g'}}
s.g().Release(); // expected-error{{'Release' cannot be called on the return value of 'g'}}
s.g().foo();
s.h().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'h'}}
s.h().Release(); // expected-error{{'Release' cannot be called on the return value of 'h'}}
s.h().foo();
X<Test> x;
x.f()->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'f'}}
x.f()->Release(); // expected-error{{'Release' cannot be called on the return value of 'f'}}
x.f()->foo();
x.g().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'g'}}
x.g().Release(); // expected-error{{'Release' cannot be called on the return value of 'g'}}
x.g().foo();
x.h().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'h'}}
x.h().Release(); // expected-error{{'Release' cannot be called on the return value of 'h'}}
x.h().foo();
SP<Test> sp;
sp->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'operator->'}}
sp->Release(); // expected-error{{'Release' cannot be called on the return value of 'operator->'}}
sp->foo();
f()->AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'f'}}
f()->Release(); // expected-error{{'Release' cannot be called on the return value of 'f'}}
f()->foo();
g().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'g'}}
g().Release(); // expected-error{{'Release' cannot be called on the return value of 'g'}}
g().foo();
h().AddRef(); // expected-error{{'AddRef' cannot be called on the return value of 'h'}}
h().Release(); // expected-error{{'Release' cannot be called on the return value of 'h'}}
h().foo();
}

Просмотреть файл

@ -11,6 +11,7 @@ SOURCES += [
'TestMustOverride.cpp',
'TestNANTestingExpr.cpp',
'TestNANTestingExprC.c',
'TestNoAddRefReleaseOnReturn.cpp',
'TestNoArithmeticExprInArgument.cpp',
'TestNonHeapClass.cpp',
'TestStackClass.cpp',

Просмотреть файл

@ -3595,7 +3595,7 @@ MOZ_ARG_WITH_BOOL(system-nss,
_USE_SYSTEM_NSS=1 )
if test -n "$_USE_SYSTEM_NSS"; then
AM_PATH_NSS(3.17.3, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
AM_PATH_NSS(3.17.4, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
fi
if test -n "$MOZ_NATIVE_NSS"; then

Просмотреть файл

@ -75,8 +75,8 @@ public:
JSObject* GetStack()
{
if (mStackTrace) {
return mStackTrace->get();
if (mStackTrace.initialized()) {
return mStackTrace;
}
return nullptr;
}
@ -89,7 +89,7 @@ protected:
if (ctx) {
JS::RootedObject stack(ctx);
if (JS::CaptureCurrentStack(ctx, &stack)) {
mStackTrace.emplace(ctx, stack.get());
mStackTrace.init(ctx, stack.get());
} else {
JS_ClearPendingException(ctx);
}
@ -107,7 +107,7 @@ private:
// in this case changing nsDocShell to participate in cycle
// collection was deemed too invasive, and the markers are only held
// here temporarily to boot.
mozilla::Maybe<JS::PersistentRooted<JSObject*>> mStackTrace;
JS::PersistentRooted<JSObject*> mStackTrace;
};
#endif /* TimelineMarker_h__ */

Просмотреть файл

@ -8216,14 +8216,6 @@ nsDocShell::RestorePresentation(nsISHEntry *aSHEntry, bool *aRestoring)
SetHistoryEntry(&mLSHE, aSHEntry);
// Add the request to our load group. We do this before swapping out
// the content viewers so that consumers of STATE_START can access
// the old document. We only deal with the toplevel load at this time --
// to be consistent with normal document loading, subframes cannot start
// loading until after data arrives, which is after STATE_START completes.
BeginRestore(viewer, true);
// Post an event that will remove the request after we've returned
// to the event loop. This mimics the way it is called by nsIChannel
// implementations.
@ -8245,10 +8237,40 @@ nsDocShell::RestorePresentation(nsISHEntry *aSHEntry, bool *aRestoring)
return rv;
}
namespace {
class MOZ_STACK_CLASS PresentationEventForgetter
{
public:
explicit PresentationEventForgetter(
nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>& aRestorePresentationEvent)
: mRestorePresentationEvent(aRestorePresentationEvent)
, mEvent(aRestorePresentationEvent.get())
{
}
~PresentationEventForgetter()
{
Forget();
}
void Forget()
{
if (mRestorePresentationEvent.get() == mEvent) {
mRestorePresentationEvent.Forget();
mEvent = nullptr;
}
}
private:
nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>& mRestorePresentationEvent;
nsRefPtr<nsDocShell::RestorePresentationEvent> mEvent;
};
}
nsresult
nsDocShell::RestoreFromHistory()
{
mRestorePresentationEvent.Forget();
MOZ_ASSERT(mRestorePresentationEvent.IsPending());
PresentationEventForgetter forgetter(mRestorePresentationEvent);
// This section of code follows the same ordering as CreateContentViewer.
if (!mLSHE)
@ -8302,6 +8324,24 @@ nsDocShell::RestoreFromHistory()
if (mLSHE != origLSHE)
return NS_OK;
// Add the request to our load group. We do this before swapping out
// the content viewers so that consumers of STATE_START can access
// the old document. We only deal with the toplevel load at this time --
// to be consistent with normal document loading, subframes cannot start
// loading until after data arrives, which is after STATE_START completes.
nsRefPtr<RestorePresentationEvent> currentPresentationRestoration =
mRestorePresentationEvent.get();
Stop();
// Make sure we're still restoring the same presentation.
// If we aren't, docshell is in process doing another load already.
NS_ENSURE_STATE(currentPresentationRestoration ==
mRestorePresentationEvent.get());
BeginRestore(viewer, true);
NS_ENSURE_STATE(currentPresentationRestoration ==
mRestorePresentationEvent.get());
forgetter.Forget();
// Set mFiredUnloadEvent = false so that the unload handler for the
// *new* document will fire.
mFiredUnloadEvent = false;

Просмотреть файл

@ -693,6 +693,7 @@ protected:
*/
void MaybeInitTiming();
public:
// Event type dispatched by RestorePresentation
class RestorePresentationEvent : public nsRunnable {
public:
@ -702,6 +703,7 @@ protected:
private:
nsRefPtr<nsDocShell> mDocShell;
};
protected:
bool JustStartedNetworkLoad();

Просмотреть файл

@ -105,3 +105,5 @@ support-files = file_framedhistoryframes.html
[test_pushState_after_document_open.html]
[test_windowedhistoryframes.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
[test_bug1121701.html]
skip-if = (buildapp == 'b2g' || buildapp == 'mulet')

Просмотреть файл

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1121701
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1121701</title>
<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 1121701 **/
var testUrl1 = "data:text/html,<script>window.onpageshow = function(e) { opener.child1PageShow(e); } <" + "/script>";
var testUrl2 = "data:text/html,<script>window.onpageshow = function(e) { opener.child2PageShow(e); } <" + "/script>";
var testWin;
var page1LoadCount = 0;
function child1PageShow(e) {
++page1LoadCount;
if (page1LoadCount == 1) {
SimpleTest.executeSoon(function() {
is(e.persisted, false, "Initial page load shouldn't be persisted.");
testWin.document.body.innerHTML = "modified";
testWin.onpagehide = function(e) {
testWin.onpagehide = null;
ok(e.persisted, "test page 1 should have been persisted");
is(testWin.document.body.innerHTML, "modified");
}
testWin.location.href = testUrl2;
});
} else if (page1LoadCount == 2) {
is(e.persisted, true, "Page load from bfcache should be persisted.");
is(testWin.document.body.innerHTML, "modified");
testWin.close();
SimpleTest.finish();
}
}
function child2PageShow(e) {
testWin.document.body.innerHTML = "<img>";
SimpleTest.executeSoon(function() {
testWin.onmessage = function() {
ok(true, "Got message");
testWin.document.body.firstChild.src = location.href;
}
testWin.onbeforeunload = function() {
testWin.postMessage("foo", "*");
}
testWin.history.back();
});
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
testWin = window.open(testUrl1);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121701">Mozilla Bug 1121701</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -509,6 +509,7 @@ this.PermissionsTable = { geolocation: {
},
"tv": {
app: DENY_ACTION,
trusted: DENY_ACTION,
privileged: DENY_ACTION,
certified: ALLOW_ACTION
},

Просмотреть файл

@ -1268,7 +1268,7 @@ Console::ProcessCallData(ConsoleCallData* aData)
innerID.AppendInt(aData->mInnerIDNumber);
}
if (NS_FAILED(mStorage->RecordPendingEvent(innerID, outerID, eventValue))) {
if (NS_FAILED(mStorage->RecordEvent(innerID, outerID, eventValue))) {
NS_WARNING("Failed to record a console event.");
}
}

Просмотреть файл

@ -11,18 +11,12 @@ let Cc = Components.classes;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
// The console API events have to be scheduled when stored using
// |recordPendingEvent|.
const CALL_DELAY = 15 // milliseconds
// This constant tells how many messages to process in a single timer execution.
const MESSAGES_IN_INTERVAL = 1500
const STORAGE_MAX_EVENTS = 200;
var _consoleStorage = new Map();
var _consolePendingStorage = new Map();
var _timer;
const CONSOLEAPISTORAGE_CID = Components.ID('{96cf7855-dfa9-4c6d-8276-f9705b4890f2}');
@ -141,51 +135,6 @@ ConsoleAPIStorageService.prototype = {
Services.obs.notifyObservers(aEvent, "console-storage-cache-event", aId);
},
/**
* Similar to recordEvent, but these events are scheduled and stored any
* CALL_DELAY millisecs.
*/
recordPendingEvent: function CS_recordPendingEvent(aId, aOuterId, aEvent)
{
if (!_consolePendingStorage.has(aId)) {
_consolePendingStorage.set(aId, []);
}
let storage = _consolePendingStorage.get(aId);
storage.push({ outerId: aOuterId, event: aEvent });
if (!_timer) {
_timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
}
let self = this;
_timer.initWithCallback(function() { self.flushPendingEvents(); },
CALL_DELAY, Ci.nsITimer.TYPE_REPEATING_SLACK);
},
/**
* Processes the pending event queue.
*/
flushPendingEvents: function CS_flushPendingEvents()
{
for (let [id, objs] of _consolePendingStorage) {
for (let i = 0; i < objs.length && i < MESSAGES_IN_INTERVAL; ++i) {
this.recordEvent(id, objs[i].outerId, objs[i].event);
}
if (objs.length <= MESSAGES_IN_INTERVAL) {
_consolePendingStorage.delete(id);
} else {
_consolePendingStorage.set(id, objs.splice(MESSAGES_IN_INTERVAL));
}
}
if (_timer && _consolePendingStorage.size == 0) {
_timer.cancel();
_timer = null;
}
},
/**
* Clear storage data for the given window.
*

Просмотреть файл

@ -2553,7 +2553,7 @@ IsVoidTag(nsIAtom* aTag)
static const nsIAtom* voidElements[] = {
nsGkAtoms::area, nsGkAtoms::base, nsGkAtoms::basefont,
nsGkAtoms::bgsound, nsGkAtoms::br, nsGkAtoms::col,
nsGkAtoms::command, nsGkAtoms::embed, nsGkAtoms::frame,
nsGkAtoms::embed, nsGkAtoms::frame,
nsGkAtoms::hr, nsGkAtoms::img, nsGkAtoms::input,
nsGkAtoms::keygen, nsGkAtoms::link, nsGkAtoms::meta,
nsGkAtoms::param, nsGkAtoms::source, nsGkAtoms::track,

Просмотреть файл

@ -47,9 +47,6 @@
#include "nsStringBuffer.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsIEditor.h"
#include "nsIHTMLEditor.h"
#include "nsIDocShell.h"
#include "mozilla/dom/EncodingUtils.h"
#include "nsComputedDOMStyle.h"
@ -324,34 +321,19 @@ nsDocumentEncoder::IncludeInContext(nsINode *aNode)
static
bool
IsInvisibleBreak(nsINode *aNode) {
// xxxehsan: we should probably figure out a way to determine
// if a BR node is visible without using the editor.
Element* elt = aNode->AsElement();
if (!elt->IsHTML(nsGkAtoms::br) ||
!aNode->IsEditable()) {
if (!aNode->IsElement() || !aNode->IsEditable()) {
return false;
}
nsIFrame* frame = aNode->AsElement()->GetPrimaryFrame();
if (!frame || frame->GetType() != nsGkAtoms::brFrame) {
return false;
}
// Grab the editor associated with the document
nsIDocument *doc = aNode->GetComposedDoc();
if (doc) {
nsPIDOMWindow *window = doc->GetWindow();
if (window) {
nsIDocShell *docShell = window->GetDocShell();
if (docShell) {
nsCOMPtr<nsIEditor> editor;
docShell->GetEditor(getter_AddRefs(editor));
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(editor);
if (htmlEditor) {
bool isVisible = false;
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aNode);
htmlEditor->BreakIsVisible(domNode, &isVisible);
return !isVisible;
}
}
}
}
return false;
// If the BRFrame has caused a visible line break, it should have a next
// sibling, or otherwise no siblings and a non-zero height.
bool visible = frame->GetNextSibling() ||
(!frame->GetPrevSibling() && frame->GetRect().Height() != 0);
return !visible;
}
nsresult

Просмотреть файл

@ -5,7 +5,7 @@
#include "nsISupports.idl"
[scriptable, uuid(cce39123-585e-411b-9edd-2513f7cf7e47)]
[scriptable, uuid(9e32a7b6-c4d1-4d9a-87b9-1ef6b75c27a9)]
interface nsIConsoleAPIStorage : nsISupports
{
/**
@ -35,22 +35,6 @@ interface nsIConsoleAPIStorage : nsISupports
*/
void recordEvent(in DOMString aId, in DOMString aOuterId, in jsval aEvent);
/**
* Similar to recordEvent() but these events will be collected
* and dispatched with a timer in order to avoid flooding the devtools
* webconsole.
*
* @param string aId
* The ID of the inner window for which the event occurred or "jsm" for
* messages logged from JavaScript modules..
* @param string aOuterId
* This ID is used as 3rd parameters for the console-api-log-event
* notification.
* @param object aEvent
* A JavaScript object you want to store.
*/
void recordPendingEvent(in DOMString aId, in DOMString aOuterId, in jsval aEvent);
/**
* Clear storage data for the given window.
*

Просмотреть файл

@ -32,7 +32,7 @@ class Element;
} // namespace dom
} // namespace mozilla
class nsPlainTextSerializer : public nsIContentSerializer
class nsPlainTextSerializer MOZ_FINAL : public nsIContentSerializer
{
public:
nsPlainTextSerializer();
@ -67,8 +67,8 @@ public:
NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument,
nsAString& aStr) MOZ_OVERRIDE;
protected:
virtual ~nsPlainTextSerializer();
private:
~nsPlainTextSerializer();
nsresult GetAttributeValue(nsIAtom* aName, nsString& aValueRet);
void AddToLine(const char16_t* aStringToAdd, int32_t aLength);
@ -114,10 +114,9 @@ protected:
bool ShouldReplaceContainerWithPlaceholder(nsIAtom* aTag);
private:
bool IsElementPreformatted(mozilla::dom::Element* aElement);
protected:
private:
nsString mCurrentLine;
uint32_t mHeadLevel;
bool mAtFirstColumn;

Просмотреть файл

@ -53,7 +53,6 @@ nsIAtom** const kElementsHTML[] = {
&nsGkAtoms::code,
&nsGkAtoms::col,
&nsGkAtoms::colgroup,
&nsGkAtoms::command,
&nsGkAtoms::datalist,
&nsGkAtoms::dd,
&nsGkAtoms::del,

Просмотреть файл

@ -48,7 +48,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525816
(function() {
SimpleTest.waitForExplicitFinish();
SimpleTest.requestLongerTimeout(TestRequests.length);
SimpleTest.requestFlakyTimeout("untriaged");
SimpleTest.requestFlakyTimeout("This is testing XHR timeouts.");
var msg = "This test will take approximately " + (TestRequests.length * 10)
msg += " seconds to complete, at most.";
document.getElementById("content").firstChild.nodeValue = msg;

Просмотреть файл

@ -99,7 +99,8 @@ DOMEventTargetHelper::BindToOwner(nsPIDOMWindow* aOwner)
void
DOMEventTargetHelper::BindToOwner(nsIGlobalObject* aOwner)
{
if (mParentObject) {
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);
if (parentObject) {
if (mOwnerWindow) {
static_cast<nsGlobalWindow*>(mOwnerWindow)->RemoveEventTargetObject(this);
mOwnerWindow = nullptr;
@ -108,7 +109,8 @@ DOMEventTargetHelper::BindToOwner(nsIGlobalObject* aOwner)
mHasOrHasHadOwnerWindow = false;
}
if (aOwner) {
mParentObject = aOwner;
mParentObject = do_GetWeakReference(aOwner);
MOZ_ASSERT(mParentObject, "All nsIGlobalObjects must support nsISupportsWeakReference");
// Let's cache the result of this QI for fast access and off main thread usage
mOwnerWindow = nsCOMPtr<nsPIDOMWindow>(do_QueryInterface(aOwner)).get();
if (mOwnerWindow) {
@ -131,9 +133,10 @@ DOMEventTargetHelper::BindToOwner(DOMEventTargetHelper* aOther)
if (aOther) {
mHasOrHasHadOwnerWindow = aOther->HasOrHasHadOwner();
if (aOther->GetParentObject()) {
mParentObject = aOther->GetParentObject();
mParentObject = do_GetWeakReference(aOther->GetParentObject());
MOZ_ASSERT(mParentObject, "All nsIGlobalObjects must support nsISupportsWeakReference");
// Let's cache the result of this QI for fast access and off main thread usage
mOwnerWindow = nsCOMPtr<nsPIDOMWindow>(do_QueryInterface(mParentObject)).get();
mOwnerWindow = nsCOMPtr<nsPIDOMWindow>(do_QueryInterface(aOther->GetParentObject())).get();
if (mOwnerWindow) {
MOZ_ASSERT(mOwnerWindow->IsInnerWindow());
mHasOrHasHadOwnerWindow = true;

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsPIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIWeakReferenceUtils.h"
#include "MainThreadUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventListenerManager.h"
@ -138,7 +139,10 @@ public:
void BindToOwner(nsPIDOMWindow* aOwner);
void BindToOwner(DOMEventTargetHelper* aOther);
virtual void DisconnectFromOwner();
nsIGlobalObject* GetParentObject() const { return mParentObject; }
nsIGlobalObject* GetParentObject() const {
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);
return parentObject;
}
bool HasOrHasHadOwner() { return mHasOrHasHadOwnerWindow; }
virtual void EventListenerAdded(nsIAtom* aType) MOZ_OVERRIDE;
@ -164,10 +168,11 @@ protected:
virtual void LastRelease() {}
private:
// Inner window or sandbox.
nsIGlobalObject* mParentObject;
nsWeakPtr mParentObject;
// mParentObject pre QI-ed and cached (inner window)
// (it is needed for off main thread access)
nsPIDOMWindow* mOwnerWindow;
// It is obtained in BindToOwner and reset in DisconnectFromOwner.
nsPIDOMWindow* MOZ_NON_OWNING_REF mOwnerWindow;
bool mHasOrHasHadOwnerWindow;
};

Просмотреть файл

@ -362,6 +362,20 @@ Event::GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget)
return NS_OK;
}
EventTarget*
Event::GetComposedTarget() const
{
EventTarget* et = GetOriginalTarget();
nsCOMPtr<nsIContent> content = do_QueryInterface(et);
if (!content) {
return et;
}
nsIContent* nonChrome = content->FindFirstNonChromeOnlyAccessContent();
return nonChrome ?
static_cast<EventTarget*>(nonChrome) :
static_cast<EventTarget*>(content->GetComposedDoc());
}
NS_IMETHODIMP_(void)
Event::SetTrusted(bool aTrusted)
{

Просмотреть файл

@ -205,6 +205,7 @@ public:
EventTarget* GetOriginalTarget() const;
EventTarget* GetExplicitOriginalTarget() const;
EventTarget* GetComposedTarget() const;
bool GetPreventDefault() const;

Просмотреть файл

@ -138,6 +138,7 @@ skip-if = toolkit == "gonk" || e10s
support-files = bug1017086_inner.html
[test_bug1017086_enable.html]
support-files = bug1017086_inner.html
[test_bug1079236.html]
[test_clickevent_on_input.html]
skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
[test_continuous_wheel_events.html]

Просмотреть файл

@ -0,0 +1,60 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1079236
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1079236</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1079236 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
function runTests() {
var c = document.getElementById("content");
var sr = c.createShadowRoot();
sr.innerHTML = "<input type='file'" + ">";
var file = sr.firstChild;
is(file.type, "file");
file.offsetLeft; // Flush layout because dispatching mouse events.
document.body.onmousemove = function(e) {
is(e.target, c, "Event target should be the element in non-Shadow DOM");
if (e.originalTarget == file) {
is(e.originalTarget, file,
"type='file' implementation doesn't seem to have native anonymous content");
} else {
var wrapped = SpecialPowers.wrap(e.originalTarget);
isnot(wrapped, file, "Shouldn't have the same event.target and event.originalTarget");
}
ok(!("composedTarget" in e), "Events shouldn't have composedTarget in non-chrome context!");
e = SpecialPowers.wrap(e);
var composedTarget = SpecialPowers.unwrap(e.composedTarget);
ok(composedTarget, file, "composedTarget should be the file object.");
SimpleTest.finish();
}
var r = file.getBoundingClientRect();
synthesizeMouse(file, r.width / 6, r.height / 2, { type: "mousemove"} );
document.body.onmousemove = null;
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1079236">Mozilla Bug 1079236</a>
<p id="display"></p>
<div id="content">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -10,9 +10,12 @@ EXPORTS += [
'nsGeoPositionIPCSerialiser.h',
]
SOURCES += [
'nsGeolocation.cpp',
]
UNIFIED_SOURCES += [
'nsGeoGridFuzzer.cpp',
'nsGeolocation.cpp',
'nsGeolocationSettings.cpp',
'nsGeoPosition.cpp',
]
@ -45,4 +48,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/dom/system/mac',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'/dom/system/windows',
]

Просмотреть файл

@ -49,6 +49,10 @@ class nsIPrincipal;
#include "CoreLocationLocationProvider.h"
#endif
#ifdef XP_WIN
#include "WindowsLocationProvider.h"
#endif
// Some limit to the number of get or watch geolocation requests
// that a window can make.
#define MAX_GEO_REQUESTS_PER_WINDOW 1500
@ -810,6 +814,12 @@ nsresult nsGeolocationService::Init()
}
#endif
#ifdef XP_WIN
if (Preferences::GetBool("geo.provider.ms-windows-location", false)) {
mProvider = new WindowsLocationProvider();
}
#endif
if (Preferences::GetBool("geo.provider.use_mls", false)) {
mProvider = do_CreateInstance("@mozilla.org/geolocation/mls-provider;1");
}

Просмотреть файл

@ -193,6 +193,18 @@ HTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
static bool
IsNodeInEditableRegion(nsINode* aNode)
{
while (aNode) {
if (aNode->IsEditable()) {
return true;
}
aNode = aNode->GetParent();
}
return false;
}
bool
HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
bool *aIsFocusable, int32_t *aTabIndex)
@ -214,7 +226,9 @@ HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
}
}
if (IsEditable()) {
// Links that are in an editable region should never be focusable, even if
// they are in a contenteditable="false" region.
if (IsNodeInEditableRegion(this)) {
if (aTabIndex) {
*aTabIndex = -1;
}

Просмотреть файл

@ -979,7 +979,6 @@ nsTextEditorState::nsTextEditorState(nsITextControlElement* aOwningElement)
: mTextCtrlElement(aOwningElement),
mRestoringSelection(nullptr),
mBoundFrame(nullptr),
mTextListener(nullptr),
mEverInited(false),
mEditorInitialized(false),
mInitializing(false),
@ -1012,7 +1011,7 @@ nsTextEditorState::Clear()
// for us.
DestroyEditor();
}
NS_IF_RELEASE(mTextListener);
mTextListener = nullptr;
}
void nsTextEditorState::Unlink()
@ -1125,8 +1124,8 @@ nsTextEditorState::BindToFrame(nsTextControlFrame* aFrame)
// Create a SelectionController
mSelCon = new nsTextInputSelectionImpl(frameSel, shell, rootNode);
MOZ_ASSERT(!mTextListener, "Should not overwrite the object");
mTextListener = new nsTextInputListener(mTextCtrlElement);
NS_ADDREF(mTextListener);
mTextListener->SetFrame(mBoundFrame);
mSelCon->SetDisplaySelection(nsISelectionController::SELECTION_ON);
@ -1647,7 +1646,6 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
TrustedEventsAtSystemGroupBubble());
}
NS_RELEASE(mTextListener);
mTextListener = nullptr;
}

Просмотреть файл

@ -276,7 +276,7 @@ private:
nsCOMPtr<mozilla::dom::Element> mRootNode;
nsCOMPtr<mozilla::dom::Element> mPlaceholderDiv;
nsTextControlFrame* mBoundFrame;
nsTextInputListener* mTextListener;
nsRefPtr<nsTextInputListener> mTextListener;
nsAutoPtr<nsCString> mValue;
nsRefPtr<nsAnonDivObserver> mMutationObserver;
mutable nsString mCachedValue; // Caches non-hard-wrapped value on a multiline control.

Просмотреть файл

@ -355,7 +355,7 @@ let FormAssistant = {
},
handleEvent: function fa_handleEvent(evt) {
let target = evt.target;
let target = evt.composedTarget;
let range = null;
switch (evt.type) {

Просмотреть файл

@ -664,8 +664,8 @@ interface nsIDOMWindowUtils : nsISupports {
* drag - msg1-n:TOUCH_CONTACT (moving), msgn+1:TOUCH_REMOVE
* hover drag - msg1-n:TOUCH_HOVER (moving), msgn+1:TOUCH_REMOVE
*
* Widget support: Windows 8.0+, Winrt/Win32. Other widgets will
* throw.
* Widget support: Windows 8.0+, Winrt/Win32. Gonk supports CONTACT, REMOVE,
* and CANCEL but no HOVER. Other widgets will throw.
*
* @param aPointerId The touch point id to create or update.
* @param aTouchState one or more of the touch states listed above

Просмотреть файл

@ -132,7 +132,7 @@ parent:
nsString aName,
nsString aFeatures,
nsString aBaseURI)
returns (bool windowOpened, FrameScriptInfo[] frameScripts);
returns (bool windowOpened, FrameScriptInfo[] frameScripts, nsCString urlToLoad);
sync SyncMessage(nsString aMessage, ClonedMessageData aData,
CpowEntry[] aCpows, Principal aPrincipal)

Просмотреть файл

@ -25,6 +25,11 @@
#include "base/task.h"
#include "base/thread.h"
#ifdef XP_WIN
// For IsDebuggerPresent()
#include <windows.h>
#endif
using namespace mozilla;
using namespace mozilla::dom;
@ -527,6 +532,14 @@ HangMonitorParent::RecvHangEvidence(const HangData& aHangData)
return true;
}
#ifdef XP_WIN
// Don't report hangs if we're debugging the process. You can comment this
// line out for testing purposes.
if (IsDebuggerPresent()) {
return true;
}
#endif
mHangMonitor->InitiateCPOWTimeout();
MonitorAutoLock lock(mMonitor);

Просмотреть файл

@ -1520,6 +1520,7 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
nsString name(aName);
nsAutoCString features(aFeatures);
nsTArray<FrameScriptInfo> frameScripts;
nsCString urlToLoad;
if (aIframeMoz) {
newChild->SendBrowserFrameOpenWindow(this, url, name,
@ -1559,7 +1560,8 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
name, NS_ConvertUTF8toUTF16(features),
NS_ConvertUTF8toUTF16(baseURIString),
aWindowIsNew,
&frameScripts)) {
&frameScripts,
&urlToLoad)) {
return NS_ERROR_NOT_AVAILABLE;
}
}
@ -1592,6 +1594,10 @@ TabChild::ProvideWindowCommon(nsIDOMWindow* aOpener,
}
}
if (!urlToLoad.IsEmpty()) {
newChild->RecvLoadURL(urlToLoad);
}
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(newChild->WebNavigation());
win.forget(aReturn);
return NS_OK;
@ -3567,6 +3573,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentFrameMessageManager)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)

Просмотреть файл

@ -65,7 +65,8 @@ class TabChildBase;
class TabChildGlobal : public DOMEventTargetHelper,
public nsIContentFrameMessageManager,
public nsIScriptObjectPrincipal,
public nsIGlobalObject
public nsIGlobalObject,
public nsSupportsWeakReference
{
public:
explicit TabChildGlobal(TabChildBase* aTabChild);

Просмотреть файл

@ -273,7 +273,7 @@ TabParent::TabParent(nsIContentParent* aManager,
, mChromeFlags(aChromeFlags)
, mInitedByParent(false)
, mTabId(aTabId)
, mSkipLoad(false)
, mCreatingWindow(false)
{
MOZ_ASSERT(aManager);
}
@ -454,17 +454,21 @@ TabParent::RecvEvent(const RemoteDOMEvent& aEvent)
struct MOZ_STACK_CLASS TabParent::AutoUseNewTab MOZ_FINAL
{
public:
AutoUseNewTab(TabParent* aNewTab, bool* aWindowIsNew)
: mNewTab(aNewTab), mWindowIsNew(aWindowIsNew)
AutoUseNewTab(TabParent* aNewTab, bool* aWindowIsNew, nsCString* aURLToLoad)
: mNewTab(aNewTab), mWindowIsNew(aWindowIsNew), mURLToLoad(aURLToLoad)
{
MOZ_ASSERT(!TabParent::sNextTabParent);
MOZ_ASSERT(!aNewTab->mCreatingWindow);
TabParent::sNextTabParent = aNewTab;
aNewTab->mSkipLoad = true;
aNewTab->mCreatingWindow = true;
aNewTab->mDelayedURL.Truncate();
}
~AutoUseNewTab()
{
mNewTab->mSkipLoad = false;
mNewTab->mCreatingWindow = false;
*mURLToLoad = mNewTab->mDelayedURL;
if (TabParent::sNextTabParent) {
MOZ_ASSERT(TabParent::sNextTabParent == mNewTab);
@ -476,6 +480,7 @@ public:
private:
TabParent* mNewTab;
bool* mWindowIsNew;
nsCString* mURLToLoad;
};
bool
@ -489,7 +494,8 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
const nsString& aFeatures,
const nsString& aBaseURI,
bool* aWindowIsNew,
InfallibleTArray<FrameScriptInfo>* aFrameScripts)
InfallibleTArray<FrameScriptInfo>* aFrameScripts,
nsCString* aURLToLoad)
{
// We always expect to open a new window here. If we don't, it's an error.
*aWindowIsNew = true;
@ -530,7 +536,7 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
params->SetReferrer(aBaseURI);
params->SetIsPrivate(isPrivate);
AutoUseNewTab aunt(newTab, aWindowIsNew);
AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner;
mBrowserDOMWindow->OpenURIInFrame(nullptr, params,
@ -564,7 +570,7 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
nsCOMPtr<nsIDOMWindow> window;
AutoUseNewTab aunt(newTab, aWindowIsNew);
AutoUseNewTab aunt(newTab, aWindowIsNew, aURLToLoad);
rv = pwwatch->OpenWindow2(parent, finalURIString.get(),
NS_ConvertUTF16toUTF8(aName).get(),
@ -601,7 +607,7 @@ bool
TabParent::SendLoadRemoteScript(const nsString& aURL,
const bool& aRunInGlobalScope)
{
if (mSkipLoad) {
if (mCreatingWindow) {
mDelayedFrameScripts.AppendElement(FrameScriptInfo(aURL, aRunInGlobalScope));
return true;
}
@ -615,11 +621,6 @@ TabParent::LoadURL(nsIURI* aURI)
{
MOZ_ASSERT(aURI);
if (mSkipLoad) {
// Don't send the message if the child wants to load its own URL.
return;
}
if (mIsDestroyed) {
return;
}
@ -627,6 +628,13 @@ TabParent::LoadURL(nsIURI* aURI)
nsCString spec;
aURI->GetSpec(spec);
if (mCreatingWindow) {
// Don't send the message if the child wants to load its own URL.
MOZ_ASSERT(mDelayedURL.IsEmpty());
mDelayedURL = spec;
return;
}
if (!mShown) {
NS_WARNING(nsPrintfCString("TabParent::LoadURL(%s) called before "
"Show(). Ignoring LoadURL.\n",

Просмотреть файл

@ -144,7 +144,8 @@ public:
const nsString& aFeatures,
const nsString& aBaseURI,
bool* aWindowIsNew,
InfallibleTArray<FrameScriptInfo>* aFrameScripts) MOZ_OVERRIDE;
InfallibleTArray<FrameScriptInfo>* aFrameScripts,
nsCString* aURLToLoad) MOZ_OVERRIDE;
virtual bool RecvSyncMessage(const nsString& aMessage,
const ClonedMessageData& aData,
InfallibleTArray<CpowEntry>&& aCpows,
@ -489,14 +490,23 @@ private:
static TabParent* sNextTabParent;
// When loading a new tab or window via window.open, the child is
// responsible for loading the URL it wants into the new
// TabChild. Simultaneously, though, the parent sends a LoadURL message to
// every new PBrowser (usually for about:blank). This message usually
// arrives after the child has started to load the URL it wants, and
// overrides it. To prevent this, we set mSkipLoad to true when creating the
// new tab. This flag prevents the unwanted LoadURL message from being sent
// by the parent.
bool mSkipLoad;
// responsible for loading the URL it wants into the new TabChild. When the
// parent receives the CreateWindow message, though, it sends a LoadURL
// message, usually for about:blank. It's important for the about:blank load
// to get processed because the Firefox frontend expects every new window to
// immediately start loading something (see bug 1123090). However, we want
// the child to process the LoadURL message before it returns from
// ProvideWindow so that the URL sent from the parent doesn't override the
// child's URL. This is not possible using our IPC mechanisms. To solve the
// problem, we skip sending the LoadURL message in the parent and instead
// return the URL as a result from CreateWindow. The child simulates
// receiving a LoadURL message before returning from ProvideWindow.
//
// The mCreatingWindow flag is set while dispatching CreateWindow. During
// that time, any LoadURL calls are skipped and the URL is stored in
// mSkippedURL.
bool mCreatingWindow;
nsCString mDelayedURL;
// When loading a new tab or window via window.open, we want to ensure that
// frame scripts for that tab are loaded before any scripts start to run in

Просмотреть файл

@ -74,14 +74,9 @@ const BrowserElementIsPreloaded = true;
Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci["nsIAppStartup"]);
Cc["@mozilla.org/uriloader;1"].getService(Ci["nsIURILoader"]);
Cc["@mozilla.org/cspcontext;1"].createInstance(Ci["nsIContentSecurityPolicy"]);
Cc["@mozilla.org/settingsManager;1"].createInstance(Ci["nsISupports"]);
/* Applications Specific Helper */
try {
// May throw if we don't have the settings permission
navigator.mozSettings;
} catch(e) {
}
try {
if (Services.prefs.getBoolPref("dom.sysmsg.enabled")) {
Cc["@mozilla.org/system-message-manager;1"].getService(Ci["nsIDOMNavigatorSystemMessages"]);

Просмотреть файл

@ -258,8 +258,8 @@ public:
}
// Bilinear interpolation between adjacent samples in each table.
float floorPhase = floorf(mPhase);
uint32_t j1 = floorPhase;
j1 &= indexMask;
int j1Signed = static_cast<int>(floorPhase);
uint32_t j1 = j1Signed & indexMask;
uint32_t j2 = j1 + 1;
j2 &= indexMask;

Просмотреть файл

@ -127,7 +127,6 @@ skip-if = (toolkit == 'gonk' && !debug) || android_version == '10' # Android: bu
[test_oscillatorNode.html]
[test_oscillatorNode2.html]
[test_oscillatorNodeNegativeFrequency.html]
skip-if = (toolkit == 'gonk') || (toolkit == 'android')
[test_oscillatorNodePassThrough.html]
[test_oscillatorNodeStart.html]
[test_oscillatorTypeChange.html]

Просмотреть файл

@ -391,11 +391,21 @@ PluginModuleChromeParent::LoadModule(const char* aFilePath, uint32_t aPluginId,
{
PLUGIN_LOG_DEBUG_FUNCTION;
bool enableSandbox = false;
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
nsAutoCString sandboxPref("dom.ipc.plugins.sandbox.");
sandboxPref.Append(aPluginTag->GetNiceFileName());
if (NS_FAILED(Preferences::GetBool(sandboxPref.get(), &enableSandbox))) {
enableSandbox = Preferences::GetBool("dom.ipc.plugins.sandbox.default");
}
#endif
nsAutoPtr<PluginModuleChromeParent> parent(new PluginModuleChromeParent(aFilePath, aPluginId));
UniquePtr<LaunchCompleteTask> onLaunchedRunnable(new LaunchedTask(parent));
parent->mSubprocess->SetCallRunnableImmediately(!parent->mIsStartingAsync);
TimeStamp launchStart = TimeStamp::Now();
bool launched = parent->mSubprocess->Launch(Move(onLaunchedRunnable));
bool launched = parent->mSubprocess->Launch(Move(onLaunchedRunnable),
enableSandbox);
if (!launched) {
// We never reached open
parent->mShutdown = true;

Просмотреть файл

@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/string_util.h"
#include "chrome/common/chrome_switches.h"
#include "nsDebugImpl.h"
#if defined(XP_MACOSX)
#include "nsCocoaFeatures.h"
@ -23,6 +24,10 @@ extern "C" CGError CGSSetDebugOptions(int options);
#ifdef XP_WIN
#include <objbase.h>
bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath);
#if defined(MOZ_SANDBOX)
#define TARGET_SANDBOX_EXPORTS
#include "mozilla/sandboxTarget.h"
#endif
#endif
using mozilla::ipc::IOThreadChild;
@ -49,6 +54,8 @@ namespace plugins {
bool
PluginProcessChild::Init()
{
nsDebugImpl::SetMultiprocessMode("NPAPI");
#if defined(XP_MACOSX)
// Remove the trigger for "dyld interposing" that we added in
// GeckoChildProcessHost::PerformAsyncLaunchInternal(), in the host
@ -117,6 +124,13 @@ PluginProcessChild::Init()
}
pluginFilename = WideToUTF8(values[0]);
#if defined(MOZ_SANDBOX)
// This is probably the earliest we would want to start the sandbox.
// As we attempt to tighten the sandbox, we may need to consider moving this
// to later in the plugin initialization.
mozilla::SandboxTarget::Instance()->StartSandbox();
#endif
#else
# error Sorry
#endif

Просмотреть файл

@ -43,8 +43,18 @@ PluginProcessParent::~PluginProcessParent()
}
bool
PluginProcessParent::Launch(mozilla::UniquePtr<LaunchCompleteTask> aLaunchCompleteTask)
PluginProcessParent::Launch(mozilla::UniquePtr<LaunchCompleteTask> aLaunchCompleteTask,
bool aEnableSandbox)
{
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
mEnableNPAPISandbox = aEnableSandbox;
#else
if (aEnableSandbox) {
MOZ_ASSERT(false,
"Can't enable an NPAPI process sandbox for platform/build.");
}
#endif
ProcessArchitecture currentArchitecture = base::GetCurrentProcessArchitecture();
uint32_t containerArchitectures = GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);

Просмотреть файл

@ -50,8 +50,11 @@ public:
*
* @param aLaunchCompleteTask Task that is executed on the main
* thread once the asynchonous launch has completed.
* @param aEnableSandbox Enables a process sandbox if one is available for
* this platform/build. Will assert if true passed and one is not available.
*/
bool Launch(UniquePtr<LaunchCompleteTask> aLaunchCompleteTask = UniquePtr<LaunchCompleteTask>());
bool Launch(UniquePtr<LaunchCompleteTask> aLaunchCompleteTask = UniquePtr<LaunchCompleteTask>(),
bool aEnableSandbox = false);
void Delete();

Просмотреть файл

@ -344,14 +344,16 @@ NetworkManager.prototype = {
gNetworkService.removeHostRoutes(network.name);
this.setHostRoutes(network);
}
// Remove pre-created default route and let setAndConfigureActive()
// to set default route only on preferred network
gNetworkService.removeDefaultRoute(network);
// Dun type is a special case where we add the default route to a
// secondary table.
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
this.setSecondaryDefaultRoute(network);
}
// Remove pre-created default route and let setAndConfigureActive()
// to set default route only on preferred network
gNetworkService.removeDefaultRoute(network);
this._addSubnetRoutes(network);
this.setAndConfigureActive();

Просмотреть файл

@ -1185,6 +1185,57 @@ void NetworkUtils::setDefaultNetwork(CommandChain* aChain,
doCommand(command, aChain, aCallback);
}
void NetworkUtils::addRouteToSecondaryTable(CommandChain* aChain,
CommandCallback aCallback,
NetworkResultOptions& aResult) {
char command[MAX_COMMAND_SIZE];
if (SDK_VERSION >= 20) {
snprintf(command, MAX_COMMAND_SIZE - 1,
"network route add %d %s %s/%s %s",
GET_FIELD(mNetId),
GET_CHAR(mIfname),
GET_CHAR(mIp),
GET_CHAR(mPrefix),
GET_CHAR(mGateway));
} else {
snprintf(command, MAX_COMMAND_SIZE - 1,
"interface route add %s secondary %s %s %s",
GET_CHAR(mIfname),
GET_CHAR(mIp),
GET_CHAR(mPrefix),
GET_CHAR(mGateway));
}
doCommand(command, aChain, aCallback);
}
void NetworkUtils::removeRouteFromSecondaryTable(CommandChain* aChain,
CommandCallback aCallback,
NetworkResultOptions& aResult) {
char command[MAX_COMMAND_SIZE];
if (SDK_VERSION >= 20) {
snprintf(command, MAX_COMMAND_SIZE - 1,
"network route remove %d %s %s/%s %s",
GET_FIELD(mNetId),
GET_CHAR(mIfname),
GET_CHAR(mIp),
GET_CHAR(mPrefix),
GET_CHAR(mGateway));
} else {
snprintf(command, MAX_COMMAND_SIZE - 1,
"interface route remove %s secondary %s %s %s",
GET_CHAR(mIfname),
GET_CHAR(mIp),
GET_CHAR(mPrefix),
GET_CHAR(mGateway));
}
doCommand(command, aChain, aCallback);
}
void NetworkUtils::setIpv6Enabled(CommandChain* aChain,
CommandCallback aCallback,
NetworkResultOptions& aResult,
@ -2119,30 +2170,40 @@ CommandResult NetworkUtils::removeNetworkRouteLegacy(NetworkParams& aOptions)
CommandResult NetworkUtils::addSecondaryRoute(NetworkParams& aOptions)
{
char command[MAX_COMMAND_SIZE];
snprintf(command, MAX_COMMAND_SIZE - 1,
"interface route add %s secondary %s %s %s",
GET_CHAR(mIfname),
GET_CHAR(mIp),
GET_CHAR(mPrefix),
GET_CHAR(mGateway));
static CommandFunc COMMAND_CHAIN[] = {
addRouteToSecondaryTable,
defaultAsyncSuccessHandler
};
doCommand(command, nullptr, nullptr);
return SUCCESS;
if (SDK_VERSION >= 20) {
NetIdManager::NetIdInfo netIdInfo;
if (!mNetIdManager.lookup(aOptions.mIfname, &netIdInfo)) {
return -1;
}
aOptions.mNetId = netIdInfo.mNetId;
}
runChain(aOptions, COMMAND_CHAIN, defaultAsyncFailureHandler);
return CommandResult::Pending();
}
CommandResult NetworkUtils::removeSecondaryRoute(NetworkParams& aOptions)
{
char command[MAX_COMMAND_SIZE];
snprintf(command, MAX_COMMAND_SIZE - 1,
"interface route remove %s secondary %s %s %s",
GET_CHAR(mIfname),
GET_CHAR(mIp),
GET_CHAR(mPrefix),
GET_CHAR(mGateway));
static CommandFunc COMMAND_CHAIN[] = {
removeRouteFromSecondaryTable,
defaultAsyncSuccessHandler
};
doCommand(command, nullptr, nullptr);
return SUCCESS;
if (SDK_VERSION >= 20) {
NetIdManager::NetIdInfo netIdInfo;
if (!mNetIdManager.lookup(aOptions.mIfname, &netIdInfo)) {
return -1;
}
aOptions.mNetId = netIdInfo.mNetId;
}
runChain(aOptions, COMMAND_CHAIN, defaultAsyncFailureHandler);
return CommandResult::Pending();
}
CommandResult NetworkUtils::setNetworkInterfaceAlarm(NetworkParams& aOptions)

Просмотреть файл

@ -392,6 +392,8 @@ private:
static void enableIpv6(PARAMS);
static void disableIpv6(PARAMS);
static void setIpv6Enabled(PARAMS, bool aEnabled);
static void addRouteToSecondaryTable(PARAMS);
static void removeRouteFromSecondaryTable(PARAMS);
static void defaultAsyncSuccessHandler(PARAMS);
#undef PARAMS

Просмотреть файл

@ -0,0 +1,198 @@
/* 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/. */
#include "WindowsLocationProvider.h"
#include "nsGeoPosition.h"
#include "nsIDOMGeoPositionError.h"
#include "prtime.h"
#include <LocationApi.h>
namespace mozilla {
namespace dom {
class LocationEvent MOZ_FINAL : public ILocationEvents
{
public:
LocationEvent(nsIGeolocationUpdate* aCallback)
: mCallback(aCallback), mCount(0) {
}
// IUnknown interface
STDMETHODIMP_(ULONG) AddRef() MOZ_OVERRIDE;
STDMETHODIMP_(ULONG) Release() MOZ_OVERRIDE;
STDMETHODIMP QueryInterface(REFIID iid, void** ppv) MOZ_OVERRIDE;
// ILocationEvents interface
STDMETHODIMP OnStatusChanged(REFIID aReportType,
LOCATION_REPORT_STATUS aStatus) MOZ_OVERRIDE;
STDMETHODIMP OnLocationChanged(REFIID aReportType,
ILocationReport *aReport) MOZ_OVERRIDE;
private:
nsCOMPtr<nsIGeolocationUpdate> mCallback;
ULONG mCount;
};
STDMETHODIMP_(ULONG)
LocationEvent::AddRef()
{
return InterlockedIncrement(&mCount);
}
STDMETHODIMP_(ULONG)
LocationEvent::Release()
{
ULONG count = InterlockedDecrement(&mCount);
if (!count) {
delete this;
return 0;
}
return count;
}
STDMETHODIMP
LocationEvent::QueryInterface(REFIID iid, void** ppv)
{
if (iid == IID_IUnknown) {
*ppv = static_cast<IUnknown*>(this);
} else if (iid == IID_ILocationEvents) {
*ppv = static_cast<ILocationEvents*>(this);
} else {
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
STDMETHODIMP
LocationEvent::OnStatusChanged(REFIID aReportType,
LOCATION_REPORT_STATUS aStatus)
{
if (aReportType != IID_ILatLongReport) {
return S_OK;
}
uint16_t err;
switch (aStatus) {
case REPORT_ACCESS_DENIED:
err = nsIDOMGeoPositionError::PERMISSION_DENIED;
break;
case REPORT_ERROR:
err = nsIDOMGeoPositionError::POSITION_UNAVAILABLE;
break;
default:
return S_OK;
}
mCallback->NotifyError(err);
return S_OK;
}
STDMETHODIMP
LocationEvent::OnLocationChanged(REFIID aReportType,
ILocationReport *aReport)
{
if (aReportType != IID_ILatLongReport) {
return S_OK;
}
nsRefPtr<ILatLongReport> latLongReport;
if (FAILED(aReport->QueryInterface(IID_ILatLongReport,
getter_AddRefs(latLongReport)))) {
return E_FAIL;
}
DOUBLE latitude = 0.0;
latLongReport->GetLatitude(&latitude);
DOUBLE longitude = 0.0;
latLongReport->GetLongitude(&longitude);
DOUBLE alt = 0.0;
latLongReport->GetAltitude(&alt);
DOUBLE herror = 0.0;
latLongReport->GetErrorRadius(&herror);
DOUBLE verror = 0.0;
latLongReport->GetAltitudeError(&verror);
nsRefPtr<nsGeoPosition> position =
new nsGeoPosition(latitude, longitude, alt, herror, verror, 0.0, 0.0,
PR_Now());
mCallback->Update(position);
return S_OK;
}
NS_IMPL_ISUPPORTS(WindowsLocationProvider, nsIGeolocationProvider)
WindowsLocationProvider::WindowsLocationProvider()
{
}
NS_IMETHODIMP
WindowsLocationProvider::Startup()
{
nsRefPtr<ILocation> location;
if (FAILED(::CoCreateInstance(CLSID_Location, nullptr, CLSCTX_INPROC_SERVER,
IID_ILocation,
getter_AddRefs(location)))) {
return NS_ERROR_FAILURE;
}
IID reportTypes[] = { IID_ILatLongReport };
if (FAILED(location->RequestPermissions(nullptr, reportTypes, 1, FALSE))) {
return NS_ERROR_FAILURE;
}
mLocation = location;
return NS_OK;
}
NS_IMETHODIMP
WindowsLocationProvider::Watch(nsIGeolocationUpdate* aCallback)
{
nsRefPtr<LocationEvent> event = new LocationEvent(aCallback);
if (FAILED(mLocation->RegisterForReport(event, IID_ILatLongReport, 0))) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
WindowsLocationProvider::Shutdown()
{
if (mLocation) {
mLocation->UnregisterForReport(IID_ILatLongReport);
mLocation = nullptr;
}
return NS_OK;
}
NS_IMETHODIMP
WindowsLocationProvider::SetHighAccuracy(bool enable)
{
if (!mLocation) {
return NS_ERROR_FAILURE;
}
LOCATION_DESIRED_ACCURACY desiredAccuracy;
if (enable) {
desiredAccuracy = LOCATION_DESIRED_ACCURACY_HIGH;
} else {
desiredAccuracy = LOCATION_DESIRED_ACCURACY_DEFAULT;
}
if (FAILED(mLocation->SetDesiredAccuracy(IID_ILatLongReport,
desiredAccuracy))) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,31 @@
/* 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/. */
#ifndef mozilla_dom_WindowsLocationProvider_h__
#define mozilla_dom_WindowsLocationProvider_h__
#include "nsAutoPtr.h"
#include "nsIGeolocationProvider.h"
#include <LocationApi.h>
namespace mozilla {
namespace dom {
class WindowsLocationProvider MOZ_FINAL : public nsIGeolocationProvider
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGEOLOCATIONPROVIDER
WindowsLocationProvider();
private:
nsRefPtr<ILocation> mLocation;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_WindowsLocationProvider_h__

Просмотреть файл

@ -6,6 +6,7 @@
SOURCES += [
'nsHapticFeedback.cpp',
'WindowsLocationProvider.cpp'
]
FAIL_ON_WARNINGS = True

Просмотреть файл

@ -0,0 +1,128 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = ["DialNumberUtils"];
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/systemlibs.js");
const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
const MMI_MATCH_GROUP_FULL_MMI = 1;
const MMI_MATCH_GROUP_PROCEDURE = 2;
const MMI_MATCH_GROUP_SERVICE_CODE = 3;
const MMI_MATCH_GROUP_SIA = 4;
const MMI_MATCH_GROUP_SIB = 5;
const MMI_MATCH_GROUP_SIC = 6;
const MMI_MATCH_GROUP_PWD_CONFIRM = 7;
const MMI_MATCH_GROUP_DIALING_NUMBER = 8;
this.DialNumberUtils = {
/**
* Check a given number against the list of emergency numbers provided by the
* RIL.
*/
isEmergency: function(aNumber) {
// Check ril provided numbers first.
let numbers = libcutils.property_get("ril.ecclist") ||
libcutils.property_get("ro.ril.ecclist");
if (numbers) {
numbers = numbers.split(",");
} else {
// No ecclist system property, so use our own list.
numbers = DEFAULT_EMERGENCY_NUMBERS;
}
return numbers.indexOf(aNumber) != -1;
},
_mmiRegExp: (function() {
// Procedure, which could be *, #, *#, **, ##
let procedure = "(\\*[*#]?|##?)";
// Service code, which is a 2 or 3 digits that uniquely specifies the
// Supplementary Service associated with the MMI code.
let serviceCode = "(\\d{2,3})";
// Supplementary Information SIA, SIB and SIC.
// Where a particular service request does not require any SI, "*SI" is
// not entered. The use of SIA, SIB and SIC is optional and shall be
// entered in any of the following formats:
// - *SIA*SIB*SIC#
// - *SIA*SIB#
// - *SIA**SIC#
// - *SIA#
// - **SIB*SIC#
// - ***SIC#
//
// Also catch the additional NEW_PASSWORD for the case of a password
// registration procedure. Ex:
// - * 03 * ZZ * OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
// - ** 03 * ZZ * OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
// - * 03 ** OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
// - ** 03 ** OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
let si = "\\*([^*#]*)";
let allSi = "";
for (let i = 0; i < 4; ++i) {
allSi = "(?:" + si + allSi + ")?";
}
let fullmmi = "(" + procedure + serviceCode + allSi + "#)";
// Dial string after the #.
let optionalDialString = "([^#]+)?";
return new RegExp("^" + fullmmi + optionalDialString + "$");
})(),
_isPoundString: function(aString) {
return aString && aString[aString.length - 1] === "#";
},
_isShortString: function(aString) {
if (!aString || this.isEmergency(aString) || aString.length > 2 ||
(aString.length == 2 && aString[0] === "1")) {
return false;
}
return true;
},
/**
* Check parse the given string as an MMI code.
*
* An MMI code should be:
* - Activation (*SC*SI#).
* - Deactivation (#SC*SI#).
* - Interrogation (*#SC*SI#).
* - Registration (**SC*SI#).
* - Erasure (##SC*SI#).
* where SC = Service Code (2 or 3 digits) and SI = Supplementary Info
* (variable length).
*/
parseMMI: function(aString) {
let matches = this._mmiRegExp.exec(aString);
if (matches) {
return {
fullMMI: matches[MMI_MATCH_GROUP_FULL_MMI],
procedure: matches[MMI_MATCH_GROUP_PROCEDURE],
serviceCode: matches[MMI_MATCH_GROUP_SERVICE_CODE],
sia: matches[MMI_MATCH_GROUP_SIA],
sib: matches[MMI_MATCH_GROUP_SIB],
sic: matches[MMI_MATCH_GROUP_SIC],
pwd: matches[MMI_MATCH_GROUP_PWD_CONFIRM],
dialNumber: matches[MMI_MATCH_GROUP_DIALING_NUMBER]
};
}
if (this._isPoundString(aString) || this._isShortString(aString)) {
return {
fullMMI: aString
};
}
return null;
}
};

Просмотреть файл

@ -10,7 +10,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/systemlibs.js");
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
let obj = {};
@ -48,20 +47,9 @@ const DIAL_ERROR_INVALID_STATE_ERROR = "InvalidStateError";
const DIAL_ERROR_OTHER_CONNECTION_IN_USE = "OtherConnectionInUse";
const DIAL_ERROR_BAD_NUMBER = RIL.GECKO_CALL_ERROR_BAD_NUMBER;
const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
const TONES_GAP_DURATION = 70;
// MMI match groups
const MMI_MATCH_GROUP_FULL_MMI = 1;
const MMI_MATCH_GROUP_PROCEDURE = 2;
const MMI_MATCH_GROUP_SERVICE_CODE = 3;
const MMI_MATCH_GROUP_SIA = 4;
const MMI_MATCH_GROUP_SIB = 5;
const MMI_MATCH_GROUP_SIC = 6;
const MMI_MATCH_GROUP_PWD_CONFIRM = 7;
const MMI_MATCH_GROUP_DIALING_NUMBER = 8;
let DEBUG;
function debug(s) {
dump("TelephonyService: " + s + "\n");
@ -93,6 +81,12 @@ XPCOMUtils.defineLazyGetter(this, "gPhoneNumberUtils", function() {
return ns.PhoneNumberUtils;
});
XPCOMUtils.defineLazyGetter(this, "gDialNumberUtils", function() {
let ns = {};
Cu.import("resource://gre/modules/DialNumberUtils.jsm", ns);
return ns.DialNumberUtils;
});
function MobileCallForwardingOptions(aOptions) {
for (let key in aOptions) {
this[key] = aOptions[key];
@ -160,8 +154,6 @@ function TelephonyService() {
this._numClients = gRadioInterfaceLayer.numRadioInterfaces;
this._listeners = [];
this._mmiRegExp = null;
this._isDialing = false;
this._cachedDialRequest = null;
this._currentCalls = {};
@ -343,26 +335,6 @@ TelephonyService.prototype = {
});
},
/**
* Check a given number against the list of emergency numbers provided by the
* RIL.
*
* @param aNumber
* The number to look up.
*/
_isEmergencyNumber: function(aNumber) {
// Check ril provided numbers first.
let numbers = libcutils.property_get("ril.ecclist") ||
libcutils.property_get("ro.ril.ecclist");
if (numbers) {
numbers = numbers.split(",");
} else {
// No ecclist system property, so use our own list.
numbers = DEFAULT_EMERGENCY_NUMBERS;
}
return numbers.indexOf(aNumber) != -1;
},
/**
* Checks whether to temporarily suppress caller id for the call.
*
@ -553,7 +525,7 @@ TelephonyService.prototype = {
isDialEmergency: aIsDialEmergency }, aCallback);
}
} else {
let mmi = this._parseMMI(aNumber);
let mmi = gDialNumberUtils.parseMMI(aNumber);
if (!mmi) {
this._dialCall(aClientId,
{ number: aNumber,
@ -602,7 +574,7 @@ TelephonyService.prototype = {
return;
}
aOptions.isEmergency = this._isEmergencyNumber(aOptions.number);
aOptions.isEmergency = gDialNumberUtils.isEmergency(aOptions.number);
if (aOptions.isEmergency) {
// Automatically select a proper clientId for emergency call.
aClientId = gRadioInterfaceLayer.getClientIdForEmergencyCall() ;
@ -750,138 +722,6 @@ TelephonyService.prototype = {
});
},
/**
* Build the regex to parse MMI string. TS.22.030
*
* The resulting groups after matching will be:
* 1 = full MMI string that might be used as a USSD request.
* 2 = MMI procedure.
* 3 = Service code.
* 4 = SIA.
* 5 = SIB.
* 6 = SIC.
* 7 = Password registration.
* 8 = Dialing number.
*/
_buildMMIRegExp: function() {
// The general structure of the codes is as follows:
// - Activation (*SC*SI#).
// - Deactivation (#SC*SI#).
// - Interrogation (*#SC*SI#).
// - Registration (**SC*SI#).
// - Erasure (##SC*SI#).
//
// where SC = Service Code (2 or 3 digits) and SI = Supplementary Info
// (variable length).
// Procedure, which could be *, #, *#, **, ##
let procedure = "(\\*[*#]?|##?)";
// Service code, which is a 2 or 3 digits that uniquely specifies the
// Supplementary Service associated with the MMI code.
let serviceCode = "(\\d{2,3})";
// Supplementary Information SIA, SIB and SIC. SIA may comprise e.g. a PIN
// code or Directory Number, SIB may be used to specify the tele or bearer
// service and SIC to specify the value of the "No Reply Condition Timer".
// Where a particular service request does not require any SI, "*SI" is
// not entered. The use of SIA, SIB and SIC is optional and shall be
// entered in any of the following formats:
// - *SIA*SIB*SIC#
// - *SIA*SIB#
// - *SIA**SIC#
// - *SIA#
// - **SIB*SIC#
// - ***SIC#
//
// Also catch the additional NEW_PASSWORD for the case of a password
// registration procedure. Ex:
// - * 03 * ZZ * OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
// - ** 03 * ZZ * OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
// - * 03 ** OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
// - ** 03 ** OLD_PASSWORD * NEW_PASSWORD * NEW_PASSWORD #
let si = "\\*([^*#]*)";
let allSi = "";
for (let i = 0; i < 4; ++i) {
allSi = "(?:" + si + allSi + ")?";
}
let fullmmi = "(" + procedure + serviceCode + allSi + "#)";
// Dial string after the #.
let optionalDialString = "([^#]+)?";
return new RegExp("^" + fullmmi + optionalDialString + "$");
},
/**
* Provide the regex to parse MMI string.
*/
_getMMIRegExp: function() {
if (!this._mmiRegExp) {
this._mmiRegExp = this._buildMMIRegExp();
}
return this._mmiRegExp;
},
/**
* Helper to parse # string. TS.22.030 Figure 3.5.3.2.
*/
_isPoundString: function(aMmiString) {
return (aMmiString.charAt(aMmiString.length - 1) === "#");
},
/**
* Helper to parse short string. TS.22.030 Figure 3.5.3.2.
*/
_isShortString: function(aMmiString) {
if (aMmiString.length > 2) {
return false;
}
// Input string is
// - emergency number or
// - 2 digits starting with a "1"
if (this._isEmergencyNumber(aMmiString) ||
(aMmiString.length == 2) && (aMmiString.charAt(0) === '1')) {
return false;
}
return true;
},
/**
* Helper to parse MMI/USSD string. TS.22.030 Figure 3.5.3.2.
*/
_parseMMI: function(aMmiString) {
if (!aMmiString) {
return null;
}
let matches = this._getMMIRegExp().exec(aMmiString);
if (matches) {
return {
fullMMI: matches[MMI_MATCH_GROUP_FULL_MMI],
procedure: matches[MMI_MATCH_GROUP_PROCEDURE],
serviceCode: matches[MMI_MATCH_GROUP_SERVICE_CODE],
sia: matches[MMI_MATCH_GROUP_SIA],
sib: matches[MMI_MATCH_GROUP_SIB],
sic: matches[MMI_MATCH_GROUP_SIC],
pwd: matches[MMI_MATCH_GROUP_PWD_CONFIRM],
dialNumber: matches[MMI_MATCH_GROUP_DIALING_NUMBER]
};
}
if (this._isPoundString(aMmiString) || this._isShortString(aMmiString)) {
return {
fullMMI: aMmiString
};
}
return null;
},
_serviceCodeToKeyString: function(aServiceCode) {
switch (aServiceCode) {
case RIL.MMI_SC_CFU:
@ -1178,7 +1018,7 @@ TelephonyService.prototype = {
aCall.clientId = aClientId;
aCall.state = nsITelephonyService.CALL_STATE_DISCONNECTED;
aCall.isEmergency = this._isEmergencyNumber(aCall.number);
aCall.isEmergency = gDialNumberUtils.isEmergency(aCall.number);
let duration = ("started" in aCall && typeof aCall.started == "number") ?
new Date().getTime() - aCall.started : 0;
@ -1273,12 +1113,12 @@ TelephonyService.prototype = {
call.state = aCall.state;
call.number = aCall.number;
call.isConference = aCall.isConference;
call.isEmergency = this._isEmergencyNumber(aCall.number);
call.isEmergency = gDialNumberUtils.isEmergency(aCall.number);
call.isSwitchable = pick(aCall.isSwitchable, call.isSwitchable);
call.isMergeable = pick(aCall.isMergeable, call.isMergeable);
} else {
call = aCall;
call.isEmergency = pick(aCall.isEmergency, this._isEmergencyNumber(aCall.number));
call.isEmergency = pick(aCall.isEmergency, gDialNumberUtils.isEmergency(aCall.number));
call.isSwitchable = pick(aCall.isSwitchable, true);
call.isMergeable = pick(aCall.isMergeable, true);
call.name = pick(aCall.name, "");

Просмотреть файл

@ -66,6 +66,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
'gonk/TelephonyService.js',
'gonk/TelephonyService.manifest',
]
EXTRA_JS_MODULES += [
'gonk/DialNumberUtils.jsm'
]
FAIL_ON_WARNINGS = True
include('/ipc/chromium/chromium-config.mozbuild')

Просмотреть файл

@ -4,15 +4,14 @@
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
let NS = {};
subscriptLoader.loadSubScript("resource://gre/components/TelephonyService.js",
NS);
subscriptLoader.loadSubScript("resource://gre/modules/DialNumberUtils.jsm", NS);
function run_test() {
run_next_test();
}
function parseMMI(mmiString) {
return NS.TelephonyService.prototype._parseMMI(mmiString);
return NS.DialNumberUtils.parseMMI(mmiString);
}
add_test(function test_parseMMI_empty() {

Просмотреть файл

@ -5,7 +5,7 @@
const TEST_URI = "http://example.com/browser/dom/tests/browser/test-console-api.html";
var gWindow, gLevel, gArgs, gTestDriver, gStyle;
var gWindow, gLevel, gArgs, gStyle;
function test() {
waitForExplicitFinish();
@ -15,7 +15,7 @@ function test() {
var browser = gBrowser.selectedBrowser;
registerCleanupFunction(function () {
gWindow = gLevel = gArgs = gTestDriver = null;
gWindow = gLevel = gArgs = null;
gBrowser.removeTab(tab);
});
@ -26,8 +26,7 @@ function test() {
executeSoon(function test_executeSoon() {
gWindow = browser.contentWindow;
consoleAPISanityTest();
gTestDriver = observeConsoleTest();
gTestDriver.next();
observeConsoleTest();
});
}, false);
@ -74,8 +73,6 @@ function testConsoleData(aMessageObject) {
}
}
}
gTestDriver.next();
}
function testLocationData(aMessageObject) {
@ -215,127 +212,100 @@ function observeConsoleTest() {
let win = XPCNativeWrapper.unwrap(gWindow);
expect("log", "arg");
win.console.log("arg");
yield undefined;
expect("info", "arg", "extra arg");
win.console.info("arg", "extra arg");
yield undefined;
expect("warn", "Lesson 1: PI is approximately equal to 3");
win.console.warn("Lesson %d: %s is approximately equal to %1.0f",
1,
"PI",
3.14159);
yield undefined;
expect("warn", "Lesson 1: PI is approximately equal to 3.14");
win.console.warn("Lesson %d: %s is approximately equal to %1.2f",
1,
"PI",
3.14159);
yield undefined;
expect("warn", "Lesson 1: PI is approximately equal to 3.141590");
win.console.warn("Lesson %d: %s is approximately equal to %f",
1,
"PI",
3.14159);
yield undefined;
expect("warn", "Lesson 1: PI is approximately equal to 3.1415900");
win.console.warn("Lesson %d: %s is approximately equal to %0.7f",
1,
"PI",
3.14159);
yield undefined;
expect("log", "%d, %s, %l");
win.console.log("%d, %s, %l");
yield undefined;
expect("log", "%a %b %g");
win.console.log("%a %b %g");
yield undefined;
expect("log", "%a %b %g", "a", "b");
win.console.log("%a %b %g", "a", "b");
yield undefined;
expect("log", "2, a, %l", 3);
win.console.log("%d, %s, %l", 2, "a", 3);
yield undefined;
// Bug #692550 handle null and undefined.
expect("log", "null, undefined");
win.console.log("%s, %s", null, undefined);
yield undefined;
// Bug #696288 handle object as first argument.
let obj = { a: 1 };
expect("log", obj, "a");
win.console.log(obj, "a");
yield undefined;
expect("dir", win.toString());
win.console.dir(win);
yield undefined;
expect("error", "arg");
win.console.error("arg");
yield undefined;
expect("exception", "arg");
win.console.exception("arg");
yield undefined;
expect("log", "foobar");
gStyle = ["color:red;foobar;;"];
win.console.log("%cfoobar", gStyle[0]);
yield undefined;
let obj4 = { d: 4 };
expect("warn", "foobar", obj4, "test", "bazbazstr", "last");
gStyle = [null, null, null, "color:blue;", "color:red"];
win.console.warn("foobar%Otest%cbazbaz%s%clast", obj4, gStyle[3], "str", gStyle[4]);
yield undefined;
let obj3 = { c: 3 };
expect("info", "foobar", "bazbaz", obj3, "%comg", "color:yellow");
gStyle = [null, "color:pink;"];
win.console.info("foobar%cbazbaz", gStyle[1], obj3, "%comg", "color:yellow");
yield undefined;
gStyle = null;
let obj2 = { b: 2 };
expect("log", "omg ", obj, " foo ", 4, obj2);
win.console.log("omg %o foo %o", obj, 4, obj2);
yield undefined;
expect("assert", "message");
win.console.assert(false, "message");
yield undefined;
expect("count", { label: "label a", count: 1 })
win.console.count("label a");
yield undefined;
expect("count", { label: "label b", count: 1 })
win.console.count("label b");
yield undefined;
expect("count", { label: "label a", count: 2 })
win.console.count("label a");
yield undefined;
expect("count", { label: "label b", count: 2 })
win.console.count("label b");
yield undefined;
startTraceTest();
yield undefined;
startLocationTest();
yield undefined;
}
function consoleAPISanityTest() {

Просмотреть файл

@ -56,6 +56,7 @@ partial interface Event {
readonly attribute EventTarget? originalTarget;
readonly attribute EventTarget? explicitOriginalTarget;
[ChromeOnly] readonly attribute EventTarget? composedTarget;
[ChromeOnly] readonly attribute boolean multipleActionsPrevented;
[ChromeOnly] readonly attribute boolean isSynthesized;

Просмотреть файл

@ -1729,6 +1729,14 @@ private:
bool mIsOffline;
};
#ifdef DEBUG
static bool
StartsWithExplicit(nsACString& s)
{
return StringBeginsWith(s, NS_LITERAL_CSTRING("explicit/"));
}
#endif
class WorkerJSRuntimeStats : public JS::RuntimeStats
{
const nsACString& mRtPath;
@ -1761,6 +1769,9 @@ public:
xpc::ZoneStatsExtras* extras = new xpc::ZoneStatsExtras;
extras->pathPrefix = mRtPath;
extras->pathPrefix += nsPrintfCString("zone(0x%p)/", (void *)aZone);
MOZ_ASSERT(StartsWithExplicit(extras->pathPrefix));
aZoneStats->extra = extras;
}
@ -1787,6 +1798,9 @@ public:
// This should never be used when reporting with workers (hence the "?!").
extras->domPathPrefix.AssignLiteral("explicit/workers/?!/");
MOZ_ASSERT(StartsWithExplicit(extras->jsPathPrefix));
MOZ_ASSERT(StartsWithExplicit(extras->domPathPrefix));
extras->location = nullptr;
aCompartmentStats->extra = extras;
@ -2081,15 +2095,14 @@ public:
AssertIsOnMainThread();
// Assumes that WorkerJSRuntimeStats will hold a reference to |path|, and
// not a copy, as TryToMapAddon() may later modify if.
// not a copy, as TryToMapAddon() may later modify it.
nsCString path;
WorkerJSRuntimeStats rtStats(path);
{
MutexAutoLock lock(mMutex);
if (!mWorkerPrivate ||
!mWorkerPrivate->BlockAndCollectRuntimeStats(&rtStats, aAnonymize)) {
if (!mWorkerPrivate) {
// Returning NS_OK here will effectively report 0 memory.
return NS_OK;
}
@ -2113,6 +2126,11 @@ public:
path.AppendPrintf(", 0x%p)/", static_cast<void*>(mWorkerPrivate));
TryToMapAddon(path);
if (!mWorkerPrivate->BlockAndCollectRuntimeStats(&rtStats, aAnonymize)) {
// Returning NS_OK here will effectively report 0 memory.
return NS_OK;
}
}
return xpc::ReportJSRuntimeExplicitTreeStats(rtStats, path,
@ -3502,7 +3520,7 @@ WorkerPrivateParent<Derived>::SetBaseURI(nsIURI* aBaseURI)
if (NS_SUCCEEDED(aBaseURI->GetRef(temp)) && !temp.IsEmpty()) {
nsCOMPtr<nsITextToSubURI> converter =
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID);
if (converter) {
if (converter && nsContentUtils::EncodeDecodeURLHash()) {
nsCString charset;
nsAutoString unicodeRef;
if (NS_SUCCEEDED(aBaseURI->GetOriginCharset(charset)) &&

Просмотреть файл

@ -95,6 +95,7 @@ NS_IMPL_RELEASE_INHERITED(WorkerGlobalScope, DOMEventTargetHelper)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerGlobalScope)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
JSObject*

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/Headers.h"
#include "mozilla/dom/RequestBinding.h"
#include "nsWeakReference.h"
namespace mozilla {
namespace dom {
@ -37,7 +38,8 @@ class WorkerNavigator;
class Performance;
class WorkerGlobalScope : public DOMEventTargetHelper,
public nsIGlobalObject
public nsIGlobalObject,
public nsSupportsWeakReference
{
typedef mozilla::dom::indexedDB::IDBFactory IDBFactory;

Просмотреть файл

@ -1133,6 +1133,12 @@ nsEditor::CanCopy(bool *aCanCut)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsEditor::CanDelete(bool *aCanDelete)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsEditor::Paste(int32_t aSelectionType)
{

Просмотреть файл

@ -590,7 +590,7 @@ nsDeleteCommand::IsCommandEnabled(const char *aCommandName,
NS_ENSURE_SUCCESS(rv, rv);
if (!nsCRT::strcmp("cmd_delete", aCommandName) && *outCmdEnabled) {
rv = editor->CanCut(outCmdEnabled);
rv = editor->CanDelete(outCmdEnabled);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -969,7 +969,6 @@ nsHTMLEditor::IsVisBreak(nsINode* aNode)
return true;
}
bool
nsHTMLEditor::IsVisBreak(nsIDOMNode* aNode)
{
@ -978,17 +977,6 @@ nsHTMLEditor::IsVisBreak(nsIDOMNode* aNode)
return IsVisBreak(node);
}
NS_IMETHODIMP
nsHTMLEditor::BreakIsVisible(nsIDOMNode *aNode, bool *aIsVisible)
{
NS_ENSURE_ARG_POINTER(aNode && aIsVisible);
*aIsVisible = IsVisBreak(aNode);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLEditor::GetIsDocumentEditable(bool *aIsDocumentEditable)
{

Просмотреть файл

@ -1153,14 +1153,15 @@ nsPlaintextEditor::Redo(uint32_t aCount)
}
bool
nsPlaintextEditor::CanCutOrCopy()
nsPlaintextEditor::CanCutOrCopy(PasswordFieldAllowed aPasswordFieldAllowed)
{
nsRefPtr<Selection> selection = GetSelection();
if (!selection) {
return false;
}
if (IsPasswordEditor())
if (aPasswordFieldAllowed == ePasswordFieldNotAllowed &&
IsPasswordEditor())
return false;
return !selection->Collapsed();
@ -1198,7 +1199,7 @@ NS_IMETHODIMP nsPlaintextEditor::Cut()
NS_IMETHODIMP nsPlaintextEditor::CanCut(bool *aCanCut)
{
NS_ENSURE_ARG_POINTER(aCanCut);
*aCanCut = IsModifiable() && CanCutOrCopy();
*aCanCut = IsModifiable() && CanCutOrCopy(ePasswordFieldNotAllowed);
return NS_OK;
}
@ -1211,7 +1212,14 @@ NS_IMETHODIMP nsPlaintextEditor::Copy()
NS_IMETHODIMP nsPlaintextEditor::CanCopy(bool *aCanCopy)
{
NS_ENSURE_ARG_POINTER(aCanCopy);
*aCanCopy = CanCutOrCopy();
*aCanCopy = CanCutOrCopy(ePasswordFieldNotAllowed);
return NS_OK;
}
NS_IMETHODIMP nsPlaintextEditor::CanDelete(bool *aCanDelete)
{
NS_ENSURE_ARG_POINTER(aCanDelete);
*aCanDelete = IsModifiable() && CanCutOrCopy(ePasswordFieldAllowed);
return NS_OK;
}

Просмотреть файл

@ -96,6 +96,7 @@ public:
NS_IMETHOD CanCut(bool *aCanCut) MOZ_OVERRIDE;
NS_IMETHOD Copy() MOZ_OVERRIDE;
NS_IMETHOD CanCopy(bool *aCanCopy) MOZ_OVERRIDE;
NS_IMETHOD CanDelete(bool *aCanDelete) MOZ_OVERRIDE;
NS_IMETHOD Paste(int32_t aSelectionType) MOZ_OVERRIDE;
NS_IMETHOD CanPaste(int32_t aSelectionType, bool *aCanPaste) MOZ_OVERRIDE;
NS_IMETHOD PasteTransferable(nsITransferable *aTransferable) MOZ_OVERRIDE;
@ -203,7 +204,11 @@ protected:
/* small utility routine to test the eEditorReadonly bit */
bool IsModifiable();
bool CanCutOrCopy();
enum PasswordFieldAllowed {
ePasswordFieldAllowed,
ePasswordFieldNotAllowed
};
bool CanCutOrCopy(PasswordFieldAllowed aPasswordFieldAllowed);
bool FireClipboardEvent(int32_t aType, int32_t aSelectionType);
bool UpdateMetaCharset(nsIDOMDocument* aDocument,

Просмотреть файл

@ -1198,7 +1198,9 @@ nsTextEditRules::TruncateInsertionIfNeeded(Selection* aSelection,
if (!aSelection || !aInString || !aOutString) {return NS_ERROR_NULL_POINTER;}
nsresult res = NS_OK;
*aOutString = *aInString;
if (!aOutString->Assign(*aInString, mozilla::fallible_t())) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (aTruncated) {
*aTruncated = false;
}
@ -1233,6 +1235,8 @@ nsTextEditRules::TruncateInsertionIfNeeded(Selection* aSelection,
const int32_t resultingDocLength = docLength - selectionLength - oldCompStrLength;
if (resultingDocLength >= aMaxLength)
{
// This call is guaranteed to reduce the capacity of the string, so it
// cannot cause an OOM.
aOutString->Truncate();
if (aTruncated) {
*aTruncated = true;
@ -1253,6 +1257,8 @@ nsTextEditRules::TruncateInsertionIfNeeded(Selection* aSelection,
}
// XXX What should we do if we're removing IVS and its preceding
// character won't be removed?
// This call is guaranteed to reduce the capacity of the string, so it
// cannot cause an OOM.
aOutString->Truncate(newLength);
if (aTruncated) {
*aTruncated = true;

Просмотреть файл

@ -34,12 +34,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1067255
ok(editor1.canCopy(), "can copy, text");
ok(editor1.canCut(), "can cut, text");
ok(editor1.canDelete(), "can delete, text");
password.focus();
password.select();
ok(!editor2.canCopy(), "can copy, password");
ok(!editor2.canCut(), "can cut, password");
ok(editor1.canDelete(), "can delete, password");
SimpleTest.finish();
}

Просмотреть файл

@ -21,8 +21,7 @@ interface nsIEditActionListener;
interface nsIInlineSpellChecker;
interface nsITransferable;
[scriptable, uuid(a1ddae68-35d0-11e4-9329-cb55463f21c9)]
[scriptable, uuid(094be624-f0bf-400f-89e2-6a84baab9474)]
interface nsIEditor : nsISupports
{
%{C++
@ -305,18 +304,22 @@ interface nsIEditor : nsISupports
* collapsed selection.
*/
boolean canCut();
/** copy the currently selected text, putting it into the OS clipboard
* What if no text is selected?
* What about mixed selections?
* What are the clipboard formats?
*/
void copy();
/** Can we copy? True if we have a non-collapsed selection.
*/
boolean canCopy();
/** Can we delete? True if we have a non-collapsed selection.
*/
boolean canDelete();
/** paste the text in the OS clipboard at the cursor position, replacing
* the selected text (if any)
*/

Просмотреть файл

@ -22,8 +22,7 @@ class Element;
[ptr] native Element (mozilla::dom::Element);
[scriptable, uuid(393a364f-e8e2-48a1-a271-a0067b6bac9b)]
[scriptable, uuid(87ee993e-985f-4a43-a974-0d9512da2fb0)]
interface nsIHTMLEditor : nsISupports
{
%{C++
@ -551,11 +550,6 @@ interface nsIHTMLEditor : nsISupports
*/
attribute boolean returnInParagraphCreatesNewParagraph;
/**
* Checks whether a BR node is visible to the user.
*/
boolean breakIsVisible(in nsIDOMNode aNode);
/**
* Get an active editor's editing host in DOM window. If this editor isn't
* active in the DOM window, this returns NULL.

Просмотреть файл

@ -24,14 +24,14 @@ using mozilla::AutoSafeJSContext;
//*****************************************************************************
static mozilla::Maybe<JS::PersistentRooted<JSObject *> > autoconfigSb;
static JS::PersistentRooted<JSObject *> autoconfigSb;
nsresult CentralizedAdminPrefManagerInit()
{
nsresult rv;
// If the sandbox is already created, no need to create it again.
if (autoconfigSb)
if (autoconfigSb.initialized())
return NS_OK;
// Grab XPConnect.
@ -53,14 +53,14 @@ nsresult CentralizedAdminPrefManagerInit()
// Unwrap, store and root the sandbox.
NS_ENSURE_STATE(sandbox->GetJSObject());
autoconfigSb.emplace(cx, js::UncheckedUnwrap(sandbox->GetJSObject()));
autoconfigSb.init(cx, js::UncheckedUnwrap(sandbox->GetJSObject()));
return NS_OK;
}
nsresult CentralizedAdminPrefManagerFinish()
{
if (autoconfigSb) {
if (autoconfigSb.initialized()) {
AutoSafeJSContext cx;
autoconfigSb.reset();
JS_MaybeGC(cx);
@ -103,12 +103,12 @@ nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
}
AutoSafeJSContext cx;
JSAutoCompartment ac(cx, *autoconfigSb);
JSAutoCompartment ac(cx, autoconfigSb);
nsAutoCString script(js_buffer, length);
JS::RootedValue v(cx);
rv = xpc->EvalInSandboxObject(NS_ConvertASCIItoUTF16(script), filename, cx,
*autoconfigSb, &v);
autoconfigSb, &v);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

Просмотреть файл

@ -35,7 +35,6 @@
#include "gfxD2DSurface.h"
#include "gfxWindowsPlatform.h"
#include <d3d10_1.h>
#include "d3d10/ImageLayerD3D10.h"
#include "D3D9SurfaceImage.h"
#endif

Просмотреть файл

@ -403,5 +403,20 @@ CanvasClientSharedSurface::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
forwarder->UseTexture(this, mFrontTex);
}
void
CanvasClientSharedSurface::ClearSurfaces()
{
if (mFrontTex && (mFront || mPrevFront)) {
// Force a synchronous destruction so that the TextureHost does not
// outlive the SharedSurface. This won't be needed once TextureClient/Host
// and SharedSurface are merged.
mFrontTex->ForceRemove(true /* sync */);
mFrontTex = nullptr;
}
// It is important to destroy the SharedSurface *after* the TextureClient.
mFront = nullptr;
mPrevFront = nullptr;
}
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше