Merge m-c to fx-team. a=merge

This commit is contained in:
Ryan VanderMeulen 2014-09-03 16:42:41 -04:00
commit 85879c9cc5
744 changed files with 17612 additions and 15226 deletions

View File

@ -177,5 +177,5 @@ def js
end
def ft
call nsFrame::DumpFrameTree($arg0)
call $arg0->DumpFrameTree()
end

View File

@ -21,7 +21,10 @@ class TableAccessible;
class xpcAccessibleTable
{
public:
explicit xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
explicit xpcAccessibleTable(TableAccessible* aTable) :
mTable(aTable)
{
}
nsresult GetCaption(nsIAccessible** aCaption);
nsresult GetSummary(nsAString& aSummary);

View File

@ -25,8 +25,10 @@ class TableCellAccessible;
class xpcAccessibleTableCell
{
public:
explicit xpcAccessibleTableCell(mozilla::a11y::TableCellAccessible* aTableCell) :
mTableCell(aTableCell) { }
explicit xpcAccessibleTableCell(TableCellAccessible* aTableCell) :
mTableCell(aTableCell)
{
}
nsresult GetTable(nsIAccessibleTable** aTable);
nsresult GetColumnIndex(int32_t* aColIdx);

View File

@ -7,7 +7,6 @@ support-files =
invalid.json
[browser_sdk_loader_sdk_modules.js]
[browser_sdk_loader_sdk_gui_modules.js]
skip-if = e10s # Bug ?????? - test times out.
[browser_sdk_loader_jsm_modules.js]
[browser_sdk_loader_js_modules.js]
[browser_sdk_loader_json.js]

View File

@ -194,6 +194,24 @@ SettingsListener.observe('devtools.overlay', false, (value) => {
}
});
#ifdef MOZ_WIDGET_GONK
let LogShake;
SettingsListener.observe('devtools.logshake', false, (value) => {
if (value) {
if (!LogShake) {
let scope = {};
Cu.import('resource://gre/modules/LogShake.jsm', scope);
LogShake = scope.LogShake;
}
LogShake.init();
} else {
if (LogShake) {
LogShake.uninit();
}
}
});
#endif
// =================== Device Storage ====================
SettingsListener.observe('device.storage.writable.name', 'sdcard', function(value) {
if (Services.prefs.getPrefType('device.storage.writable.name') != Ci.nsIPrefBranch.PREF_STRING) {

View File

@ -0,0 +1,91 @@
/* 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/. */
/* jshint moz: true */
/* global Uint8Array, Components, dump */
'use strict';
this.EXPORTED_SYMBOLS = ['LogCapture'];
/**
* readLogFile
* Read in /dev/log/{{log}} in nonblocking mode, which will return -1 if
* reading would block the thread.
*
* @param log {String} The log from which to read. Must be present in /dev/log
* @return {Uint8Array} Raw log data
*/
let readLogFile = function(logLocation) {
if (!this.ctypes) {
// load in everything on first use
Components.utils.import('resource://gre/modules/ctypes.jsm', this);
this.lib = this.ctypes.open(this.ctypes.libraryName('c'));
this.read = this.lib.declare('read',
this.ctypes.default_abi,
this.ctypes.int, // bytes read (out)
this.ctypes.int, // file descriptor (in)
this.ctypes.voidptr_t, // buffer to read into (in)
this.ctypes.size_t // size_t size of buffer (in)
);
this.open = this.lib.declare('open',
this.ctypes.default_abi,
this.ctypes.int, // file descriptor (returned)
this.ctypes.char.ptr, // path
this.ctypes.int // flags
);
this.close = this.lib.declare('close',
this.ctypes.default_abi,
this.ctypes.int, // error code (returned)
this.ctypes.int // file descriptor
);
}
const O_READONLY = 0;
const O_NONBLOCK = 1 << 11;
const BUF_SIZE = 2048;
let BufType = this.ctypes.ArrayType(this.ctypes.char);
let buf = new BufType(BUF_SIZE);
let logArray = [];
let logFd = this.open(logLocation, O_READONLY | O_NONBLOCK);
if (logFd === -1) {
return null;
}
let readStart = Date.now();
let readCount = 0;
while (true) {
let count = this.read(logFd, buf, BUF_SIZE);
readCount += 1;
if (count <= 0) {
// log has return due to being nonblocking or running out of things
break;
}
for(let i = 0; i < count; i++) {
logArray.push(buf[i]);
}
}
let logTypedArray = new Uint8Array(logArray);
this.close(logFd);
return logTypedArray;
};
let cleanup = function() {
this.lib.close();
this.read = this.open = this.close = null;
this.lib = null;
this.ctypes = null;
};
this.LogCapture = { readLogFile: readLogFile, cleanup: cleanup };

View File

@ -0,0 +1,301 @@
/* jshint esnext: true */
/* global DataView */
"use strict";
this.EXPORTED_SYMBOLS = ["LogParser"];
/**
* Parse an array read from a /dev/log/ file. Format taken from
* kernel/drivers/staging/android/logger.h and system/core/logcat/logcat.cpp
*
* @param array {Uint8Array} Array read from /dev/log/ file
* @return {Array} List of log messages
*/
function parseLogArray(array) {
let data = new DataView(array.buffer);
let byteString = String.fromCharCode.apply(null, array);
let logMessages = [];
let pos = 0;
while (pos < byteString.length) {
// Parse a single log entry
// Track current offset from global position
let offset = 0;
// Length of the entry, discarded
let length = data.getUint32(pos + offset, true);
offset += 4;
// Id of the process which generated the message
let processId = data.getUint32(pos + offset, true);
offset += 4;
// Id of the thread which generated the message
let threadId = data.getUint32(pos + offset, true);
offset += 4;
// Seconds since epoch when this message was logged
let seconds = data.getUint32(pos + offset, true);
offset += 4;
// Nanoseconds since the last second
let nanoseconds = data.getUint32(pos + offset, true);
offset += 4;
// Priority in terms of the ANDROID_LOG_* constants (see below)
// This is where the length field begins counting
let priority = data.getUint8(pos + offset);
// Reset pos and offset to count from here
pos += offset;
offset = 0;
offset += 1;
// Read the tag and message, represented as null-terminated c-style strings
let tag = "";
while (byteString[pos + offset] != "\0") {
tag += byteString[pos + offset];
offset ++;
}
offset ++;
let message = "";
// The kernel log driver may have cut off the null byte (logprint.c)
while (byteString[pos + offset] != "\0" && offset < length) {
message += byteString[pos + offset];
offset ++;
}
// Un-skip the missing null terminator
if (offset === length) {
offset --;
}
offset ++;
pos += offset;
// Log messages are occasionally delimited by newlines, but are also
// sometimes followed by newlines as well
if (message.charAt(message.length - 1) === "\n") {
message = message.substring(0, message.length - 1);
}
// Add an aditional time property to mimic the milliseconds since UTC
// expected by Date
let time = seconds * 1000.0 + nanoseconds/1000000.0;
// Log messages with interleaved newlines are considered to be separate log
// messages by logcat
for (let lineMessage of message.split("\n")) {
logMessages.push({
processId: processId,
threadId: threadId,
seconds: seconds,
nanoseconds: nanoseconds,
time: time,
priority: priority,
tag: tag,
message: lineMessage + "\n"
});
}
}
return logMessages;
}
/**
* Get a thread-time style formatted string from time
* @param time {Number} Milliseconds since epoch
* @return {String} Formatted time string
*/
function getTimeString(time) {
let date = new Date(time);
function pad(number) {
if ( number < 10 ) {
return "0" + number;
}
return number;
}
return pad( date.getMonth() + 1 ) +
"-" + pad( date.getDate() ) +
" " + pad( date.getHours() ) +
":" + pad( date.getMinutes() ) +
":" + pad( date.getSeconds() ) +
"." + (date.getMilliseconds() / 1000).toFixed(3).slice(2, 5);
}
/**
* Pad a string using spaces on the left
* @param str {String} String to pad
* @param width {Number} Desired string length
*/
function padLeft(str, width) {
while (str.length < width) {
str = " " + str;
}
return str;
}
/**
* Pad a string using spaces on the right
* @param str {String} String to pad
* @param width {Number} Desired string length
*/
function padRight(str, width) {
while (str.length < width) {
str = str + " ";
}
return str;
}
/** Constant values taken from system/core/liblog */
const ANDROID_LOG_UNKNOWN = 0;
const ANDROID_LOG_DEFAULT = 1;
const ANDROID_LOG_VERBOSE = 2;
const ANDROID_LOG_DEBUG = 3;
const ANDROID_LOG_INFO = 4;
const ANDROID_LOG_WARN = 5;
const ANDROID_LOG_ERROR = 6;
const ANDROID_LOG_FATAL = 7;
const ANDROID_LOG_SILENT = 8;
/**
* Map a priority number to its abbreviated string equivalent
* @param priorityNumber {Number} Log-provided priority number
* @return {String} Priority number's abbreviation
*/
function getPriorityString(priorityNumber) {
switch (priorityNumber) {
case ANDROID_LOG_VERBOSE:
return "V";
case ANDROID_LOG_DEBUG:
return "D";
case ANDROID_LOG_INFO:
return "I";
case ANDROID_LOG_WARN:
return "W";
case ANDROID_LOG_ERROR:
return "E";
case ANDROID_LOG_FATAL:
return "F";
case ANDROID_LOG_SILENT:
return "S";
default:
return "?";
}
}
/**
* Mimic the logcat "threadtime" format, generating a formatted string from a
* log message object.
* @param logMessage {Object} A log message from the list returned by parseLogArray
* @return {String} threadtime formatted summary of the message
*/
function formatLogMessage(logMessage) {
// MM-DD HH:MM:SS.ms pid tid priority tag: message
// from system/core/liblog/logprint.c:
return getTimeString(logMessage.time) +
" " + padLeft(""+logMessage.processId, 5) +
" " + padLeft(""+logMessage.threadId, 5) +
" " + getPriorityString(logMessage.priority) +
" " + padRight(logMessage.tag, 8) +
": " + logMessage.message;
}
/**
* Pretty-print an array of bytes read from a log file by parsing then
* threadtime formatting its entries.
* @param array {Uint8Array} Array of a log file's bytes
* @return {String} Pretty-printed log
*/
function prettyPrintLogArray(array) {
let logMessages = parseLogArray(array);
return logMessages.map(formatLogMessage).join("");
}
/**
* Parse an array of bytes as a properties file. The structure of the
* properties file is derived from bionic/libc/bionic/system_properties.c
* @param array {Uint8Array} Array containing property data
* @return {Object} Map from property name to property value, both strings
*/
function parsePropertiesArray(array) {
let data = new DataView(array.buffer);
let byteString = String.fromCharCode.apply(null, array);
let properties = {};
let propIndex = 0;
let propCount = data.getUint32(0, true);
// first TOC entry is at 32
let tocOffset = 32;
const PROP_NAME_MAX = 32;
const PROP_VALUE_MAX = 92;
while (propIndex < propCount) {
// Retrieve offset from file start
let infoOffset = data.getUint32(tocOffset, true) & 0xffffff;
// Now read the name, integer serial, and value
let propName = "";
let nameOffset = infoOffset;
while (byteString[nameOffset] != "\0" &&
(nameOffset - infoOffset) < PROP_NAME_MAX) {
propName += byteString[nameOffset];
nameOffset ++;
}
infoOffset += PROP_NAME_MAX;
// Skip serial number
infoOffset += 4;
let propValue = "";
nameOffset = infoOffset;
while (byteString[nameOffset] != "\0" &&
(nameOffset - infoOffset) < PROP_VALUE_MAX) {
propValue += byteString[nameOffset];
nameOffset ++;
}
// Move to next table of contents entry
tocOffset += 4;
properties[propName] = propValue;
propIndex += 1;
}
return properties;
}
/**
* Pretty-print an array read from the /dev/__properties__ file.
* @param array {Uint8Array} File data array
* @return {String} Human-readable string of property name: property value
*/
function prettyPrintPropertiesArray(array) {
let properties = parsePropertiesArray(array);
let propertiesString = "";
for(let propName in properties) {
propertiesString += propName + ": " + properties[propName] + "\n";
}
return propertiesString;
}
/**
* Pretty-print a normal array. Does nothing.
* @param array {Uint8Array} Input array
*/
function prettyPrintArray(array) {
return array;
}
this.LogParser = {
parseLogArray: parseLogArray,
parsePropertiesArray: parsePropertiesArray,
prettyPrintArray: prettyPrintArray,
prettyPrintLogArray: prettyPrintLogArray,
prettyPrintPropertiesArray: prettyPrintPropertiesArray
};

301
b2g/components/LogShake.jsm Normal file
View File

@ -0,0 +1,301 @@
/* 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/. */
/**
* LogShake is a module which listens for log requests sent by Gaia. In
* response to a sufficiently large acceleration (a shake), it will save log
* files to an arbitrary directory which it will then return on a
* 'capture-logs-success' event with detail.logFilenames representing each log
* file's filename in the directory. If an error occurs it will instead produce
* a 'capture-logs-error' event.
*/
/* enable Mozilla javascript extensions and global strictness declaration,
* disable valid this checking */
/* jshint moz: true */
/* jshint -W097 */
/* jshint -W040 */
/* global Services, Components, dump, LogCapture, LogParser,
OS, Promise, volumeService, XPCOMUtils, SystemAppProxy */
'use strict';
const Cu = Components.utils;
const Ci = Components.interfaces;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'LogCapture', 'resource://gre/modules/LogCapture.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'LogParser', 'resource://gre/modules/LogParser.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'OS', 'resource://gre/modules/osfile.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Promise', 'resource://gre/modules/Promise.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Services', 'resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'SystemAppProxy', 'resource://gre/modules/SystemAppProxy.jsm');
XPCOMUtils.defineLazyServiceGetter(this, 'powerManagerService',
'@mozilla.org/power/powermanagerservice;1',
'nsIPowerManagerService');
XPCOMUtils.defineLazyServiceGetter(this, 'volumeService',
'@mozilla.org/telephony/volume-service;1',
'nsIVolumeService');
this.EXPORTED_SYMBOLS = ['LogShake'];
function debug(msg) {
dump('LogShake.jsm: '+msg+'\n');
}
/**
* An empirically determined amount of acceleration corresponding to a
* shake
*/
const EXCITEMENT_THRESHOLD = 500;
const DEVICE_MOTION_EVENT = 'devicemotion';
const SCREEN_CHANGE_EVENT = 'screenchange';
const CAPTURE_LOGS_ERROR_EVENT = 'capture-logs-error';
const CAPTURE_LOGS_SUCCESS_EVENT = 'capture-logs-success';
// Map of files which have log-type information to their parsers
const LOGS_WITH_PARSERS = {
'/dev/__properties__': LogParser.prettyPrintPropertiesArray,
'/dev/log/main': LogParser.prettyPrintLogArray,
'/dev/log/system': LogParser.prettyPrintLogArray,
'/dev/log/radio': LogParser.prettyPrintLogArray,
'/dev/log/events': LogParser.prettyPrintLogArray,
'/proc/cmdline': LogParser.prettyPrintArray,
'/proc/kmsg': LogParser.prettyPrintArray,
'/proc/meminfo': LogParser.prettyPrintArray,
'/proc/uptime': LogParser.prettyPrintArray,
'/proc/version': LogParser.prettyPrintArray,
'/proc/vmallocinfo': LogParser.prettyPrintArray,
'/proc/vmstat': LogParser.prettyPrintArray
};
let LogShake = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
/**
* If LogShake is listening for device motion events. Required due to lag
* between HAL layer of device motion events and listening for device motion
* events.
*/
deviceMotionEnabled: false,
/**
* If a capture has been requested and is waiting for reads/parsing. Used for
* debouncing.
*/
captureRequested: false,
/**
* Start existing, observing motion events if the screen is turned on.
*/
init: function() {
// TODO: no way of querying screen state from power manager
// this.handleScreenChangeEvent({ detail: {
// screenEnabled: powerManagerService.screenEnabled
// }});
// However, the screen is always on when we are being enabled because it is
// either due to the phone starting up or a user enabling us directly.
this.handleScreenChangeEvent({ detail: {
screenEnabled: true
}});
SystemAppProxy.addEventListener(SCREEN_CHANGE_EVENT, this, false);
Services.obs.addObserver(this, 'xpcom-shutdown', false);
},
/**
* Handle an arbitrary event, passing it along to the proper function
*/
handleEvent: function(event) {
switch (event.type) {
case DEVICE_MOTION_EVENT:
if (!this.deviceMotionEnabled) {
return;
}
this.handleDeviceMotionEvent(event);
break;
case SCREEN_CHANGE_EVENT:
this.handleScreenChangeEvent(event);
break;
}
},
/**
* Handle an observation from Services.obs
*/
observe: function(subject, topic) {
if (topic === 'xpcom-shutdown') {
this.uninit();
}
},
startDeviceMotionListener: function() {
if (!this.deviceMotionEnabled) {
SystemAppProxy.addEventListener(DEVICE_MOTION_EVENT, this, false);
this.deviceMotionEnabled = true;
}
},
stopDeviceMotionListener: function() {
SystemAppProxy.removeEventListener(DEVICE_MOTION_EVENT, this, false);
this.deviceMotionEnabled = false;
},
/**
* Handle a motion event, keeping track of 'excitement', the magnitude
* of the device's acceleration.
*/
handleDeviceMotionEvent: function(event) {
// There is a lag between disabling the event listener and event arrival
// ceasing.
if (!this.deviceMotionEnabled) {
return;
}
var acc = event.accelerationIncludingGravity;
var excitement = acc.x * acc.x + acc.y * acc.y + acc.z * acc.z;
if (excitement > EXCITEMENT_THRESHOLD) {
if (!this.captureRequested) {
this.captureRequested = true;
captureLogs().then(logResults => {
// On resolution send the success event to the requester
SystemAppProxy._sendCustomEvent(CAPTURE_LOGS_SUCCESS_EVENT, {
logFilenames: logResults.logFilenames,
logPrefix: logResults.logPrefix
});
this.captureRequested = false;
},
error => {
// On an error send the error event
SystemAppProxy._sendCustomEvent(CAPTURE_LOGS_ERROR_EVENT, {error: error});
this.captureRequested = false;
});
}
}
},
handleScreenChangeEvent: function(event) {
if (event.detail.screenEnabled) {
this.startDeviceMotionListener();
} else {
this.stopDeviceMotionListener();
}
},
/**
* Stop logshake, removing all listeners
*/
uninit: function() {
this.stopDeviceMotionListener();
SystemAppProxy.removeEventListener(SCREEN_CHANGE_EVENT, this, false);
Services.obs.removeObserver(this, 'xpcom-shutdown');
}
};
function getLogFilename(logLocation) {
// sanitize the log location
let logName = logLocation.replace(/\//g, '-');
if (logName[0] === '-') {
logName = logName.substring(1);
}
return logName + '.log';
}
function getSdcardPrefix() {
return volumeService.getVolumeByName('sdcard').mountPoint;
}
function getLogDirectory() {
let d = new Date();
d = new Date(d.getTime() - d.getTimezoneOffset() * 60000);
let timestamp = d.toISOString().slice(0, -5).replace(/[:T]/g, '-');
// return directory name of format 'logs/timestamp/'
return OS.Path.join('logs', timestamp, '');
}
/**
* Captures and saves the current device logs, returning a promise that will
* resolve to an array of log filenames.
*/
function captureLogs() {
let logArrays = readLogs();
return saveLogs(logArrays);
}
/**
* Read in all log files, returning their formatted contents
*/
function readLogs() {
let logArrays = {};
for (let loc in LOGS_WITH_PARSERS) {
let logArray = LogCapture.readLogFile(loc);
if (!logArray) {
continue;
}
let prettyLogArray = LOGS_WITH_PARSERS[loc](logArray);
logArrays[loc] = prettyLogArray;
}
return logArrays;
}
/**
* Save the formatted arrays of log files to an sdcard if available
*/
function saveLogs(logArrays) {
if (!logArrays || Object.keys(logArrays).length === 0) {
return Promise.resolve({
logFilenames: [],
logPrefix: ''
});
}
let sdcardPrefix, dirName;
try {
sdcardPrefix = getSdcardPrefix();
dirName = getLogDirectory();
} catch(e) {
// Return promise failed with exception e
// Handles missing sdcard
return Promise.reject(e);
}
debug('making a directory all the way from '+sdcardPrefix+' to '+(sdcardPrefix + '/' + dirName));
return OS.File.makeDir(OS.Path.join(sdcardPrefix, dirName), {from: sdcardPrefix})
.then(function() {
// Now the directory is guaranteed to exist, save the logs
let logFilenames = [];
let saveRequests = [];
for (let logLocation in logArrays) {
debug('requesting save of ' + logLocation);
let logArray = logArrays[logLocation];
// The filename represents the relative path within the SD card, not the
// absolute path because Gaia will refer to it using the DeviceStorage
// API
let filename = dirName + getLogFilename(logLocation);
logFilenames.push(filename);
let saveRequest = OS.File.writeAtomic(OS.Path.join(sdcardPrefix, filename), logArray);
saveRequests.push(saveRequest);
}
return Promise.all(saveRequests).then(function() {
debug('returning logfilenames: '+logFilenames.toSource());
return {
logFilenames: logFilenames,
logPrefix: dirName
};
});
});
}
LogShake.init();
this.LogShake = LogShake;

View File

@ -52,6 +52,9 @@ EXTRA_JS_MODULES += [
'ContentRequestHelper.jsm',
'ErrorPage.jsm',
'FxAccountsMgmtService.jsm',
'LogCapture.jsm',
'LogParser.jsm',
'LogShake.jsm',
'SignInToWebsite.jsm',
'SystemAppProxy.jsm',
'TelURIParser.jsm',

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that LogCapture successfully reads from the /dev/log devices, returning
* a Uint8Array of some length, including zero. This tests a few standard
* log devices
*/
function run_test() {
Components.utils.import('resource:///modules/LogCapture.jsm');
function verifyLog(log) {
// log exists
notEqual(log, null);
// log has a length and it is non-negative (is probably array-like)
ok(log.length >= 0);
}
let mainLog = LogCapture.readLogFile('/dev/log/main');
verifyLog(mainLog);
let meminfoLog = LogCapture.readLogFile('/proc/meminfo');
verifyLog(meminfoLog);
}

View File

@ -0,0 +1,49 @@
/* jshint moz: true */
const {utils: Cu, classes: Cc, interfaces: Ci} = Components;
function run_test() {
Cu.import('resource:///modules/LogParser.jsm');
let propertiesFile = do_get_file('data/test_properties');
let loggerFile = do_get_file('data/test_logger_file');
let propertiesStream = makeStream(propertiesFile);
let loggerStream = makeStream(loggerFile);
// Initialize arrays to hold the file contents (lengths are hardcoded)
let propertiesArray = new Uint8Array(propertiesStream.readByteArray(65536));
let loggerArray = new Uint8Array(loggerStream.readByteArray(4037));
propertiesStream.close();
loggerStream.close();
let properties = LogParser.parsePropertiesArray(propertiesArray);
let logMessages = LogParser.parseLogArray(loggerArray);
// Test arbitrary property entries for correctness
equal(properties['ro.boot.console'], 'ttyHSL0');
equal(properties['net.tcp.buffersize.lte'],
'524288,1048576,2097152,262144,524288,1048576');
ok(logMessages.length === 58, 'There should be 58 messages in the log');
let expectedLogEntry = {
processId: 271, threadId: 271,
seconds: 790796, nanoseconds: 620000001, time: 790796620.000001,
priority: 4, tag: 'Vold',
message: 'Vold 2.1 (the revenge) firing up\n'
};
deepEqual(expectedLogEntry, logMessages[0]);
}
function makeStream(file) {
var fileStream = Cc['@mozilla.org/network/file-input-stream;1']
.createInstance(Ci.nsIFileInputStream);
fileStream.init(file, -1, -1, 0);
var bis = Cc['@mozilla.org/binaryinputstream;1']
.createInstance(Ci.nsIBinaryInputStream);
bis.setInputStream(fileStream);
return bis;
}

View File

@ -0,0 +1,141 @@
/**
* Test the log capturing capabilities of LogShake.jsm
*/
/* jshint moz: true */
/* global Components, LogCapture, LogShake, ok, add_test, run_next_test, dump */
/* exported run_test */
/* disable use strict warning */
/* jshint -W097 */
'use strict';
const Cu = Components.utils;
Cu.import('resource://gre/modules/LogCapture.jsm');
Cu.import('resource://gre/modules/LogShake.jsm');
// Force logshake to handle a device motion event with given components
// Does not use SystemAppProxy because event needs special
// accelerationIncludingGravity property
function sendDeviceMotionEvent(x, y, z) {
let event = {
type: 'devicemotion',
accelerationIncludingGravity: {
x: x,
y: y,
z: z
}
};
LogShake.handleEvent(event);
}
// Send a screen change event directly, does not use SystemAppProxy due to race
// conditions.
function sendScreenChangeEvent(screenEnabled) {
let event = {
type: 'screenchange',
detail: {
screenEnabled: screenEnabled
}
};
LogShake.handleEvent(event);
}
function debug(msg) {
var timestamp = Date.now();
dump('LogShake: ' + timestamp + ': ' + msg);
}
add_test(function test_do_log_capture_after_shaking() {
// Enable LogShake
LogShake.init();
let readLocations = [];
LogCapture.readLogFile = function(loc) {
readLocations.push(loc);
return null; // we don't want to provide invalid data to a parser
};
// Fire a devicemotion event that is of shake magnitude
sendDeviceMotionEvent(9001, 9001, 9001);
ok(readLocations.length > 0,
'LogShake should attempt to read at least one log');
LogShake.uninit();
run_next_test();
});
add_test(function test_do_nothing_when_resting() {
// Enable LogShake
LogShake.init();
let readLocations = [];
LogCapture.readLogFile = function(loc) {
readLocations.push(loc);
return null; // we don't want to provide invalid data to a parser
};
// Fire a devicemotion event that is relatively tiny
sendDeviceMotionEvent(0, 9.8, 9.8);
ok(readLocations.length === 0,
'LogShake should not read any logs');
debug('test_do_nothing_when_resting: stop');
LogShake.uninit();
run_next_test();
});
add_test(function test_do_nothing_when_disabled() {
debug('test_do_nothing_when_disabled: start');
// Disable LogShake
LogShake.uninit();
let readLocations = [];
LogCapture.readLogFile = function(loc) {
readLocations.push(loc);
return null; // we don't want to provide invalid data to a parser
};
// Fire a devicemotion event that would normally be a shake
sendDeviceMotionEvent(0, 9001, 9001);
ok(readLocations.length === 0,
'LogShake should not read any logs');
run_next_test();
});
add_test(function test_do_nothing_when_screen_off() {
// Enable LogShake
LogShake.init();
// Send an event as if the screen has been turned off
sendScreenChangeEvent(false);
let readLocations = [];
LogCapture.readLogFile = function(loc) {
readLocations.push(loc);
return null; // we don't want to provide invalid data to a parser
};
// Fire a devicemotion event that would normally be a shake
sendDeviceMotionEvent(0, 9001, 9001);
ok(readLocations.length === 0,
'LogShake should not read any logs');
// Restore the screen
sendScreenChangeEvent(true);
LogShake.uninit();
run_next_test();
});
function run_test() {
debug('Starting');
run_next_test();
}

View File

@ -2,6 +2,10 @@
head =
tail =
support-files =
data/test_logger_file
data/test_properties
[test_bug793310.js]
[test_bug832946.js]
@ -11,4 +15,10 @@ tail =
head = head_identity.js
tail =
[test_logcapture.js]
# only run on b2g builds due to requiring b2g-specific log files to exist
skip-if = toolkit != "gonk"
[test_logparser.js]
[test_logshake.js]

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="4b4336c73c081b39776d399835ce4853aee5cc1c">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
@ -127,7 +127,7 @@
<!-- Stock Android things -->
<project name="platform/external/icu4c" path="external/icu4c" revision="2bb01561780583cc37bc667f0ea79f48a122d8a2"/>
<!-- dolphin specific things -->
<project name="device/sprd" path="device/sprd" revision="4eac1e31bf69596bf229a6877c9aa3493ecd9fce"/>
<project name="device/sprd" path="device/sprd" revision="3ba0b8b4e3f55d68f84603218e522d054a723532"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="4e58336019b5cbcfd134caf55b142236cf986618"/>
<project name="platform/frameworks/av" path="frameworks/av" revision="facca8d3e35431b66f85a4eb42bc6c5b24bd04da"/>
<project name="platform/hardware/akm" path="hardware/akm" revision="6d3be412647b0eab0adff8a2768736cf4eb68039"/>

View File

@ -19,13 +19,13 @@
<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="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="4b4336c73c081b39776d399835ce4853aee5cc1c">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -19,13 +19,13 @@
<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="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="4b4336c73c081b39776d399835ce4853aee5cc1c">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "a0fe2fdc571f1a5eb5474e08773fac80f9bb9fbd",
"revision": "dc9488c3826ae1dbd0051ac19c83c5da1f4915a7",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,12 +17,12 @@
<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="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

View File

@ -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="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -17,12 +17,12 @@
<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="52670853c17fc0d3d33065c667c0ce124c93b98f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af04d8bc2111d4ea146239a89ff602206b85eaf5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2aa3a0d353812bb8732a122965ffdbf5f889ca12"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -293,6 +293,7 @@
@BINPATH@/components/spellchecker.xpt
@BINPATH@/components/storage.xpt
@BINPATH@/components/telemetry.xpt
@BINPATH@/components/toolkit_filewatcher.xpt
@BINPATH@/components/toolkit_finalizationwitness.xpt
@BINPATH@/components/toolkit_formautofill.xpt
@BINPATH@/components/toolkit_osfile.xpt
@ -441,6 +442,8 @@
@BINPATH@/components/RILContentHelper.js
@BINPATH@/components/TelephonyService.js
@BINPATH@/components/TelephonyService.manifest
@BINPATH@/components/MobileConnectionGonkService.js
@BINPATH@/components/MobileConnectionGonkService.manifest
#endif // MOZ_WIDGET_GONK && MOZ_B2G_RIL
#ifndef MOZ_WIDGET_GONK

View File

@ -1,5 +1,5 @@
[DEFAULT]
skip-if = buildapp == 'mulet'
skip-if = buildapp == 'mulet' || e10s
support-files =
head.js
chat.html

View File

@ -102,6 +102,7 @@ skip-if = os == "linux" # Bug 924307
skip-if = e10s # Bug ?????? - no about:home support yet
[browser_aboutSyncProgress.js]
[browser_addKeywordSearch.js]
skip-if = e10s
[browser_alltabslistener.js]
skip-if = os == "linux" || e10s # Linux: Intermittent failures, bug 951680; e10s: Bug ?????? - notifications don't work correctly.
[browser_backButtonFitts.js]
@ -110,10 +111,13 @@ skip-if = os != "win" || e10s # The Fitts Law back button is only supported on W
[browser_bookmark_titles.js]
skip-if = buildapp == 'mulet' || toolkit == "windows" || e10s # Disabled on Windows due to frequent failures (bugs 825739, 841341) / e10s - Bug ?????? test checks event.target on load event, which our e10s utils don't support
[browser_bug304198.js]
skip-if = e10s
[browser_bug321000.js]
skip-if = true # browser_bug321000.js is disabled because newline handling is shaky (bug 592528)
[browser_bug329212.js]
skip-if = e10s
[browser_bug331772_xul_tooltiptext_in_html.js]
skip-if = e10s
[browser_bug356571.js]
[browser_bug380960.js]
[browser_bug386835.js]
@ -121,8 +125,8 @@ skip-if = e10s # Bug 691614 - no e10s zoom support yet
[browser_bug405137.js]
[browser_bug406216.js]
[browser_bug409481.js]
skip-if = e10s # Bug 921952 - Content:Click event issues (test simulated middle-click on a link and checks the value pastes - it doesn't)
[browser_bug409624.js]
skip-if = e10s
[browser_bug413915.js]
[browser_bug416661.js]
skip-if = e10s # Bug 691614 - no e10s zoom support yet
@ -146,6 +150,7 @@ skip-if = buildapp == 'mulet' || e10s # Bug ?????? - test directly manipulates c
[browser_bug441778.js]
skip-if = buildapp == 'mulet' || e10s # Bug 691614 - no e10s zoom support yet
[browser_bug455852.js]
skip-if = e10s
[browser_bug460146.js]
skip-if = e10s # Bug 866413 - PageInfo doesn't work in e10s
[browser_bug462289.js]
@ -159,6 +164,7 @@ skip-if = buildapp == 'mulet' || e10s # Bug 918663 - DOMLinkAdded events don't m
[browser_bug481560.js]
skip-if = e10s # Bug ????? - This bug attached an event listener directly to the content
[browser_bug484315.js]
skip-if = e10s
[browser_bug491431.js]
skip-if = buildapp == 'mulet' || e10s # Bug 918634 - swapFrameLoaders (and thus replaceTabWithWindow) not implemented for e10s
[browser_bug495058.js]
@ -188,15 +194,18 @@ skip-if = e10s # Bug 932651 - getClipboardData in specialpowersAPI.js not e10s f
[browser_bug559991.js]
skip-if = e10s # Bug 691614 - no e10s zoom support yet
[browser_bug561623.js]
skip-if = e10s
[browser_bug561636.js]
skip-if = e10s # Bug 691601 - no form submit observers
[browser_bug562649.js]
skip-if = e10s # Bug 940195 - XULBrowserWindow.isBusy is false as a remote tab starts loading
[browser_bug563588.js]
[browser_bug565575.js]
skip-if = e10s
[browser_bug565667.js]
run-if = toolkit == "cocoa"
[browser_bug567306.js]
skip-if = e10s
[browser_bug575561.js]
[browser_bug575830.js]
skip-if = e10s # Bug 691614 - no e10s zoom support yet
@ -212,6 +221,7 @@ skip-if = e10s # Bug 930863 - pageshow issues ("TypeError: charset is undefined"
[browser_bug581253.js]
skip-if = e10s # Bug 930863 - pageshow issues ("TypeError: charset is undefined" in pageshow listener, as document is null)
[browser_bug581947.js]
skip-if = e10s
[browser_bug585558.js]
[browser_bug585785.js]
[browser_bug585830.js]
@ -235,6 +245,7 @@ skip-if = e10s # Bug ?????? - test directly manipulates content (eg, var expertD
[browser_bug647886.js]
skip-if = buildapp == 'mulet' || e10s # Bug 916974 - Session history doesn't work in e10s
[browser_bug655584.js]
skip-if = e10s
[browser_bug664672.js]
[browser_bug676619.js]
skip-if = buildapp == 'mulet' || os == "mac" || e10s # mac: Intermittent failures, bug 925225; e10s: Bug ?????? - test directly manipulates content (event.target.location)
@ -251,6 +262,7 @@ skip-if = e10s # Bug ?????? - test directly manipulates content
[browser_bug749738.js]
skip-if = e10s # Bug 921935 - focusmanager issues with e10s
[browser_bug763468_perwindowpb.js]
skip-if = e10s
[browser_bug767836_perwindowpb.js]
skip-if = e10s # Bug ?????? - test reports a leaked nsGlobalWindow with e10s enabled.
[browser_bug771331.js]
@ -266,6 +278,7 @@ skip-if = e10s # Bug 916974 - Session history doesn't work in e10s
[browser_bug880101.js]
[browser_bug882977.js]
[browser_bug902156.js]
skip-if = e10s
[browser_bug906190.js]
skip-if = buildapp == "mulet" || e10s # Bug ?????? - test directly manipulates content (strange - gets an element from a child which it tries to treat as a string, but that fails)
[browser_bug970746.js]
@ -275,11 +288,13 @@ skip-if = os == 'win' || e10s # Bug 1056146 - FullZoomHelper uses promiseTabLoad
[browser_canonizeURL.js]
skip-if = e10s # Bug ?????? - [JavaScript Error: "Error in AboutHome.sendAboutHomeData TypeError: target.messageManager is undefined" {file: "resource:///modules/AboutHome.jsm" line: 208}]
[browser_contentAreaClick.js]
skip-if = e10s
[browser_contextSearchTabPosition.js]
skip-if = os == "mac" # bug 967013, bug 926729
skip-if = os == "mac" || e10s # bug 967013, bug 926729
[browser_ctrlTab.js]
skip-if = e10s # Bug ????? - thumbnail captures need e10s love (tabPreviews_capture fails with Argument 1 of CanvasRenderingContext2D.drawWindow does not implement interface Window.)
[browser_customize_popupNotification.js]
skip-if = e10s
[browser_datareporting_notification.js]
run-if = datareporting
[browser_devices_get_user_media.js]
@ -292,11 +307,13 @@ skip-if = e10s # Bug 918663 - DOMLinkAdded events don't make their way to chrome
[browser_drag.js]
skip-if = true # browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
[browser_favicon_change.js]
skip-if = e10s
[browser_findbarClose.js]
skip-if = e10s # Bug ?????? - test directly manipulates content (tries to grab an iframe directly from content)
[browser_fullscreen-window-open.js]
skip-if = buildapp == 'mulet' || e10s || os == "linux" # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions not e10s friendly. Linux: Intermittent failures - bug 941575.
[browser_fxa_oauth.js]
skip-if = e10s
[browser_gestureSupport.js]
skip-if = e10s # Bug 863514 - no gesture support.
[browser_getshortcutoruri.js]
@ -316,6 +333,7 @@ skip-if = toolkit == "windows" # Disabled on Windows due to frequent failures (b
[browser_locationBarCommand.js]
skip-if = os == "linux" || e10s # Linux: Intermittent failures, bug 917535; e10s: Bug ?????? - Focus issues (There should be no focused element - Got [object XULElement], expected null)
[browser_locationBarExternalLoad.js]
skip-if = e10s
[browser_menuButtonFitts.js]
skip-if = os != "win" || e10s # The Fitts Law menu button is only supported on Windows (bug 969376); # Bug ?????? - URL bar issues ("There should be no focused element - Got [object XULElement], expected null")
[browser_middleMouse_noJSPaste.js]
@ -335,6 +353,7 @@ skip-if = buildapp == 'mulet' || e10s # Bug 866413 - PageInfo doesn't work in e1
skip-if = e10s # Bug ?????? - test directly manipulates content
[browser_parsable_css.js]
skip-if = e10s
[browser_parsable_script.js]
skip-if = debug || asan # Times out on debug/asan, and we are less picky about our JS there
@ -352,6 +371,7 @@ skip-if = buildapp == 'mulet'
[browser_relatedTabs.js]
[browser_removeTabsToTheEnd.js]
[browser_removeUnsafeProtocolsFromURLBarPaste.js]
skip-if = e10s
[browser_sanitize-download-history.js]
skip-if = true # bug 432425
[browser_sanitize-passwordDisabledHosts.js]
@ -372,6 +392,7 @@ skip-if = buildapp == 'mulet' || e10s # e10s: Bug 933103 - mochitest's EventUtil
skip-if = buildapp == 'mulet' || e10s # Bug ?????? - test directly manipulates content (event.target)
[browser_scope.js]
[browser_searchSuggestionUI.js]
skip-if = e10s
support-files =
searchSuggestionUI.html
searchSuggestionUI.js
@ -381,7 +402,7 @@ skip-if = e10s # Bug ?????? - no idea! "Accel+9 selects expected tab - Got 0, ex
skip-if = e10s # Bug ?????? - timeout after logging "Error: Channel closing: too late to send/recv, messages will be lost"
[browser_subframe_favicons_not_used.js]
[browser_tabDrop.js]
skip-if = buildapp == 'mulet'
skip-if = buildapp == 'mulet' || e10s
[browser_tabMatchesInAwesomebar_perwindowpb.js]
skip-if = e10s # Bug 918634 - swapFrameLoaders not implemented for e10s (test uses gBrowser.swapBrowsersAndCloseOther)
[browser_tab_drag_drop_perwindow.js]
@ -389,19 +410,21 @@ skip-if = buildapp == 'mulet'
[browser_tab_dragdrop.js]
skip-if = buildapp == 'mulet' || e10s # Bug 918634 - swapFrameLoaders not implemented for e10s (test uses gBrowser.swapBrowsersAndCloseOther)
[browser_tab_dragdrop2.js]
skip-if = buildapp == 'mulet'
skip-if = buildapp == 'mulet' || e10s
[browser_tabbar_big_widgets.js]
skip-if = os == "linux" || os == "mac" # No tabs in titlebar on linux
# Disabled on OS X because of bug 967917
[browser_tabfocus.js]
skip-if = e10s # Bug 921935 - focusmanager issues with e10s (test calls getFocusedElementForWindow with a content window)
[browser_tabkeynavigation.js]
skip-if = e10s
[browser_tabopen_reflows.js]
skip-if = e10s # Bug ?????? - test needs to be updated for e10s (captures a stack that isn't correct in e10s)
[browser_tabs_isActive.js]
skip-if = e10s # Bug ?????? - test directly manipulates content (tries to get/set attributes directly on content docshell)
[browser_tabs_owner.js]
[browser_trackingUI.js]
skip-if = e10s
support-files =
trackingPage.html
benignPage.html
@ -410,7 +433,9 @@ skip-if = buildapp == 'mulet' || e10s # Bug 921935 - focusmanager issues with e1
[browser_unloaddialogs.js]
skip-if = e10s # Bug ?????? - test uses chrome windowMediator to try and see alert() from content
[browser_urlHighlight.js]
skip-if = e10s
[browser_urlbarAutoFillTrimURLs.js]
skip-if = e10s
[browser_urlbarCopying.js]
skip-if = e10s # Bug 932651 - getClipboardData in specialpowersAPI.js not e10s friendly
[browser_urlbarEnter.js]
@ -418,9 +443,11 @@ skip-if = e10s # Bug ?????? - obscure non-windows child process crashes on try
[browser_urlbarRevert.js]
skip-if = e10s # Bug ?????? - ESC reverted the location bar value - Got foobar, expected example.com
[browser_urlbarSearchSingleWordNotification.js]
skip-if = e10s
[browser_urlbarStop.js]
skip-if = e10s # Bug ????? - test calls gBrowser.contentWindow.stop
[browser_urlbarTrimURLs.js]
skip-if = e10s
[browser_urlbar_search_healthreport.js]
skip-if = e10s # Bug ?????? - FHR tests failing (either with "no data for today" or "2 records for today")
[browser_utilityOverlay.js]
@ -446,8 +473,11 @@ skip-if = e10s # Bug 940206 - nsIWebContentHandlerRegistrar::registerProtocolHan
[browser_no_mcb_on_http_site.js]
skip-if = e10s # Bug 516755 - SessionStore disabled for e10s
[browser_bug1003461-switchtab-override.js]
skip-if = e10s
[browser_bug1024133-switchtab-override-keynav.js]
skip-if = e10s
[browser_bug1025195_switchToTabHavingURI_ignoreFragment.js]
[browser_addCertException.js]
skip-if = e10s # Bug ?????? - test directly manipulates content (content.document.getElementById)
[browser_bug1045809.js]
skip-if = e10s

View File

@ -1,5 +1,5 @@
[DEFAULT]
skip-if = buildapp == "mulet"
skip-if = buildapp == "mulet" || e10s
support-files =
head.js
support/test_967000_charEncoding_page.html

View File

@ -2,7 +2,7 @@
support-files = head.js
[browser_basic_functionality.js]
skip-if = buildapp == "mulet"
skip-if = buildapp == "mulet" || e10s
[browser_first_download_panel.js]
skip-if = os == "linux" # Bug 949434
[browser_overflow_anchor.js]

View File

@ -6,7 +6,7 @@ support-files =
[browser_CardDavImporter.js]
[browser_fxa_login.js]
skip-if = !debug
skip-if = !debug || e10s
[browser_loop_fxa_server.js]
[browser_LoopContacts.js]
[browser_mozLoop_appVersionInfo.js]

View File

@ -15,6 +15,7 @@ support-files =
[browser_library_left_pane_fixnames.js]
[browser_425884.js]
[browser_475045.js]
skip-if = e10s
[browser_423515.js]
[browser_410196_paste_into_tags.js]
skip-if = e10s # Bug ?????? - clipboard operations don't seem to work in this test?
@ -24,6 +25,7 @@ skip-if = e10s # Bug ?????? - clipboard operations don't seem to work in this te
[browser_library_search.js]
[browser_history_sidebar_search.js]
[browser_bookmarksProperties.js]
skip-if = e10s
[browser_forgetthissite_single.js]
# disabled for very frequent oranges - bug 551540
@ -46,10 +48,13 @@ skip-if = e10s # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions n
[browser_toolbar_migration.js]
[browser_library_batch_delete.js]
[browser_555547.js]
skip-if = e10s
[browser_416459_cut.js]
skip-if = e10s # Bug ?????? - clipboard operations don't seem to work in this test?
[browser_library_downloads.js]
[browser_library_left_pane_select_hierarchy.js]
[browser_435851_copy_query.js]
skip-if = e10s
[browser_toolbarbutton_menu_context.js]
skip-if = e10s
[browser_library_openFlatContainer.js]

View File

@ -62,8 +62,8 @@ var gAdvancedPane = {
gAdvancedPane.clearOfflineAppCache);
setEventListener("offlineNotifyExceptions", "command",
gAdvancedPane.showOfflineExceptions);
setEventListener("offlineNotifyExceptions", "command", function (event) {
gAdvancedPane.offlineAppSelected(event); })
setEventListener("offlineAppsList", "select",
gAdvancedPane.offlineAppSelected);
let bundlePrefs = document.getElementById("bundlePreferences");
document.getElementById("offlineAppsList")
.style.height = bundlePrefs.getString("offlineAppsList.height");
@ -72,9 +72,9 @@ var gAdvancedPane = {
#ifdef MOZ_UPDATER
setEventListener("updateRadioGroup", "command",
gAdvancedPane.updateWritePrefs);
#endif
setEventListener("showUpdateHistory", "command",
gAdvancedPane.showUpdates);
#endif
setEventListener("viewCertificatesButton", "command",
gAdvancedPane.showCertificates);
setEventListener("viewSecurityDevicesButton", "command",

View File

@ -1,5 +1,5 @@
[DEFAULT]
skip-if = buildapp == "mulet"
skip-if = buildapp == "mulet" || e10s
support-files =
head.js
privacypane_tests_perwindow.js
@ -17,5 +17,7 @@ skip-if = !healthreport || (os == 'linux' && debug)
[browser_privacypane_1.js]
[browser_privacypane_3.js]
[browser_privacypane_4.js]
skip-if = e10s # leaks windows
[browser_privacypane_5.js]
skip-if = e10s # leaks windows
[browser_privacypane_8.js]

View File

@ -1,5 +1,5 @@
[DEFAULT]
skip-if = buildapp == "mulet"
skip-if = buildapp == "mulet" || e10s
support-files =
browser_privatebrowsing_concurrent_page.html
browser_privatebrowsing_cookieacceptdialog.html
@ -17,19 +17,14 @@ support-files =
[browser_privatebrowsing_DownloadLastDirWithCPS.js]
[browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js]
skip-if = e10s # Bug ?????? - test directly manipulates content (win.getComputedStyle(win.gBrowser.contentDocument.getElementById("restorePreviousSession")))
[browser_privatebrowsing_aboutSessionRestore.js]
skip-if = e10s # Bug ?????? - "leaked until shutdown [nsGlobalWindow...]"
[browser_privatebrowsing_cache.js]
[browser_privatebrowsing_certexceptionsui.js]
[browser_privatebrowsing_concurrent.js]
skip-if = e10s # Bug ?????? - test directly manipulates content (private_tab.docShell.QueryInterface...)
[browser_privatebrowsing_cookieacceptdialog.js]
[browser_privatebrowsing_crh.js]
[browser_privatebrowsing_downloadLastDir.js]
skip-if = e10s # Bug ?????? MockFilePicker cleanup failing ( nsresult: "0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED)" location: "JS frame :: resource://specialpowers/MockFilePicker.jsm :: this.MockFilePicker.cleanup :: line 84")
[browser_privatebrowsing_downloadLastDir_c.js]
skip-if = e10s # Bug ?????? MockFilePicker cleanup failing ( nsresult: "0x80040154 (NS_ERROR_FACTORY_NOT_REGISTERED)" location: "JS frame :: resource://specialpowers/MockFilePicker.jsm :: this.MockFilePicker.cleanup :: line 84")
[browser_privatebrowsing_downloadLastDir_toggle.js]
[browser_privatebrowsing_geoprompt.js]
[browser_privatebrowsing_lastpbcontextexited.js]
@ -47,8 +42,5 @@ skip-if = e10s # Bug ?????? MockFilePicker cleanup failing ( nsresult: "0x800401
[browser_privatebrowsing_ui.js]
[browser_privatebrowsing_urlbarfocus.js]
[browser_privatebrowsing_windowtitle.js]
skip-if = e10s # Bug 918634 - swapFrameLoaders
[browser_privatebrowsing_zoom.js]
skip-if = e10s # Bug 691614 - e10s support for content zooming
[browser_privatebrowsing_zoomrestore.js]
skip-if = e10s # Bug 691614 - e10s support for content zooming

View File

@ -2,6 +2,7 @@
support-files = head.js
[browser_bug400731.js]
skip-if = e10s
[browser_bug415846.js]
skip-if = true
# Disabled because it seems to now touch network resources

View File

@ -6,5 +6,6 @@ support-files =
[browser_translation_bing.js]
[browser_translation_fhr.js]
skip-if = e10s
[browser_translation_infobar.js]
[browser_translation_exceptions.js]

View File

@ -1,3 +1,4 @@
. "$topsrcdir/build/mozconfig.win-common"
. "$topsrcdir/browser/config/mozconfigs/win64/common-win64"
. "$topsrcdir/browser/config/mozconfigs/win64/common-opt"

View File

@ -1,5 +1,6 @@
# This make file should be identical to the beta mozconfig, apart from the
# safeguard below
. "$topsrcdir/build/mozconfig.win-common"
. "$topsrcdir/browser/config/mozconfigs/win64/common-win64"
. "$topsrcdir/browser/config/mozconfigs/win64/common-opt"

View File

@ -300,6 +300,7 @@
@BINPATH@/components/shistory.xpt
@BINPATH@/components/spellchecker.xpt
@BINPATH@/components/storage.xpt
@BINPATH@/components/toolkit_filewatcher.xpt
@BINPATH@/components/toolkit_finalizationwitness.xpt
@BINPATH@/components/toolkit_formautofill.xpt
@BINPATH@/components/toolkit_osfile.xpt

View File

@ -6,6 +6,7 @@ support-files =
[browser_BrowserUITelemetry_buckets.js]
[browser_ContentSearch.js]
skip-if = e10s
support-files =
contentSearch.js
contentSearchBadImage.xml

View File

@ -4,7 +4,7 @@ export LIB=/d/msvs10/vc/lib:/d/msvs10/vc/atlmfc/lib:/d/sdks/v7.0/lib:/d/msvs8/VC
export PATH="/d/msvs10/VSTSDB/Deploy:/d/msvs10/Common7/IDE/:/d/msvs10/VC/BIN:/d/msvs10/Common7/Tools:/d/msvs10/VC/VCPackages:${PATH}"
export WIN32_REDIST_DIR=/d/msvs10/VC/redist/x86/Microsoft.VC100.CRT
. $topsrcdir/build/mozconfig.vs2010-common
. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH

View File

@ -25,7 +25,7 @@ export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x86:${_VSPATH}/Common7/
## WindowsSDKDir ##
export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
. $topsrcdir/build/mozconfig.vs2010-common
. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH

View File

@ -0,0 +1,28 @@
_VSPATH="/c/tools/vs2013"
export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x86/Microsoft.VC120.CRT
## moz tools location for 64-bit builders ##
export MOZ_TOOLS=C:/mozilla-build/moztools
## includes: win8 sdk includes, winrt headers for metro, msvc std library, directx sdk for d3d9 ##
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
## libs: win8 sdk x86 (32-bit) libs, msvc (32-bit) std library, msvc atl libs, directx sdk (32-bit) for d3d9 ##
export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
## paths: win8 sdk x86 (32-bit) tools, msvc (64-bit compiling 32-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x86:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64_x86:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:/c/mozilla-build/moztools:${PATH}"
## WindowsSDKDir ##
export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH
mk_export_correct_style PATH
mk_export_correct_style INCLUDE
mk_export_correct_style WIN32_REDIST_DIR
mk_add_options "export MOZ_TOOLS=$MOZ_TOOLS"

View File

@ -31,7 +31,7 @@ else
export LD=c:/tools/msvs10/VC/BIN/x86_amd64/link.exe
fi
. $topsrcdir/build/mozconfig.vs2010-common
. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH

View File

@ -0,0 +1,23 @@
_VSPATH="/c/tools/vs2013"
export WIN32_REDIST_DIR=${_VSPATH}/VC/redist/x64/Microsoft.VC120.CRT
## includes: win8 sdk includes, winrt headers for metro, msvc 10 std library, directx sdk for d3d9 ##
export INCLUDE=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/shared:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/um:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl:/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/include/winrt/wrl/wrappers:${_VSPATH}/vc/include:${_VSPATH}/vc/atlmfc/include:/c/tools/sdks/dx10/include
## libs: win8 sdk x64 (64-bit) libs, msvc 10 (64-bit) std library, msvc 10 atl libs, directx sdk (64-bit) for d3d9 ##
export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
## paths: win8 sdk x64 (64-bit) tools, msvc 10 (64-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x64:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/VC/BIN/x86_amd64:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:${PATH}"
## WindowsSDKDir ##
export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style LIB
mk_export_correct_style LIBPATH
mk_export_correct_style PATH
mk_export_correct_style INCLUDE
mk_export_correct_style WIN32_REDIST_DIR

View File

@ -34,7 +34,7 @@ public:
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
nsNullPrincipalURI(const nsCString &aSpec);
explicit nsNullPrincipalURI(const nsCString &aSpec);
private:
~nsNullPrincipalURI() {}

View File

@ -123,7 +123,7 @@ protected:
class nsExpandedPrincipal : public nsIExpandedPrincipal, public nsBasePrincipal
{
public:
nsExpandedPrincipal(nsTArray< nsCOMPtr<nsIPrincipal> > &aWhiteList);
explicit nsExpandedPrincipal(nsTArray< nsCOMPtr<nsIPrincipal> > &aWhiteList);
protected:
virtual ~nsExpandedPrincipal();

View File

@ -127,7 +127,7 @@ class nsChromeRegistryChrome : public nsChromeRegistry
typedef nsURIHashKey::KeyType KeyType;
typedef nsURIHashKey::KeyTypePointer KeyTypePointer;
OverlayListEntry(KeyTypePointer aKey) : nsURIHashKey(aKey) { }
explicit OverlayListEntry(KeyTypePointer aKey) : nsURIHashKey(aKey) { }
OverlayListEntry(OverlayListEntry&& toMove) : nsURIHashKey(mozilla::Move(toMove)),
mArray(mozilla::Move(toMove.mArray)) { }
~OverlayListEntry() { }

View File

@ -359,19 +359,25 @@ JAVA_GEN_DIR = _javagen
JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
OS_INCLUDES += $(MOZ_JPEG_CFLAGS) $(MOZ_PNG_CFLAGS) $(MOZ_ZLIB_CFLAGS) $(MOZ_PIXMAN_CFLAGS)
# NSPR_CFLAGS and NSS_CFLAGS must appear ahead of OS_INCLUDES to avoid Linux
# builds wrongly picking up system NSPR/NSS header files.
INCLUDES = \
-I$(srcdir) \
-I. \
$(LOCAL_INCLUDES) \
-I$(DIST)/include \
$(NULL)
ifndef IS_GYP_DIR
# NSPR_CFLAGS and NSS_CFLAGS must appear ahead of the other flags to avoid Linux
# builds wrongly picking up system NSPR/NSS header files.
OS_INCLUDES := \
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \
$(NSPR_CFLAGS) $(NSS_CFLAGS) \
$(OS_INCLUDES) \
$(MOZ_JPEG_CFLAGS) \
$(MOZ_PNG_CFLAGS) \
$(MOZ_ZLIB_CFLAGS) \
$(MOZ_PIXMAN_CFLAGS) \
$(NULL)
endif
include $(topsrcdir)/config/static-checking-config.mk
@ -483,8 +489,8 @@ OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
endif
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS) $(EXTRA_COMPILE_FLAGS)
ASFLAGS += $(EXTRA_ASSEMBLER_FLAGS)
@ -750,22 +756,5 @@ export NONASCII
DEFINES += -DNO_NSPR_10_SUPPORT
ifdef IS_GYP_DIR
LOCAL_INCLUDES += \
-I$(topsrcdir)/ipc/chromium/src \
-I$(topsrcdir)/ipc/glue \
-I$(DEPTH)/ipc/ipdl/_ipdlheaders \
$(NULL)
ifeq (WINNT,$(OS_TARGET))
# These get set via VC project file settings for normal GYP builds.
DEFINES += -DUNICODE -D_UNICODE
endif
DISABLE_STL_WRAPPING := 1
# Skip most Mozilla-specific include locations.
INCLUDES = -I. $(LOCAL_INCLUDES) -I$(DEPTH)/dist/include
endif
# Freeze the values specified by moz.build to catch them if they fail.
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES) $(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))

View File

@ -142,6 +142,9 @@ public:
protected:
double mX, mY, mWidth, mHeight;
private:
~DOMRect() {};
};
class DOMRectList MOZ_FINAL : public nsIDOMClientRectList,
@ -210,12 +213,6 @@ protected:
}
template<>
struct HasDangerousPublicDestructor<dom::DOMRect>
{
static const bool value = true;
};
}
#endif /*MOZILLA_DOMRECT_H_*/

View File

@ -1601,6 +1601,12 @@ nsDocument::~nsDocument()
NS_ASSERTION(!mIsShowing, "Destroying a currently-showing document");
// Note: This assert is only non-fatal because mochitest-bc triggers
// it... as well as the preceding assert about !mIsShowing.
NS_ASSERTION(!mObservingAppThemeChanged,
"Document leaked to shutdown, then the observer service dropped "
"its ref to us so we were able to go away.");
if (IsTopLevelContentDocument()) {
//don't report for about: pages
nsCOMPtr<nsIPrincipal> principal = GetPrincipal();
@ -8873,7 +8879,10 @@ nsDocument::OnPageShow(bool aPersisted,
"chrome-page-shown" :
"content-page-shown",
nullptr);
os->AddObserver(this, "app-theme-changed", /* ownsWeak */ false);
if (!mObservingAppThemeChanged) {
os->AddObserver(this, "app-theme-changed", /* ownsWeak */ false);
mObservingAppThemeChanged = true;
}
DispatchPageTransition(target, NS_LITERAL_STRING("pageshow"), aPersisted);
}
@ -8949,6 +8958,7 @@ nsDocument::OnPageHide(bool aPersisted,
nullptr);
os->RemoveObserver(this, "app-theme-changed");
mObservingAppThemeChanged = false;
}
DispatchPageTransition(target, NS_LITERAL_STRING("pagehide"), aPersisted);

View File

@ -1598,6 +1598,12 @@ public:
bool mAsyncFullscreenPending:1;
// Whether we're observing the "app-theme-changed" observer service
// notification. We need to keep track of this because we might get multiple
// OnPageShow notifications in a row without an OnPageHide in between, if
// we're getting document.open()/close() called on us.
bool mObservingAppThemeChanged:1;
// Keeps track of whether we have a pending
// 'style-sheet-applicable-state-changed' notification.
bool mSSApplicableStateNotificationPending:1;

View File

@ -26,10 +26,10 @@ class GlobalObject;
} // namespace dom
} // namespace mozilla
class nsFormData : public nsIDOMFormData,
public nsIXHRSendable,
public nsFormSubmission,
public nsWrapperCache
class nsFormData MOZ_FINAL : public nsIDOMFormData,
public nsIXHRSendable,
public nsFormSubmission,
public nsWrapperCache
{
~nsFormData() {}

View File

@ -1035,6 +1035,16 @@ nsObjectLoadingContent::BuildParametersArray()
}
nsAdoptingCString wmodeOverride = Preferences::GetCString("plugins.force.wmode");
#if defined(XP_WIN) || defined(XP_LINUX)
// Bug 923745 (/Bug 1061995) - Until we support windowed mode plugins in
// content processes, force flash to use a windowless rendering mode. This
// hack should go away when bug 923746 lands. (OS X plugins always use some
// native widgets, so unfortunately this does not help there)
if (wmodeOverride.IsEmpty() &&
XRE_GetProcessType() == GeckoProcessType_Content) {
wmodeOverride.AssignLiteral("transparent");
}
#endif
for (uint32_t i = 0; i < mCachedAttributes.Length(); i++) {
if (!wmodeOverride.IsEmpty() && mCachedAttributes[i].mName.EqualsIgnoreCase("wmode")) {

View File

@ -35,7 +35,7 @@ class AutoJSAPI;
// Script loader implementation
//////////////////////////////////////////////////////////////
class nsScriptLoader : public nsIStreamLoaderObserver
class nsScriptLoader MOZ_FINAL : public nsIStreamLoaderObserver
{
class MOZ_STACK_CLASS AutoCurrentScriptUpdater
{

View File

@ -48,9 +48,9 @@ protected:
nsRefPtr<HTMLPropertiesCollection> mCollection;
};
class HTMLPropertiesCollection : public nsIHTMLCollection,
public nsStubMutationObserver,
public nsWrapperCache
class HTMLPropertiesCollection MOZ_FINAL : public nsIHTMLCollection,
public nsStubMutationObserver,
public nsWrapperCache
{
friend class PropertyNodeList;
friend class PropertyStringList;

View File

@ -65,11 +65,6 @@ public:
// Can be called on any thread.
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) = 0;
// Returns the end time of the last sample in the media. Note that a media
// can have a non-zero start time, so the end time may not necessarily be
// the same as the duration (i.e. duration is (end_time - start_time)).
virtual int64_t GetEndMediaTime() const = 0;
// Return the duration of the media in microseconds.
virtual int64_t GetMediaDuration() = 0;

View File

@ -17,6 +17,20 @@ extern PRLogModuleInfo* gMediaStreamGraphLog;
#define STREAM_LOG(type, msg)
#endif
// We don't use NSPR log here because we want this interleaved with adb logcat
// on Android/B2G
// #define ENABLE_LIFECYCLE_LOG
#ifdef ENABLE_LIFECYCLE_LOG
#ifdef ANDROID
#include "android/log.h"
#define LIFECYCLE_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gecko - MSG" , ## __VA_ARGS__); printf(__VA_ARGS__);printf("\n");
#else
#define LIFECYCLE_LOG(...) printf(__VA_ARGS__);printf("\n");
#endif
#else
#define LIFECYCLE_LOG(...)
#endif
namespace mozilla {
struct AutoProfilerUnregisterThread
@ -68,10 +82,12 @@ void GraphDriver::SetGraphTime(GraphDriver* aPreviousDriver,
void GraphDriver::SwitchAtNextIteration(GraphDriver* aNextDriver)
{
STREAM_LOG(PR_LOG_DEBUG, ("Switching to new driver: %p (%s)", aNextDriver, aNextDriver->AsAudioCallbackDriver() ? "AudioCallbackDriver" : "SystemClockDriver"));
LIFECYCLE_LOG("Switching to new driver: %p (%s)",
aNextDriver, aNextDriver->AsAudioCallbackDriver() ?
"AudioCallbackDriver" : "SystemClockDriver");
// Sometimes we switch twice to a new driver per iteration, this is probably a
// bug.
MOZ_ASSERT(!mNextDriver || !mNextDriver->AsAudioCallbackDriver());
MOZ_ASSERT(!mNextDriver || mNextDriver->AsAudioCallbackDriver());
mNextDriver = aNextDriver;
}
@ -115,6 +131,47 @@ void GraphDriver::EnsureNextIterationLocked()
mNeedAnotherIteration = true;
}
class MediaStreamGraphShutdownThreadRunnable : public nsRunnable {
public:
explicit MediaStreamGraphShutdownThreadRunnable(GraphDriver* aDriver)
: mDriver(aDriver)
{
}
NS_IMETHOD Run()
{
MOZ_ASSERT(NS_IsMainThread());
LIFECYCLE_LOG("MediaStreamGraphShutdownThreadRunnable for graph %p",
mDriver->GraphImpl());
// We can't release an audio driver on the main thread, because it can be
// blocking.
if (mDriver->AsAudioCallbackDriver()) {
LIFECYCLE_LOG("Releasing audio driver off main thread.");
nsRefPtr<AsyncCubebTask> releaseEvent =
new AsyncCubebTask(mDriver->AsAudioCallbackDriver(),
AsyncCubebTask::SHUTDOWN);
mDriver = nullptr;
releaseEvent->Dispatch();
} else {
LIFECYCLE_LOG("Dropping driver reference for SystemClockDriver.");
mDriver = nullptr;
}
return NS_OK;
}
private:
nsRefPtr<GraphDriver> mDriver;
};
void GraphDriver::Shutdown()
{
if (AsAudioCallbackDriver()) {
LIFECYCLE_LOG("Releasing audio driver off main thread (GraphDriver::Shutdown).\n");
nsRefPtr<AsyncCubebTask> releaseEvent =
new AsyncCubebTask(AsAudioCallbackDriver(), AsyncCubebTask::SHUTDOWN);
releaseEvent->Dispatch();
}
}
ThreadedDriver::ThreadedDriver(MediaStreamGraphImpl* aGraphImpl)
: GraphDriver(aGraphImpl)
{ }
@ -125,33 +182,6 @@ ThreadedDriver::~ThreadedDriver()
mThread->Shutdown();
}
}
class MediaStreamGraphShutdownThreadRunnable : public nsRunnable {
public:
explicit MediaStreamGraphShutdownThreadRunnable(GraphDriver* aDriver)
: mDriver(aDriver)
{
}
NS_IMETHOD Run()
{
MOZ_ASSERT(NS_IsMainThread());
// We can't release an audio driver on the main thread, because it can be
// blocking.
if (mDriver->AsAudioCallbackDriver()) {
STREAM_LOG(PR_LOG_DEBUG, ("Releasing audio driver off main thread.\n"));
nsRefPtr<AsyncCubebTask> releaseEvent =
new AsyncCubebTask(mDriver->AsAudioCallbackDriver(), AsyncCubebTask::SHUTDOWN);
mDriver = nullptr;
releaseEvent->Dispatch();
} else {
mDriver = nullptr;
}
return NS_OK;
}
private:
nsRefPtr<GraphDriver> mDriver;
};
class MediaStreamGraphInitThreadRunnable : public nsRunnable {
public:
explicit MediaStreamGraphInitThreadRunnable(ThreadedDriver* aDriver)
@ -163,7 +193,13 @@ public:
char aLocal;
STREAM_LOG(PR_LOG_DEBUG, ("Starting system thread"));
profiler_register_thread("MediaStreamGraph", &aLocal);
LIFECYCLE_LOG("Starting a new system driver for graph %p\n",
mDriver->mGraphImpl);
if (mDriver->mPreviousDriver) {
LIFECYCLE_LOG("%p releasing an AudioCallbackDriver(%p), for graph %p\n",
mDriver,
mDriver->mPreviousDriver.get(),
mDriver->GraphImpl());
MOZ_ASSERT(!mDriver->AsAudioCallbackDriver());
// Stop and release the previous driver off-main-thread.
nsRefPtr<AsyncCubebTask> releaseEvent =
@ -185,6 +221,7 @@ private:
void
ThreadedDriver::Start()
{
LIFECYCLE_LOG("Starting thread for a SystemClockDriver %p\n", mGraphImpl);
nsCOMPtr<nsIRunnable> event = new MediaStreamGraphInitThreadRunnable(this);
NS_NewNamedThread("MediaStreamGrph", getter_AddRefs(mThread), event);
}
@ -413,6 +450,17 @@ OfflineClockDriver::WakeUp()
MOZ_ASSERT(false, "An offline graph should not have to wake up.");
}
AsyncCubebTask::AsyncCubebTask(AudioCallbackDriver* aDriver, AsyncCubebOperation aOperation)
: mDriver(aDriver),
mOperation(aOperation),
mShutdownGrip(aDriver->GraphImpl())
{
MOZ_ASSERT(mDriver->mAudioStream || aOperation == INIT, "No audio stream !");
}
AsyncCubebTask::~AsyncCubebTask()
{
}
NS_IMETHODIMP
AsyncCubebTask::Run()
@ -432,14 +480,18 @@ AsyncCubebTask::Run()
switch(mOperation) {
case AsyncCubebOperation::INIT:
LIFECYCLE_LOG("AsyncCubebOperation::INIT\n");
mDriver->Init();
break;
case AsyncCubebOperation::SHUTDOWN:
LIFECYCLE_LOG("AsyncCubebOperation::SHUTDOWN\n");
mDriver->Stop();
mDriver = nullptr;
mShutdownGrip = nullptr;
break;
case AsyncCubebOperation::SLEEP: {
{
LIFECYCLE_LOG("AsyncCubebOperation::SLEEP\n");
MonitorAutoLock mon(mDriver->mGraphImpl->GetMonitor());
// We might just have been awoken
if (mDriver->mNeedAnotherIteration) {
@ -797,7 +849,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames)
}
if (!stillProcessing) {
STREAM_LOG(PR_LOG_DEBUG, ("Stopping audio thread for MediaStreamGraph %p", this));
LIFECYCLE_LOG("Stopping audio thread for MediaStreamGraph %p", this);
return aFrames - 1;
}
return aFrames;

View File

@ -96,6 +96,7 @@ public:
virtual void Resume() = 0;
/* Revive this driver, as more messages just arrived. */
virtual void Revive() = 0;
void Shutdown();
/* Rate at which the GraphDriver runs, in ms. This can either be user
* controlled (because we are using a {System,Offline}ClockDriver, and decide
* how often we want to wakeup/how much we want to process per iteration), or
@ -187,6 +188,10 @@ public:
*/
void EnsureNextIterationLocked();
MediaStreamGraphImpl* GraphImpl() {
return mGraphImpl;
}
protected:
// Time of the start of this graph iteration.
GraphTime mIterationStart;
@ -460,12 +465,7 @@ public:
};
AsyncCubebTask(AudioCallbackDriver* aDriver, AsyncCubebOperation aOperation)
: mDriver(aDriver),
mOperation(aOperation)
{
MOZ_ASSERT(mDriver->mAudioStream || aOperation == INIT, "No audio stream !");
}
AsyncCubebTask(AudioCallbackDriver* aDriver, AsyncCubebOperation aOperation);
nsresult Dispatch()
{
@ -479,13 +479,14 @@ public:
}
protected:
virtual ~AsyncCubebTask() {};
virtual ~AsyncCubebTask();
private:
NS_IMETHOD Run() MOZ_OVERRIDE MOZ_FINAL;
nsCOMPtr<nsIThread> mThread;
nsRefPtr<AudioCallbackDriver> mDriver;
AsyncCubebOperation mOperation;
nsRefPtr<MediaStreamGraphImpl> mShutdownGrip;
};
}

View File

@ -130,12 +130,10 @@ void MediaDecoder::SetDormantIfNecessary(bool aDormant)
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if (!mDecoderStateMachine || !mDecoderStateMachine->IsDormantNeeded() || (mPlayState == PLAY_STATE_SHUTDOWN)) {
return;
}
if (mIsDormant == aDormant) {
// no change to dormant state
if (!mDecoderStateMachine ||
!mDecoderStateMachine->IsDormantNeeded() ||
mPlayState == PLAY_STATE_SHUTDOWN ||
mIsDormant == aDormant) {
return;
}
@ -149,16 +147,11 @@ void MediaDecoder::SetDormantIfNecessary(bool aDormant)
SecondsToUsecs(mCurrentTime, timeUsecs);
mRequestedSeekTarget = SeekTarget(timeUsecs, SeekTarget::Accurate);
if (mPlayState == PLAY_STATE_PLAYING){
mNextState = PLAY_STATE_PLAYING;
} else {
mNextState = PLAY_STATE_PAUSED;
}
mNextState = mPlayState;
mIsDormant = true;
mIsExitingDormant = false;
ChangeState(PLAY_STATE_LOADING);
} else if ((aDormant != true) && (mPlayState == PLAY_STATE_LOADING)) {
} else if (!aDormant && mPlayState == PLAY_STATE_LOADING) {
// exit dormant state
// trigger to state machine.
mDecoderStateMachine->SetDormant(false);
@ -170,7 +163,9 @@ void MediaDecoder::Pause()
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
if ((mPlayState == PLAY_STATE_LOADING && mIsDormant) || mPlayState == PLAY_STATE_SEEKING || mPlayState == PLAY_STATE_ENDED) {
if ((mPlayState == PLAY_STATE_LOADING && mIsDormant) ||
mPlayState == PLAY_STATE_SEEKING ||
mPlayState == PLAY_STATE_ENDED) {
mNextState = PLAY_STATE_PAUSED;
return;
}
@ -869,8 +864,11 @@ void MediaDecoder::PlaybackEnded()
{
MOZ_ASSERT(NS_IsMainThread());
if (mShuttingDown || mPlayState == MediaDecoder::PLAY_STATE_SEEKING)
if (mShuttingDown ||
mPlayState == PLAY_STATE_SEEKING ||
(mPlayState == PLAY_STATE_LOADING && mIsDormant)) {
return;
}
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
@ -1554,11 +1552,6 @@ bool MediaDecoder::IsShutdown() const {
return GetStateMachine()->IsShutdown();
}
int64_t MediaDecoder::GetEndMediaTime() const {
NS_ENSURE_TRUE(GetStateMachine(), -1);
return GetStateMachine()->GetEndMediaTime();
}
// Drop reference to state machine. Only called during shutdown dance.
void MediaDecoder::BreakCycles() {
mDecoderStateMachine = nullptr;

View File

@ -581,8 +581,6 @@ public:
// by the MediaResource read functions.
void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) MOZ_FINAL MOZ_OVERRIDE;
int64_t GetEndMediaTime() const MOZ_FINAL MOZ_OVERRIDE;
// Return true if we are currently seeking in the media resource.
// Call on the main thread only.
virtual bool IsSeeking() const;

View File

@ -1450,6 +1450,7 @@ void MediaDecoderStateMachine::Play()
void MediaDecoderStateMachine::ResetPlayback()
{
AssertCurrentThreadInMonitor();
MOZ_ASSERT(mState == DECODER_STATE_SEEKING ||
mState == DECODER_STATE_SHUTDOWN ||
mState == DECODER_STATE_DORMANT);
@ -2485,7 +2486,7 @@ MediaDecoderStateMachine::FlushDecoding()
{
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
"Should be on state machine or decode thread.");
mDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn();
AssertCurrentThreadInMonitor();
{
// Put a task in the decode queue to abort any decoding operations.

View File

@ -275,11 +275,6 @@ public:
void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset);
int64_t GetEndMediaTime() const {
AssertCurrentThreadInMonitor();
return mEndTime;
}
// Returns the shared state machine thread.
nsIEventTarget* GetStateMachineThread() const;

View File

@ -936,6 +936,7 @@ ChannelMediaResource::RecreateChannel()
loadGroup,
nullptr,
loadFlags);
NS_ENSURE_SUCCESS(rv, rv);
// We have cached the Content-Type, which should not change. Give a hint to
// the channel to avoid a sniffing failure, which would be expected because we
@ -1034,8 +1035,7 @@ ChannelMediaResource::CacheClientSeek(int64_t aOffset, bool aResume)
}
nsresult rv = RecreateChannel();
if (NS_FAILED(rv))
return rv;
NS_ENSURE_SUCCESS(rv, rv);
return OpenChannel(nullptr);
}

View File

@ -45,6 +45,21 @@ PRLogModuleInfo* gMediaStreamGraphLog;
#define STREAM_LOG(type, msg)
#endif
// #define ENABLE_LIFECYCLE_LOG
// We don't use NSPR log here because we want this interleaved with adb logcat
// on Android/B2G
#ifdef ENABLE_LIFECYCLE_LOG
# ifdef ANDROID
# include "android/log.h"
# define LIFECYCLE_LOG(...) __android_log_print(ANDROID_LOG_INFO, "Gecko - MSG", ## __VA_ARGS__); printf(__VA_ARGS__);printf("\n");
# else
# define LIFECYCLE_LOG(...) printf(__VA_ARGS__);printf("\n");
# endif
#else
# define LIFECYCLE_LOG(...)
#endif
/**
* The singleton graph instance.
*/
@ -55,6 +70,7 @@ MediaStreamGraphImpl::~MediaStreamGraphImpl()
NS_ASSERTION(IsEmpty(),
"All streams should have been destroyed by messages from the main thread");
STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p destroyed", this));
LIFECYCLE_LOG("MediaStreamGraphImpl::~MediaStreamGraphImpl\n");
}
@ -526,8 +542,11 @@ MediaStreamGraphImpl::UpdateStreamOrder()
started = CurrentDriver()->AsAudioCallbackDriver()->IsStarted();
}
if (started) {
SystemClockDriver* driver = new SystemClockDriver(this);
CurrentDriver()->SwitchAtNextIteration(driver);
MonitorAutoLock mon(mMonitor);
if (mLifecycleState == LIFECYCLE_RUNNING) {
SystemClockDriver* driver = new SystemClockDriver(this);
CurrentDriver()->SwitchAtNextIteration(driver);
}
}
}
@ -905,9 +924,12 @@ MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTim
if (!CurrentDriver()->AsAudioCallbackDriver() &&
!CurrentDriver()->Switching()) {
AudioCallbackDriver* driver = new AudioCallbackDriver(this);
mMixer.AddCallback(driver);
CurrentDriver()->SwitchAtNextIteration(driver);
MonitorAutoLock mon(mMonitor);
if (mLifecycleState == LIFECYCLE_RUNNING) {
AudioCallbackDriver* driver = new AudioCallbackDriver(this);
mMixer.AddCallback(driver);
CurrentDriver()->SwitchAtNextIteration(driver);
}
}
}
}
@ -1456,13 +1478,13 @@ public:
NS_ASSERTION(mGraph->mDetectedNotRunning,
"We should know the graph thread control loop isn't running!");
STREAM_LOG(PR_LOG_DEBUG, ("Shutting down graph %p", mGraph.get()));
LIFECYCLE_LOG("Shutting down graph %p", mGraph.get());
if (mGraph->CurrentDriver()->AsAudioCallbackDriver()) {
MOZ_ASSERT(!mGraph->CurrentDriver()->AsAudioCallbackDriver()->InCallback());
}
mGraph->CurrentDriver()->Stop();
mGraph->CurrentDriver()->Shutdown();
// mGraph's thread is not running so it's OK to do whatever here
if (mGraph->IsEmpty()) {
@ -1559,6 +1581,23 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
mPostedRunInStableStateEvent = false;
}
#ifdef ENABLE_LIFECYCLE_LOG
// This should be kept in sync with the LifecycleState enum in
// MediaStreamGraphImpl.h
const char * LifecycleState_str[] = {
"LIFECYCLE_THREAD_NOT_STARTED",
"LIFECYCLE_RUNNING",
"LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP",
"LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN",
"LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION"
};
if (mLifecycleState != LIFECYCLE_RUNNING) {
LIFECYCLE_LOG("Running %p in stable state. Current state: %s\n",
this, LifecycleState_str[mLifecycleState]);
}
#endif
runnables.SwapElements(mUpdateRunnables);
for (uint32_t i = 0; i < mStreamUpdates.Length(); ++i) {
StreamUpdate* update = &mStreamUpdates[i];
@ -1572,17 +1611,19 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
if (mLifecycleState == LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP && IsEmpty()) {
// Complete shutdown. First, ensure that this graph is no longer used.
// A new graph graph will be created if one is needed.
STREAM_LOG(PR_LOG_DEBUG, ("Disconnecting MediaStreamGraph %p", this));
if (this == gGraph) {
// null out gGraph if that's the graph being shut down
gGraph = nullptr;
}
// Asynchronously clean up old graph. We don't want to do this
// synchronously because it spins the event loop waiting for threads
// to shut down, and we don't want to do that in a stable state handler.
mLifecycleState = LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN;
LIFECYCLE_LOG("Sending MediaStreamGraphShutDownRunnable %p", this);
nsCOMPtr<nsIRunnable> event = new MediaStreamGraphShutDownRunnable(this );
NS_DispatchToMainThread(event);
LIFECYCLE_LOG("Disconnecting MediaStreamGraph %p", this);
if (this == gGraph) {
// null out gGraph if that's the graph being shut down
gGraph = nullptr;
}
}
} else {
if (mLifecycleState <= LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP) {
@ -1605,6 +1646,9 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
// or it might exit immediately.
{
MonitorAutoUnlock unlock(mMonitor);
LIFECYCLE_LOG("Reviving a graph (%p) ! %s\n",
this, CurrentDriver()->AsAudioCallbackDriver() ? "AudioDriver" :
"SystemDriver");
CurrentDriver()->Revive();
}
}
@ -1622,7 +1666,10 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
// We should exit the monitor for now, because starting a stream might
// take locks, and we don't want to deadlock.
MonitorAutoUnlock unlock(mMonitor);
STREAM_LOG(PR_LOG_DEBUG, ("Starting a graph ! %s\n", CurrentDriver()->AsAudioCallbackDriver() ? "AudioDriver" : "SystemDriver"));
LIFECYCLE_LOG("Starting a graph (%p) ! %s\n",
this,
CurrentDriver()->AsAudioCallbackDriver() ? "AudioDriver" :
"SystemDriver");
CurrentDriver()->Start();
}
}

View File

@ -688,7 +688,8 @@ public:
mMutex("mozilla::media::SourceMediaStream"),
mUpdateKnownTracksTime(0),
mPullEnabled(false),
mUpdateFinished(false)
mUpdateFinished(false),
mNeedsMixing(false)
{}
virtual SourceMediaStream* AsSourceStream() { return this; }

View File

@ -520,6 +520,9 @@ public:
* is not deleted. New messages for the graph are processed synchronously on
* the main thread if necessary. When the last stream is destroyed, the
* graph object is deleted.
*
* This should be kept in sync with the LifecycleState_str array in
* MediaStreamGraph.cpp
*/
enum LifecycleState {
// The graph thread hasn't started yet.

View File

@ -449,6 +449,9 @@ AppleVTDecoder::InitializeSession()
CFDictionaryCreateMutable(NULL, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
// FIXME: Enabling hardware acceleration causes crashes in
// VTDecompressionSessionCreate() with multiple videos. Bug 1055694
#if 0
// This key is supported (or ignored) but not declared prior to OSX 10.9.
AutoCFRelease<CFStringRef>
kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder =
@ -458,6 +461,7 @@ AppleVTDecoder::InitializeSession()
CFDictionarySetValue(spec,
kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder,
kCFBooleanTrue);
#endif
VTDecompressionOutputCallbackRecord cb = { PlatformCallback, this };
rv = VTDecompressionSessionCreate(NULL, // Allocator.

View File

@ -41,6 +41,8 @@ MediaSourceReader::MediaSourceReader(MediaSourceDecoder* aDecoder)
, mDropAudioBeforeThreshold(false)
, mDropVideoBeforeThreshold(false)
, mEnded(false)
, mAudioIsSeeking(false)
, mVideoIsSeeking(false)
{
}
@ -76,6 +78,14 @@ MediaSourceReader::OnAudioDecoded(AudioData* aSample)
}
mDropAudioBeforeThreshold = false;
}
// If we are seeking we need to make sure the first sample decoded after
// that seek has the mDiscontinuity field set to ensure the media decoder
// state machine picks up that the seek is complete.
if (mAudioIsSeeking) {
mAudioIsSeeking = false;
aSample->mDiscontinuity = true;
}
GetCallback()->OnAudioDecoded(aSample);
}
@ -87,7 +97,7 @@ MediaSourceReader::OnAudioEOS()
if (SwitchReaders(SWITCH_FORCED)) {
// Success! Resume decoding with next audio decoder.
RequestAudioData();
} else {
} else if (IsEnded()) {
// End of stream.
MSE_DEBUG("MediaSourceReader(%p)::OnAudioEOS reader=%p EOS (readers=%u)",
this, mAudioReader.get(), mDecoders.Length());
@ -122,6 +132,15 @@ MediaSourceReader::OnVideoDecoded(VideoData* aSample)
}
mDropVideoBeforeThreshold = false;
}
// If we are seeking we need to make sure the first sample decoded after
// that seek has the mDiscontinuity field set to ensure the media decoder
// state machine picks up that the seek is complete.
if (mVideoIsSeeking) {
mVideoIsSeeking = false;
aSample->mDiscontinuity = true;
}
GetCallback()->OnVideoDecoded(aSample);
}
@ -438,6 +457,7 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
ResetDecode();
if (mAudioReader) {
mAudioIsSeeking = true;
nsresult rv = mAudioReader->Seek(aTime, aStartTime, aEndTime, aCurrentTime);
MSE_DEBUG("MediaSourceReader(%p)::Seek audio reader=%p rv=%x", this, mAudioReader.get(), rv);
if (NS_FAILED(rv)) {
@ -445,6 +465,7 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
}
}
if (mVideoReader) {
mVideoIsSeeking = true;
nsresult rv = mVideoReader->Seek(aTime, aStartTime, aEndTime, aCurrentTime);
MSE_DEBUG("MediaSourceReader(%p)::Seek video reader=%p rv=%x", this, mVideoReader.get(), rv);
if (NS_FAILED(rv)) {

View File

@ -116,6 +116,14 @@ private:
nsRefPtr<MediaDecoderReader> mVideoReader;
bool mEnded;
// For a seek to complete we need to send a sample with
// the mDiscontinuity field set to true once we have the
// first decoded sample. These flags are set during seeking
// so we can detect when we have the first decoded sample
// after a seek.
bool mAudioIsSeeking;
bool mVideoIsSeeking;
};
} // namespace mozilla

View File

@ -61,6 +61,17 @@ public:
return false;
}
virtual bool IsMediaSegmentPresent(const uint8_t* aData, uint32_t aLength)
{
MSE_DEBUG("ContainerParser(%p)::IsMediaSegmentPresent aLength=%u [%x%x%x%x]",
this, aLength,
aLength > 0 ? aData[0] : 0,
aLength > 1 ? aData[1] : 0,
aLength > 2 ? aData[2] : 0,
aLength > 3 ? aData[3] : 0);
return false;
}
virtual bool ParseStartAndEndTimestamps(const uint8_t* aData, uint32_t aLength,
double& aStart, double& aEnd)
{
@ -82,7 +93,7 @@ protected:
class WebMContainerParser : public ContainerParser {
public:
WebMContainerParser()
: mTimecodeScale(0)
: mParser(0), mOffset(0)
{}
bool IsInitSegmentPresent(const uint8_t* aData, uint32_t aLength)
@ -105,28 +116,48 @@ public:
return false;
}
virtual bool ParseStartAndEndTimestamps(const uint8_t* aData, uint32_t aLength,
double& aStart, double& aEnd)
bool IsMediaSegmentPresent(const uint8_t* aData, uint32_t aLength)
{
ContainerParser::IsMediaSegmentPresent(aData, aLength);
// XXX: This is overly primitive, needs to collect data as it's appended
// to the SB and handle, rather than assuming everything is present in a
// single aData segment.
// 0x1a45dfa3 // EBML
// ...
// DocType == "webm"
// ...
// 0x18538067 // Segment (must be "unknown" size)
// 0x1549a966 // -> Segment Info
// 0x1654ae6b // -> One or more Tracks
if (aLength >= 4 &&
aData[0] == 0x1f && aData[1] == 0x43 && aData[2] == 0xb6 && aData[3] == 0x75) {
return true;
}
return false;
}
WebMBufferedParser parser(0);
if (mTimecodeScale != 0) {
parser.SetTimecodeScale(mTimecodeScale);
virtual bool ParseStartAndEndTimestamps(const uint8_t* aData, uint32_t aLength,
double& aStart, double& aEnd)
{
bool initSegment = IsInitSegmentPresent(aData, aLength);
if (initSegment) {
mOffset = 0;
mParser = WebMBufferedParser(0);
mOverlappedMapping.Clear();
}
// XXX if it only adds new mappings, overlapped but not available
// (e.g. overlap < 0) frames are "lost" from the reported mappings here.
nsTArray<WebMTimeDataOffset> mapping;
mapping.AppendElements(mOverlappedMapping);
mOverlappedMapping.Clear();
ReentrantMonitor dummy("dummy");
parser.Append(aData, aLength, mapping, dummy);
mTimecodeScale = parser.GetTimecodeScale();
mParser.Append(aData, aLength, mapping, dummy);
// XXX This is a bit of a hack. Assume if there are no timecodes
// present and it's an init segment that it's _just_ an init segment.
// We should be more precise.
if (IsInitSegmentPresent(aData, aLength)) {
if (initSegment) {
uint32_t length = aLength;
if (!mapping.IsEmpty()) {
length = mapping[0].mSyncOffset;
@ -137,23 +168,40 @@ public:
mInitData.ReplaceElementsAt(0, mInitData.Length(), aData, length);
}
mOffset += aLength;
if (mapping.IsEmpty()) {
return false;
}
// Exclude frames that we don't enough data to cover the end of.
uint32_t endIdx = mapping.Length() - 1;
while (mOffset < mapping[endIdx].mEndOffset && endIdx > 0) {
endIdx -= 1;
}
if (endIdx == 0) {
return false;
}
static const double NS_PER_S = 1e9;
aStart = mapping[0].mTimecode / NS_PER_S;
aEnd = mapping.LastElement().mTimecode / NS_PER_S;
aEnd = mapping[endIdx].mTimecode / NS_PER_S;
aEnd += (mapping[endIdx].mTimecode - mapping[endIdx - 1].mTimecode) / NS_PER_S;
MSE_DEBUG("WebMContainerParser(%p)::ParseStartAndEndTimestamps: [%f, %f] [fso=%lld, leo=%lld]",
this, aStart, aEnd, mapping[0].mSyncOffset, mapping.LastElement().mEndOffset);
MSE_DEBUG("WebMContainerParser(%p)::ParseStartAndEndTimestamps: [%f, %f] [fso=%lld, leo=%lld, l=%u endIdx=%u]",
this, aStart, aEnd, mapping[0].mSyncOffset, mapping[endIdx].mEndOffset, mapping.Length(), endIdx);
mapping.RemoveElementsAt(0, endIdx + 1);
mOverlappedMapping.AppendElements(mapping);
return true;
}
private:
uint32_t mTimecodeScale;
WebMBufferedParser mParser;
nsTArray<WebMTimeDataOffset> mOverlappedMapping;
int64_t mOffset;
};
class MP4ContainerParser : public ContainerParser {
@ -585,7 +633,8 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
}
double start, end;
if (mParser->ParseStartAndEndTimestamps(aData, aLength, start, end)) {
if (start <= mLastParsedTimestamp || mLastParsedTimestamp - start > 0.1) {
if (mParser->IsMediaSegmentPresent(aData, aLength) &&
(start < mLastParsedTimestamp || start - mLastParsedTimestamp > 0.1)) {
MSE_DEBUG("SourceBuffer(%p)::AppendData: Data (%f, %f) overlaps %f.",
this, start, end, mLastParsedTimestamp);

View File

@ -63,12 +63,6 @@ SourceBufferDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
MSE_DEBUG("SourceBufferDecoder(%p)::NotifyBytesConsumed UNIMPLEMENTED", this);
}
int64_t
SourceBufferDecoder::GetEndMediaTime() const
{
return mMediaDuration;
}
int64_t
SourceBufferDecoder::GetMediaDuration()
{

View File

@ -37,7 +37,6 @@ public:
virtual bool IsTransportSeekable() MOZ_FINAL MOZ_OVERRIDE;
virtual bool OnDecodeThread() const MOZ_FINAL MOZ_OVERRIDE;
virtual bool OnStateMachineThread() const MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetEndMediaTime() const MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetMediaDuration() MOZ_FINAL MOZ_OVERRIDE;
virtual layers::ImageContainer* GetImageContainer() MOZ_FINAL MOZ_OVERRIDE;
virtual MediaDecoderOwner* GetOwner() MOZ_FINAL MOZ_OVERRIDE;

View File

@ -88,13 +88,6 @@ BufferDecoder::NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded)
// ignore
}
int64_t
BufferDecoder::GetEndMediaTime() const
{
// unknown
return -1;
}
int64_t
BufferDecoder::GetMediaDuration()
{

View File

@ -43,8 +43,6 @@ public:
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetEndMediaTime() const MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetMediaDuration() MOZ_FINAL MOZ_OVERRIDE;
virtual void SetMediaDuration(int64_t aDuration) MOZ_FINAL MOZ_OVERRIDE;

View File

@ -1,4 +1,5 @@
[DEFAULT]
skip-if = e10s
support-files =
browser_mozAudioChannel.html
browser_mozAudioChannel_muted.html

View File

@ -157,6 +157,7 @@ WebMReader::WebMReader(AbstractMediaDecoder* aDecoder)
mAudioTrack(0),
mAudioStartUsec(-1),
mAudioFrames(0),
mLastVideoFrameTime(0),
mAudioCodec(-1),
mVideoCodec(-1),
mHasVideo(false),
@ -864,6 +865,7 @@ bool WebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
if (r == -1) {
return false;
}
mLastVideoFrameTime = tstamp;
// The end time of this frame is the start time of the next frame. Fetch
// the timestamp of the next packet for this track. If we've reached the
@ -878,12 +880,8 @@ bool WebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
}
PushVideoPacket(next_holder.disown());
} else {
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
int64_t endTime = mDecoder->GetEndMediaTime();
if (endTime == -1) {
return false;
}
next_tstamp = endTime * NS_PER_USEC;
next_tstamp = tstamp;
next_tstamp += tstamp - mLastVideoFrameTime;
}
int64_t tstamp_usecs = tstamp / NS_PER_USEC;

View File

@ -224,6 +224,10 @@ private:
// Number of microseconds that must be discarded from the start of the Stream.
uint64_t mCodecDelay;
// Calculate the frame duration from the last decodeable frame using the
// previous frame's timestamp. In NS.
uint64_t mLastVideoFrameTime;
// Parser state and computed offset-time mappings. Shared by multiple
// readers when decoder has been cloned. Main thread only.
nsRefPtr<WebMBufferedState> mBufferedState;

View File

@ -23,7 +23,7 @@ class SpeechSynthesisChild;
class nsSpeechTask;
class VoiceData;
class nsSynthVoiceRegistry : public nsISynthVoiceRegistry
class nsSynthVoiceRegistry MOZ_FINAL : public nsISynthVoiceRegistry
{
public:
NS_DECL_ISUPPORTS

View File

@ -75,9 +75,6 @@ SVGForeignObjectElement::Height()
SVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
// 'transform' attribute:
gfxMatrix fromUserSpace =
SVGGraphicsElement::PrependLocalTransformsTo(aMatrix, aWhich);
@ -90,7 +87,7 @@ SVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
GetAnimatedLengthValues(&x, &y, nullptr);
gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
if (aWhich == eChildToUserSpace) {
return toUserSpace;
return toUserSpace * aMatrix;
}
NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes");
return toUserSpace * fromUserSpace;

View File

@ -64,9 +64,6 @@ SVGIFrameElement::~SVGIFrameElement()
SVGIFrameElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
// 'transform' attribute:
gfxMatrix fromUserSpace =
SVGGraphicsElement::PrependLocalTransformsTo(aMatrix, aWhich);

View File

@ -956,9 +956,6 @@ SVGSVGElement::GetLength(uint8_t aCtxType)
SVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
// 'transform' attribute:
gfxMatrix fromUserSpace =
SVGSVGElementBase::PrependLocalTransformsTo(aMatrix, aWhich);
@ -974,7 +971,7 @@ SVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix().Translate(gfxPoint(x, y)) * fromUserSpace;
}
NS_ABORT_IF_FALSE(aWhich == eChildToUserSpace, "Unknown TransformTypes");
return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix().Translate(gfxPoint(x, y));
return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix().Translate(gfxPoint(x, y)) * aMatrix;
}
if (IsRoot()) {

View File

@ -93,9 +93,6 @@ gfxMatrix
SVGTransformableElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
gfxMatrix result(aMatrix);
if (aWhich == eChildToUserSpace) {

View File

@ -425,9 +425,6 @@ SVGUseElement::UnlinkSource()
SVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
// 'transform' attribute:
gfxMatrix fromUserSpace =
SVGUseElementBase::PrependLocalTransformsTo(aMatrix, aWhich);
@ -439,7 +436,7 @@ SVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
const_cast<SVGUseElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr);
gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
if (aWhich == eChildToUserSpace) {
return toUserSpace;
return toUserSpace * aMatrix;
}
NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes");
return toUserSpace * fromUserSpace;

View File

@ -92,6 +92,8 @@ skip-if = e10s # Bug ?????? - event handler checks event.target is the content d
[browser_uriFixupIntegration.js]
skip-if = e10s
[browser_loadDisallowInherit.js]
skip-if = e10s
[browser_loadURI.js]
skip-if = e10s # Bug ?????? - event handler checks event.target is the content document and test e10s-utils doesn't do that.
[browser_search_notification.js]
skip-if = e10s

View File

@ -119,6 +119,24 @@ struct nsDelayedBlurOrFocusEvent
nsCOMPtr<EventTarget> mTarget;
};
inline void ImplCycleCollectionUnlink(nsDelayedBlurOrFocusEvent& aField)
{
aField.mPresShell = nullptr;
aField.mDocument = nullptr;
aField.mTarget = nullptr;
}
inline void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
nsDelayedBlurOrFocusEvent& aField,
const char* aName,
uint32_t aFlags = 0)
{
CycleCollectionNoteChild(aCallback, aField.mPresShell.get(), aName, aFlags);
CycleCollectionNoteChild(aCallback, aField.mDocument.get(), aName, aFlags);
CycleCollectionNoteChild(aCallback, aField.mTarget.get(), aName, aFlags);
}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFocusManager)
NS_INTERFACE_MAP_ENTRY(nsIFocusManager)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
@ -135,7 +153,9 @@ NS_IMPL_CYCLE_COLLECTION(nsFocusManager,
mFocusedContent,
mFirstBlurEvent,
mFirstFocusEvent,
mWindowBeingLowered)
mWindowBeingLowered,
mDelayedBlurFocusEvents,
mMouseButtonEventHandlingDocument)
nsFocusManager* nsFocusManager::sInstance = nullptr;
bool nsFocusManager::sMouseFocusesFormControl = false;

View File

@ -1396,105 +1396,6 @@ static const JSFunctionSpec TraceMallocFunctions[] = {
#endif /* NS_TRACE_MALLOC */
#ifdef MOZ_DMD
#include <errno.h>
namespace mozilla {
namespace dmd {
// See https://wiki.mozilla.org/Performance/MemShrink/DMD for instructions on
// how to use DMD.
static FILE *
OpenDMDOutputFile(JSContext *cx, JS::CallArgs &args)
{
JSString *str = JS::ToString(cx, args.get(0));
if (!str)
return nullptr;
JSAutoByteString pathname(cx, str);
if (!pathname)
return nullptr;
FILE* fp = fopen(pathname.ptr(), "w");
if (!fp) {
JS_ReportError(cx, "DMD can't open %s: %s",
pathname.ptr(), strerror(errno));
return nullptr;
}
return fp;
}
static bool
AnalyzeReports(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!dmd::IsRunning()) {
JS_ReportError(cx, "DMD is not running");
return false;
}
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
FILE *fp = OpenDMDOutputFile(cx, args);
if (!fp) {
return false;
}
dmd::ClearReports();
dmd::RunReportersForThisProcess();
dmd::Writer writer(FpWrite, fp);
dmd::AnalyzeReports(writer);
fclose(fp);
args.rval().setUndefined();
return true;
}
// This will be removed eventually.
static bool
ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp)
{
JS_ReportWarning(cx, "DMDReportAndDump() is deprecated; "
"please use DMDAnalyzeReports() instead");
return AnalyzeReports(cx, argc, vp);
}
static bool
AnalyzeHeap(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!dmd::IsRunning()) {
JS_ReportError(cx, "DMD is not running");
return false;
}
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
FILE *fp = OpenDMDOutputFile(cx, args);
if (!fp) {
return false;
}
dmd::Writer writer(FpWrite, fp);
dmd::AnalyzeHeap(writer);
fclose(fp);
args.rval().setUndefined();
return true;
}
} // namespace dmd
} // namespace mozilla
static const JSFunctionSpec DMDFunctions[] = {
JS_FS("DMDReportAndDump", dmd::ReportAndDump, 1, 0),
JS_FS("DMDAnalyzeReports", dmd::AnalyzeReports, 1, 0),
JS_FS("DMDAnalyzeHeap", dmd::AnalyzeHeap, 1, 0),
JS_FS_END
};
#endif // defined(MOZ_DMD)
#ifdef MOZ_JPROF
#include <signal.h>
@ -1618,13 +1519,6 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
}
#endif
#ifdef MOZ_DMD
if (nsContentUtils::IsCallerChrome()) {
// Attempt to initialize DMD functions
::JS_DefineFunctions(cx, aGlobalObj, DMDFunctions);
}
#endif
#ifdef MOZ_JPROF
// Attempt to initialize JProf functions
::JS_DefineFunctions(cx, aGlobalObj, JProfFunctions);

View File

@ -1252,7 +1252,7 @@ ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle<JSObject*> wrapper,
JS::Handle<JSObject*> obj,
size_t protoAndIfaceCacheIndex, unsigned attrs,
JS::MutableHandle<JSPropertyDescriptor> desc,
bool cacheOnHolder)
bool& cacheOnHolder)
{
JS::Rooted<JSObject*> global(cx, js::GetGlobalForObjectCrossCompartment(obj));
{

View File

@ -113,12 +113,12 @@ MobileConnectionListener::NotifyDataError(const nsAString & message)
}
NS_IMETHODIMP
MobileConnectionListener::NotifyCFStateChange(bool success,
uint16_t action,
uint16_t reason,
const nsAString& number,
uint16_t timeSeconds,
uint16_t serviceClass)
MobileConnectionListener::NotifyCFStateChanged(bool success,
uint16_t action,
uint16_t reason,
const nsAString& number,
uint16_t timeSeconds,
uint16_t serviceClass)
{
return NS_OK;
}
@ -154,18 +154,36 @@ MobileConnectionListener::NotifyClirModeChanged(uint32_t aMode)
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyLastKnownNetworkChanged()
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyLastKnownHomeNetworkChanged()
{
return NS_OK;
}
NS_IMETHODIMP
MobileConnectionListener::NotifyNetworkSelectionModeChanged()
{
return NS_OK;
}
bool
MobileConnectionListener::Listen(bool aStart)
{
nsCOMPtr<nsIMobileConnectionProvider> provider =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
NS_ENSURE_TRUE(provider, false);
nsCOMPtr<nsIMobileConnectionService> service =
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, false);
nsresult rv;
if (aStart) {
rv = provider->RegisterMobileConnectionMsg(mClientId, this);
rv = service->RegisterListener(mClientId, this);
} else {
rv = provider->UnregisterMobileConnectionMsg(mClientId, this);
rv = service->UnregisterListener(mClientId, this);
}
return NS_SUCCEEDED(rv);
@ -352,13 +370,13 @@ BluetoothRilListener::SelectClient()
// Reset mClientId
mClientId = mMobileConnListeners.Length();
nsCOMPtr<nsIMobileConnectionProvider> connection =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
NS_ENSURE_TRUE_VOID(connection);
nsCOMPtr<nsIMobileConnectionService> service =
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(service);
for (uint32_t i = 0; i < mMobileConnListeners.Length(); i++) {
nsCOMPtr<nsIMobileConnectionInfo> voiceInfo;
connection->GetVoiceConnectionInfo(i, getter_AddRefs(voiceInfo));
service->GetVoiceConnectionInfo(i, getter_AddRefs(voiceInfo));
if (!voiceInfo) {
BT_WARNING("%s: Failed to get voice connection info", __FUNCTION__);
continue;

View File

@ -12,7 +12,7 @@
#include "nsAutoPtr.h"
#include "nsIIccProvider.h"
#include "nsIMobileConnectionProvider.h"
#include "nsIMobileConnectionService.h"
#include "nsITelephonyService.h"
BEGIN_BLUETOOTH_NAMESPACE

View File

@ -19,7 +19,7 @@
#include "nsIDOMIccInfo.h"
#include "nsIIccProvider.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionProvider.h"
#include "nsIMobileConnectionService.h"
#include "nsIMobileNetworkInfo.h"
#include "nsIObserverService.h"
#include "nsISettingsService.h"
@ -612,8 +612,8 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
void
BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
{
nsCOMPtr<nsIMobileConnectionProvider> connection =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
nsCOMPtr<nsIMobileConnectionService> connection =
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(connection);
nsCOMPtr<nsIMobileConnectionInfo> voiceInfo;

View File

@ -28,7 +28,7 @@
#include "nsIDOMIccInfo.h"
#include "nsIIccProvider.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionProvider.h"
#include "nsIMobileConnectionService.h"
#include "nsIMobileNetworkInfo.h"
#include "nsITelephonyService.h"
#include "nsRadioInterfaceLayer.h"
@ -606,8 +606,8 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
void
BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
{
nsCOMPtr<nsIMobileConnectionProvider> connection =
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
nsCOMPtr<nsIMobileConnectionService> connection =
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(connection);
nsCOMPtr<nsIMobileConnectionInfo> voiceInfo;

View File

@ -38,27 +38,7 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(BluetoothAdapter, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(BluetoothAdapter, DOMEventTargetHelper)
/*
* A comparator that does the comparison of BluetoothDevice instances.
* Two BluetoothDevices are equivalent if they have an identical address.
*/
class BluetoothDeviceComparator
{
public:
bool Equals(const BluetoothDevice* aDeviceA,
const BluetoothDevice* aDeviceB) const
{
nsString addressA;
nsString addressB;
aDeviceA->GetAddress(addressA);
aDeviceB->GetAddress(addressB);
return addressA.Equals(addressB);
}
};
class StartDiscoveryTask : public BluetoothReplyRunnable
class StartDiscoveryTask MOZ_FINAL : public BluetoothReplyRunnable
{
public:
StartDiscoveryTask(BluetoothAdapter* aAdapter, Promise* aPromise)
@ -209,10 +189,10 @@ static int kCreatePairedDeviceTimeout = 50000; // unit: msec
BluetoothAdapter::BluetoothAdapter(nsPIDOMWindow* aWindow,
const BluetoothValue& aValue)
: DOMEventTargetHelper(aWindow)
, mDiscoveryHandleInUse(nullptr)
, mState(BluetoothAdapterState::Disabled)
, mDiscoverable(false)
, mDiscovering(false)
, mDiscoveryHandleInUse(nullptr)
{
MOZ_ASSERT(aWindow);
MOZ_ASSERT(IsDOMBinding());
@ -304,7 +284,7 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
BluetoothDevice::Create(GetOwner(), BluetoothValue(props));
// Append to adapter's device array if the device hasn't been created
if (!mDevices.Contains(pairedDevice, BluetoothDeviceComparator())) {
if (!mDevices.Contains(pairedDevice)) {
mDevices.AppendElement(pairedDevice);
}
}
@ -661,7 +641,7 @@ BluetoothAdapter::Unpair(const nsAString& aDeviceAddress, ErrorResult& aRv)
}
already_AddRefed<Promise>
BluetoothAdapter::EnableDisable(bool aEnable, ErrorResult& aRv)
BluetoothAdapter::Enable(ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
if (!global) {
@ -672,57 +652,72 @@ BluetoothAdapter::EnableDisable(bool aEnable, ErrorResult& aRv)
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
// Ensure BluetoothService is available before modifying adapter state
/**
* Ensure
* - adapter is disabled, and
* - BluetoothService is available.
*/
BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Disabled,
NS_ERROR_DOM_INVALID_STATE_ERR);
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, NS_ERROR_NOT_AVAILABLE);
// Modify adapter state to Enabling/Disabling if adapter is in a valid state
nsAutoString methodName;
if (aEnable) {
// Enable local adapter
BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Disabled,
NS_ERROR_DOM_INVALID_STATE_ERR);
methodName.AssignLiteral("Enable");
mState = BluetoothAdapterState::Enabling;
} else {
// Disable local adapter
BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Enabled,
NS_ERROR_DOM_INVALID_STATE_ERR);
methodName.AssignLiteral("Disable");
mState = BluetoothAdapterState::Disabling;
}
// Notify applications of adapter state change to Enabling/Disabling
HandleAdapterStateChanged();
// Set adapter state "Enabling"
SetAdapterState(BluetoothAdapterState::Enabling);
// Wrap runnable to handle result
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr, /* DOMRequest */
promise,
methodName);
if (NS_FAILED(bs->EnableDisable(aEnable, result))) {
// Restore mState and notify applications of adapter state change
mState = aEnable ? BluetoothAdapterState::Disabled
: BluetoothAdapterState::Enabled;
HandleAdapterStateChanged();
NS_LITERAL_STRING("Enable"));
if (NS_FAILED(bs->EnableDisable(true, result))) {
// Restore adapter state and reject promise
SetAdapterState(BluetoothAdapterState::Disabled);
promise->MaybeReject(NS_ERROR_DOM_OPERATION_ERR);
}
return promise.forget();
}
already_AddRefed<Promise>
BluetoothAdapter::Enable(ErrorResult& aRv)
{
return EnableDisable(true, aRv);
}
already_AddRefed<Promise>
BluetoothAdapter::Disable(ErrorResult& aRv)
{
return EnableDisable(false, aRv);
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
if (!global) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
/**
* Ensure
* - adapter is enabled, and
* - BluetoothService is available.
*/
BT_ENSURE_TRUE_REJECT(mState == BluetoothAdapterState::Enabled,
NS_ERROR_DOM_INVALID_STATE_ERR);
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, NS_ERROR_NOT_AVAILABLE);
// Set adapter state "Disabling"
SetAdapterState(BluetoothAdapterState::Disabling);
// Wrap runnable to handle result
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr, /* DOMRequest */
promise,
NS_LITERAL_STRING("Disable"));
if (NS_FAILED(bs->EnableDisable(false, result))) {
// Restore adapter state and reject promise
SetAdapterState(BluetoothAdapterState::Enabled);
promise->MaybeReject(NS_ERROR_DOM_OPERATION_ERR);
}
return promise.forget();
}
BluetoothAdapterAttribute
@ -768,8 +763,15 @@ BluetoothAdapter::IsAdapterAttributeChanged(BluetoothAdapterAttribute aType,
}
void
BluetoothAdapter::HandleAdapterStateChanged()
BluetoothAdapter::SetAdapterState(BluetoothAdapterState aState)
{
if (mState == aState) {
return;
}
mState = aState;
// Fire BluetoothAttributeEvent for changed adapter state
nsTArray<nsString> types;
BT_APPEND_ENUM_STRING(types,
BluetoothAdapterAttribute,
@ -816,10 +818,7 @@ BluetoothAdapter::HandleDeviceFound(const BluetoothValue& aValue)
nsRefPtr<BluetoothDevice> discoveredDevice =
BluetoothDevice::Create(GetOwner(), aValue);
size_t index = mDevices.IndexOf(discoveredDevice,
0, /* aStart */
BluetoothDeviceComparator());
size_t index = mDevices.IndexOf(discoveredDevice);
if (index == mDevices.NoIndex) {
// New device, append it to adapter's device array
mDevices.AppendElement(discoveredDevice);
@ -857,10 +856,7 @@ BluetoothAdapter::HandlePairingRequest(const BluetoothValue& aValue)
BluetoothDevice::Create(GetOwner(), props);
// Find the remote device by address
size_t index = mDevices.IndexOf(device,
0, /* aStart */
BluetoothDeviceComparator());
size_t index = mDevices.IndexOf(device);
if (index == mDevices.NoIndex) {
BT_WARNING("Cannot find the remote device with address %s",
NS_ConvertUTF16toUTF8(deviceAddress).get());
@ -909,14 +905,11 @@ BluetoothAdapter::HandleDevicePaired(const BluetoothValue& aValue)
nsRefPtr<BluetoothDevice> pairedDevice =
BluetoothDevice::Create(GetOwner(), aValue);
size_t index = mDevices.IndexOf(pairedDevice,
0, /* aStart */
BluetoothDeviceComparator());
if (index != mDevices.NoIndex) {
pairedDevice = mDevices[index];
} else {
size_t index = mDevices.IndexOf(pairedDevice);
if (index == mDevices.NoIndex) {
mDevices.AppendElement(pairedDevice);
} else {
pairedDevice = mDevices[index];
}
// Notify application of paired device
@ -939,16 +932,14 @@ BluetoothAdapter::HandleDeviceUnpaired(const BluetoothValue& aValue)
nsRefPtr<BluetoothDevice> unpairedDevice =
BluetoothDevice::Create(GetOwner(), aValue);
size_t index = mDevices.IndexOf(unpairedDevice,
0, /* aStart */
BluetoothDeviceComparator());
size_t index = mDevices.IndexOf(unpairedDevice);
nsString deviceAddress;
if (index != mDevices.NoIndex) {
if (index == mDevices.NoIndex) {
unpairedDevice->GetAddress(deviceAddress);
} else {
mDevices[index]->GetAddress(deviceAddress);
mDevices.RemoveElementAt(index);
} else {
unpairedDevice->GetAddress(deviceAddress);
}
// Notify application of unpaired device

View File

@ -7,12 +7,12 @@
#ifndef mozilla_dom_bluetooth_bluetoothadapter_h__
#define mozilla_dom_bluetooth_bluetoothadapter_h__
#include "BluetoothCommon.h"
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/BluetoothAdapter2Binding.h"
#include "mozilla/dom/BluetoothDeviceEvent.h"
#include "mozilla/dom/Promise.h"
#include "BluetoothCommon.h"
#include "nsCOMPtr.h"
namespace mozilla {
@ -27,9 +27,9 @@ BEGIN_BLUETOOTH_NAMESPACE
class BluetoothDevice;
class BluetoothDiscoveryHandle;
class BluetoothSignal;
class BluetoothNamedValue;
class BluetoothPairingListener;
class BluetoothSignal;
class BluetoothValue;
class BluetoothAdapter : public DOMEventTargetHelper
@ -37,19 +37,12 @@ class BluetoothAdapter : public DOMEventTargetHelper
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BluetoothAdapter,
DOMEventTargetHelper)
static already_AddRefed<BluetoothAdapter>
Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
void Notify(const BluetoothSignal& aParam);
void SetPropertyByValue(const BluetoothNamedValue& aValue);
virtual void DisconnectFromOwner() MOZ_OVERRIDE;
/****************************************************************************
* Attribute Getters
***************************************************************************/
BluetoothAdapterState State() const
{
return mState;
@ -83,27 +76,32 @@ public:
return mPairingReqs;
}
/**
* Update this adapter's discovery handle in use (mDiscoveryHandleInUse).
*
* |mDiscoveryHandleInUse| is set to the latest discovery handle when adapter
* just starts discovery, and is reset to nullptr when discovery is stopped
* by some adapter.
*
* @param aDiscoveryHandle [in] the discovery handle to set.
*/
void SetDiscoveryHandleInUse(BluetoothDiscoveryHandle* aDiscoveryHandle);
/****************************************************************************
* Event Handlers
***************************************************************************/
IMPL_EVENT_HANDLER(attributechanged);
IMPL_EVENT_HANDLER(devicepaired);
IMPL_EVENT_HANDLER(deviceunpaired);
IMPL_EVENT_HANDLER(a2dpstatuschanged);
IMPL_EVENT_HANDLER(hfpstatuschanged);
IMPL_EVENT_HANDLER(requestmediaplaystatus);
IMPL_EVENT_HANDLER(scostatuschanged);
/****************************************************************************
* Methods (Web API Implementation)
***************************************************************************/
already_AddRefed<Promise> Enable(ErrorResult& aRv);
already_AddRefed<Promise> Disable(ErrorResult& aRv);
already_AddRefed<Promise> SetName(const nsAString& aName, ErrorResult& aRv);
already_AddRefed<Promise>
SetDiscoverable(bool aDiscoverable, ErrorResult& aRv);
already_AddRefed<Promise> SetDiscoverable(bool aDiscoverable,
ErrorResult& aRv);
already_AddRefed<Promise> StartDiscovery(ErrorResult& aRv);
already_AddRefed<Promise> StopDiscovery(ErrorResult& aRv);
already_AddRefed<Promise>
Pair(const nsAString& aDeviceAddress, ErrorResult& aRv);
already_AddRefed<Promise>
Unpair(const nsAString& aDeviceAddress, ErrorResult& aRv);
already_AddRefed<Promise> Pair(const nsAString& aDeviceAddress,
ErrorResult& aRv);
already_AddRefed<Promise> Unpair(const nsAString& aDeviceAddress,
ErrorResult& aRv);
/**
* Get a list of paired bluetooth devices.
@ -112,77 +110,115 @@ public:
*/
void GetPairedDevices(nsTArray<nsRefPtr<BluetoothDevice> >& aDevices);
already_AddRefed<Promise> EnableDisable(bool aEnable, ErrorResult& aRv);
already_AddRefed<Promise> Enable(ErrorResult& aRv);
already_AddRefed<Promise> Disable(ErrorResult& aRv);
// Connection related methods
already_AddRefed<DOMRequest>
Connect(BluetoothDevice& aDevice,
const Optional<short unsigned int>& aServiceUuid, ErrorResult& aRv);
const Optional<short unsigned int>& aServiceUuid,
ErrorResult& aRv);
already_AddRefed<DOMRequest>
Disconnect(BluetoothDevice& aDevice,
const Optional<short unsigned int>& aServiceUuid,
ErrorResult& aRv);
already_AddRefed<DOMRequest>
GetConnectedDevices(uint16_t aServiceUuid, ErrorResult& aRv);
already_AddRefed<DOMRequest> GetConnectedDevices(uint16_t aServiceUuid,
ErrorResult& aRv);
// OPP file transfer related methods
already_AddRefed<DOMRequest> SendFile(const nsAString& aDeviceAddress,
nsIDOMBlob* aBlob,
ErrorResult& aRv);
already_AddRefed<DOMRequest> StopSendingFile(const nsAString& aDeviceAddress,
ErrorResult& aRv);
already_AddRefed<DOMRequest>
SendFile(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob,
ErrorResult& aRv);
already_AddRefed<DOMRequest>
StopSendingFile(const nsAString& aDeviceAddress, ErrorResult& aRv);
already_AddRefed<DOMRequest>
ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirmation,
ConfirmReceivingFile(const nsAString& aDeviceAddress,
bool aConfirmation,
ErrorResult& aRv);
// SCO related methods
already_AddRefed<DOMRequest> ConnectSco(ErrorResult& aRv);
already_AddRefed<DOMRequest> DisconnectSco(ErrorResult& aRv);
already_AddRefed<DOMRequest> IsScoConnected(ErrorResult& aRv);
// Handfree CDMA related methods
already_AddRefed<DOMRequest> AnswerWaitingCall(ErrorResult& aRv);
already_AddRefed<DOMRequest> IgnoreWaitingCall(ErrorResult& aRv);
already_AddRefed<DOMRequest> ToggleCalls(ErrorResult& aRv);
// AVRCP related methods
already_AddRefed<DOMRequest>
SendMediaMetaData(const MediaMetaData& aMediaMetaData, ErrorResult& aRv);
already_AddRefed<DOMRequest>
SendMediaPlayStatus(const MediaPlayStatus& aMediaPlayStatus, ErrorResult& aRv);
SendMediaPlayStatus(const MediaPlayStatus& aMediaPlayStatus,
ErrorResult& aRv);
IMPL_EVENT_HANDLER(a2dpstatuschanged);
IMPL_EVENT_HANDLER(hfpstatuschanged);
IMPL_EVENT_HANDLER(requestmediaplaystatus);
IMPL_EVENT_HANDLER(scostatuschanged);
IMPL_EVENT_HANDLER(attributechanged);
IMPL_EVENT_HANDLER(devicepaired);
IMPL_EVENT_HANDLER(deviceunpaired);
/****************************************************************************
* Others
***************************************************************************/
static already_AddRefed<BluetoothAdapter>
Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
void Notify(const BluetoothSignal& aParam); // BluetoothSignalObserver
nsPIDOMWindow* GetParentObject() const
{
return GetOwner();
}
virtual JSObject*
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
virtual void DisconnectFromOwner() MOZ_OVERRIDE;
/**
* Set this adapter's discovery handle in use (mDiscoveryHandleInUse).
*
* |mDiscoveryHandleInUse| is set to the latest discovery handle when adapter
* just starts discovery, and is reset to nullptr when discovery is stopped
* by some adapter.
*
* @param aDiscoveryHandle [in] Discovery handle to set.
*/
void SetDiscoveryHandleInUse(BluetoothDiscoveryHandle* aDiscoveryHandle);
private:
BluetoothAdapter(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
~BluetoothAdapter();
already_AddRefed<Promise>
PairUnpair(bool aPair, const nsAString& aDeviceAddress, ErrorResult& aRv);
/**
* Set adapter properties according to properties array
*
* @param aValue [in] Properties array to set with
*/
void SetPropertyByValue(const BluetoothNamedValue& aValue);
bool IsAdapterAttributeChanged(BluetoothAdapterAttribute aType,
const BluetoothValue& aValue);
void HandleAdapterStateChanged();
void HandlePropertyChanged(const BluetoothValue& aValue);
void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
BluetoothAdapterAttribute
ConvertStringToAdapterAttribute(const nsAString& aString);
/**
* Set adapter state and fire BluetoothAttributeEvent if state changed.
*
* @param aState [in] The new adapter state
*/
void SetAdapterState(BluetoothAdapterState aState);
/**
* Pair/Unpair adapter to device of given address.
* This function is called by methods Enable() and Disable().
*
* @param aPair [in] Whether to pair or unpair adapter to device.
* @param aDeviceAddress [in] Address of device to pair/unpair.
* @param aRv [out] Error result to set in case of error.
*/
already_AddRefed<Promise> PairUnpair(bool aPair,
const nsAString& aDeviceAddress,
ErrorResult& aRv);
/**
* Retrieve properties of paired devices.
*
* @param aDeviceAddresses [in] Addresses array of paired devices
*/
void GetPairedDeviceProperties(const nsTArray<nsString>& aDeviceAddresses);
void HandleDeviceFound(const BluetoothValue& aValue);
void HandlePairingRequest(const BluetoothValue& aValue);
/**
* Handle "PropertyChanged" bluetooth signal.
*
* @param aValue [in] Array of changed properties
*/
void HandlePropertyChanged(const BluetoothValue& aValue);
/**
* Handle DEVICE_PAIRED_ID bluetooth signal.
@ -204,6 +240,25 @@ private:
*/
void HandleDeviceUnpaired(const BluetoothValue& aValue);
/**
* Handle "DeviceFound" bluetooth signal.
*
* @param aValue [in] Properties array of the discovered device.
*/
void HandleDeviceFound(const BluetoothValue& aValue);
/**
* Handle "PairingRequest" bluetooth signal.
*
* @param aValue [in] Array of information about the pairing request.
*/
void HandlePairingRequest(const BluetoothValue& aValue);
/**
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
*/
void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
/**
* Fire BluetoothDeviceEvent to trigger
* ondeviceparied/ondeviceunpaired event handler.
@ -215,8 +270,67 @@ private:
const BluetoothDeviceEventInit& aInit);
/**
* mDevices holds references of all created device objects.
* It is an empty array when the adapter state is disabled.
* Convert string to BluetoothAdapterAttribute.
*
* @param aString [in] String to convert
*/
BluetoothAdapterAttribute
ConvertStringToAdapterAttribute(const nsAString& aString);
/**
* Check whether value of given adapter property has changed.
*
* @param aType [in] Adapter property to check
* @param aValue [in] New value of the adapter property
*/
bool IsAdapterAttributeChanged(BluetoothAdapterAttribute aType,
const BluetoothValue& aValue);
/****************************************************************************
* Variables
***************************************************************************/
/**
* Current state of this adapter. Can be Disabled/Disabling/Enabled/Enabling.
*/
BluetoothAdapterState mState;
/**
* BD address of this adapter.
*/
nsString mAddress;
/**
* Human-readable name of this adapter.
*/
nsString mName;
/**
* Whether this adapter can be discovered by nearby devices.
*/
bool mDiscoverable;
/**
* Whether this adapter is discovering nearby devices.
*/
bool mDiscovering;
/**
* Handle to fire pairing requests of different pairing types.
*/
nsRefPtr<BluetoothPairingListener> mPairingReqs;
/**
* Handle to fire 'ondevicefound' event handler for discovered device.
*
* This variable is set to the latest discovery handle when adapter just
* starts discovery, and is reset to nullptr when discovery is stopped by
* some adapter.
*/
nsRefPtr<BluetoothDiscoveryHandle> mDiscoveryHandleInUse;
/**
* Arrays of references to BluetoothDevices created by this adapter.
* This array is empty when adapter state is Disabled.
*
* Devices will be appended when
* 1) Enabling BT: Paired devices reported by stack.
@ -230,13 +344,6 @@ private:
* 2) Disabling BT: All devices will be removed.
*/
nsTArray<nsRefPtr<BluetoothDevice> > mDevices;
nsRefPtr<BluetoothDiscoveryHandle> mDiscoveryHandleInUse;
nsRefPtr<BluetoothPairingListener> mPairingReqs;
BluetoothAdapterState mState;
nsString mAddress;
nsString mName;
bool mDiscoverable;
bool mDiscovering;
};
END_BLUETOOTH_NAMESPACE

View File

@ -27,7 +27,7 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(BluetoothDevice, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(BluetoothDevice, DOMEventTargetHelper)
class FetchUuidsTask : public BluetoothReplyRunnable
class FetchUuidsTask MOZ_FINAL : public BluetoothReplyRunnable
{
public:
FetchUuidsTask(Promise* aPromise,

View File

@ -33,15 +33,12 @@ class BluetoothDevice MOZ_FINAL : public DOMEventTargetHelper
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(BluetoothDevice,
DOMEventTargetHelper)
static already_AddRefed<BluetoothDevice>
Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
void Notify(const BluetoothSignal& aParam);
/****************************************************************************
* Attribute Getters
***************************************************************************/
void GetAddress(nsString& aAddress) const
{
aAddress = mAddress;
@ -62,27 +59,28 @@ public:
return mPaired;
}
void GetUuids(nsTArray<nsString>& aUuids) {
void GetUuids(nsTArray<nsString>& aUuids) const
{
aUuids = mUuids;
}
already_AddRefed<Promise> FetchUuids(ErrorResult& aRv);
void SetPropertyByValue(const BluetoothNamedValue& aValue);
BluetoothDeviceAttribute
ConvertStringToDeviceAttribute(const nsAString& aString);
bool
IsDeviceAttributeChanged(BluetoothDeviceAttribute aType,
const BluetoothValue& aValue);
void HandlePropertyChanged(const BluetoothValue& aValue);
void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
/****************************************************************************
* Event Handlers
***************************************************************************/
IMPL_EVENT_HANDLER(attributechanged);
/****************************************************************************
* Methods (Web API Implementation)
***************************************************************************/
already_AddRefed<Promise> FetchUuids(ErrorResult& aRv);
/****************************************************************************
* Others
***************************************************************************/
static already_AddRefed<BluetoothDevice>
Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
void Notify(const BluetoothSignal& aParam); // BluetoothSignalObserver
nsPIDOMWindow* GetParentObject() const
{
return GetOwner();
@ -91,16 +89,83 @@ public:
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
virtual void DisconnectFromOwner() MOZ_OVERRIDE;
/**
* Override operator== for device comparison
*/
bool operator==(BluetoothDevice& aDevice) const
{
nsString address;
aDevice.GetAddress(address);
return mAddress.Equals(address);
}
private:
BluetoothDevice(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
~BluetoothDevice();
nsString mAddress;
nsRefPtr<BluetoothClassOfDevice> mCod;
nsString mName;
bool mPaired;
nsTArray<nsString> mUuids;
/**
* Set device properties according to properties array
*
* @param aValue [in] Properties array to set with
*/
void SetPropertyByValue(const BluetoothNamedValue& aValue);
/**
* Handle "PropertyChanged" bluetooth signal.
*
* @param aValue [in] Array of changed properties
*/
void HandlePropertyChanged(const BluetoothValue& aValue);
/**
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
*/
void DispatchAttributeEvent(const nsTArray<nsString>& aTypes);
/**
* Convert string to BluetoothDeviceAttribute.
*
* @param aString [in] String to convert
*/
BluetoothDeviceAttribute
ConvertStringToDeviceAttribute(const nsAString& aString);
/**
* Check whether value of given device property has changed.
*
* @param aType [in] Device property to check
* @param aValue [in] New value of the device property
*/
bool IsDeviceAttributeChanged(BluetoothDeviceAttribute aType,
const BluetoothValue& aValue);
/****************************************************************************
* Variables
***************************************************************************/
/**
* BD address of this device.
*/
nsString mAddress;
/**
* Class of device (CoD) that describes this device's capabilities.
*/
nsRefPtr<BluetoothClassOfDevice> mCod;
/**
* Human-readable name of this device.
*/
nsString mName;
/**
* Whether this device is paired or not.
*/
bool mPaired;
/**
* Cached UUID list of services which this device provides.
*/
nsTArray<nsString> mUuids;
};
END_BLUETOOTH_NAMESPACE

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