зеркало из https://github.com/mozilla/gecko-dev.git
Merge from mozilla-central.
This commit is contained in:
Коммит
2bd51e6b5d
|
@ -74,7 +74,7 @@ static const NSString* AXRoles [] = {
|
|||
NSAccessibilityGroupRole, // ROLE_CELL
|
||||
@"AXLink", // ROLE_LINK. 10.4+ the attr first define in SDK 10.4, so we define it here too. ROLE_LINK
|
||||
@"AXHelpTag", // ROLE_HELPBALLOON
|
||||
NSAccessibilityUnknownRole, // ROLE_CHARACTER. unusued on OS X
|
||||
NSAccessibilityUnknownRole, // ROLE_CHARACTER. unused on OS X
|
||||
NSAccessibilityListRole, // ROLE_LIST
|
||||
NSAccessibilityRowRole, // ROLE_LISTITEM
|
||||
NSAccessibilityOutlineRole, // ROLE_OUTLINE
|
||||
|
|
|
@ -31,6 +31,8 @@ const EVENT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_VALUE_CHANGE;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// General
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/**
|
||||
* Set up this variable to dump events into DOM.
|
||||
*/
|
||||
|
@ -1414,12 +1416,6 @@ var gA11yEventApplicantsCount = 0;
|
|||
|
||||
var gA11yEventObserver =
|
||||
{
|
||||
// The service reference needs to live in the observer, instead of as a global var,
|
||||
// to be available in observe() catch case too.
|
||||
observerService :
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(nsIObserverService),
|
||||
|
||||
observe: function observe(aSubject, aTopic, aData)
|
||||
{
|
||||
if (aTopic != "accessible-event")
|
||||
|
@ -1431,7 +1427,7 @@ var gA11yEventObserver =
|
|||
} catch (ex) {
|
||||
// After a test is aborted (i.e. timed out by the harness), this exception is soon triggered.
|
||||
// Remove the leftover observer, otherwise it "leaks" to all the following tests.
|
||||
this.observerService.removeObserver(this, "accessible-event");
|
||||
Services.obs.removeObserver(this, "accessible-event");
|
||||
// Forward the exception, with added explanation.
|
||||
throw "[accessible/events.js, gA11yEventObserver.observe] This is expected if a previous test has been aborted... Initial exception was: [ " + ex + " ]";
|
||||
}
|
||||
|
@ -1485,14 +1481,12 @@ function listenA11yEvents(aStartToListen)
|
|||
if (aStartToListen) {
|
||||
// Add observer when adding the first applicant only.
|
||||
if (!(gA11yEventApplicantsCount++))
|
||||
gA11yEventObserver.observerService
|
||||
.addObserver(gA11yEventObserver, "accessible-event", false);
|
||||
Services.obs.addObserver(gA11yEventObserver, "accessible-event", false);
|
||||
} else {
|
||||
// Remove observer when there are no more applicants only.
|
||||
// '< 0' case should not happen, but just in case: removeObserver() will throw.
|
||||
if (--gA11yEventApplicantsCount <= 0)
|
||||
gA11yEventObserver.observerService
|
||||
.removeObserver(gA11yEventObserver, "accessible-event");
|
||||
Services.obs.removeObserver(gA11yEventObserver, "accessible-event");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1609,11 +1603,8 @@ var gLogger =
|
|||
logToAppConsole: function logger_logToAppConsole(aMsg)
|
||||
{
|
||||
if (gA11yEventDumpToAppConsole)
|
||||
consoleService.logStringMessage("events: " + aMsg);
|
||||
},
|
||||
|
||||
consoleService: Components.classes["@mozilla.org/consoleservice;1"].
|
||||
getService(Components.interfaces.nsIConsoleService)
|
||||
Services.console.logStringMessage("events: " + aMsg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<!-- Firefox searchbar -->
|
||||
<?xml-stylesheet href="chrome://browser/content/browser.css"
|
||||
type="text/css"?>
|
||||
<!-- SeaMonkey searchbar -->
|
||||
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
|
||||
type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="Accessible focus event testing">
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/browser.css"
|
||||
type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="Accessible focus testing">
|
||||
|
||||
|
|
|
@ -2,8 +2,13 @@
|
|||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
<!-- Firefox searchbar -->
|
||||
<?xml-stylesheet href="chrome://browser/content/browser.css"
|
||||
type="text/css"?>
|
||||
<!-- SeaMonkey searchbar -->
|
||||
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
|
||||
type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="Expanded state change events tests for comboboxes and autocompletes.">
|
||||
|
|
|
@ -1041,6 +1041,7 @@ pref("devtools.scratchpad.enabled", true);
|
|||
|
||||
// Enable the Style Editor.
|
||||
pref("devtools.styleeditor.enabled", true);
|
||||
pref("devtools.styleeditor.transitions", true);
|
||||
|
||||
// Enable tools for Chrome development.
|
||||
pref("devtools.chrome.enabled", false);
|
||||
|
|
|
@ -43,7 +43,8 @@ function test() {
|
|||
}
|
||||
|
||||
function afterZoomAndLoad(cb) {
|
||||
let didLoad = didZoom = false;
|
||||
let didLoad = false;
|
||||
let didZoom = false;
|
||||
tabElm.linkedBrowser.addEventListener("load", function() {
|
||||
tabElm.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
didLoad = true;
|
||||
|
|
|
@ -37,7 +37,8 @@ const TEST_PAGE = "/browser/browser/base/content/test/dummy_page.html";
|
|||
var gTestTab, gBgTab, gTestZoom;
|
||||
|
||||
function afterZoomAndLoad(aCallback, aTab) {
|
||||
let didLoad = didZoom = false;
|
||||
let didLoad = false;
|
||||
let didZoom = false;
|
||||
aTab.linkedBrowser.addEventListener("load", function() {
|
||||
aTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
didLoad = true;
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
const TESTROOT = "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
|
||||
|
||||
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm");
|
||||
var tempScope = {};
|
||||
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", tempScope);
|
||||
var LightweightThemeManager = tempScope.LightweightThemeManager;
|
||||
|
||||
function wait_for_notification(aCallback) {
|
||||
PopupNotifications.panel.addEventListener("popupshown", function() {
|
||||
|
|
|
@ -43,6 +43,8 @@ https://example.com/browser/browser/base/content/test/redirect_bug623155.sjs#FG
|
|||
|
||||
*/
|
||||
|
||||
var gNewTab;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ function test_latchedGesture(gesture, inc, dec, eventPrefix)
|
|||
|
||||
// Restore the gesture to its original configuration.
|
||||
gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
|
||||
for (dir in cmd)
|
||||
for (let dir in cmd)
|
||||
test_removeCommand(cmd[dir]);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ var tests = [
|
|||
},
|
||||
]
|
||||
|
||||
let gCurrentTest, gCurrentTestIndex = -1;
|
||||
let gCurrentTest, gCurrentTestIndex = -1, gTestDesc;
|
||||
// Go through the tests in both directions, to add additional coverage for
|
||||
// transitions between different states.
|
||||
let gForward = true;
|
||||
|
|
|
@ -59,6 +59,23 @@ const UPDATE_STYLESHEET_THROTTLE_DELAY = 500;
|
|||
// @see StyleEditor._persistExpando
|
||||
const STYLESHEET_EXPANDO = "-moz-styleeditor-stylesheet-";
|
||||
|
||||
const TRANSITIONS_PREF = "devtools.styleeditor.transitions";
|
||||
|
||||
const TRANSITION_CLASS = "moz-styleeditor-transitioning";
|
||||
const TRANSITION_DURATION_MS = 500;
|
||||
const TRANSITION_RULE = "\
|
||||
:root.moz-styleeditor-transitioning, :root.moz-styleeditor-transitioning * {\
|
||||
-moz-transition-duration: " + TRANSITION_DURATION_MS + "ms !important; \
|
||||
-moz-transition-delay: 0ms !important;\
|
||||
-moz-transition-timing-function: ease-out !important;\
|
||||
-moz-transition-property: all !important;\
|
||||
}";
|
||||
|
||||
/**
|
||||
* Style Editor module-global preferences
|
||||
*/
|
||||
const TRANSITIONS_ENABLED = Services.prefs.getBoolPref(TRANSITIONS_PREF);
|
||||
|
||||
|
||||
/**
|
||||
* StyleEditor constructor.
|
||||
|
@ -107,6 +124,9 @@ function StyleEditor(aDocument, aStyleSheet)
|
|||
|
||||
// this is to perform pending updates before editor closing
|
||||
this._onWindowUnloadBinding = this._onWindowUnload.bind(this);
|
||||
|
||||
this._transitionRefCount = 0;
|
||||
|
||||
this._focusOnSourceEditorReady = false;
|
||||
}
|
||||
|
||||
|
@ -405,8 +425,13 @@ StyleEditor.prototype = {
|
|||
* Arguments: (StyleEditor editor)
|
||||
* @see inputElement
|
||||
*
|
||||
* onCommit: Called when changes have been committed/applied
|
||||
* to the live DOM style sheet.
|
||||
* onUpdate: Called when changes are being applied to the live
|
||||
* DOM style sheet but might not be complete from
|
||||
* a WYSIWYG perspective (eg. transitioned update).
|
||||
* Arguments: (StyleEditor editor)
|
||||
*
|
||||
* onCommit: Called when changes have been completely committed
|
||||
* /applied to the live DOM style sheet.
|
||||
* Arguments: (StyleEditor editor)
|
||||
* }
|
||||
*
|
||||
|
@ -640,15 +665,50 @@ StyleEditor.prototype = {
|
|||
let source = this._state.text;
|
||||
let oldNode = this.styleSheet.ownerNode;
|
||||
let oldIndex = this.styleSheetIndex;
|
||||
|
||||
let newNode = this.contentDocument.createElement("style");
|
||||
let content = this.contentDocument;
|
||||
let newNode = content.createElement("style");
|
||||
newNode.setAttribute("type", "text/css");
|
||||
newNode.appendChild(this.contentDocument.createTextNode(source));
|
||||
newNode.appendChild(content.createTextNode(source));
|
||||
oldNode.parentNode.replaceChild(newNode, oldNode);
|
||||
|
||||
this._styleSheet = this.contentDocument.styleSheets[oldIndex];
|
||||
this._styleSheet = content.styleSheets[oldIndex];
|
||||
this._persistExpando();
|
||||
|
||||
if (!TRANSITIONS_ENABLED) {
|
||||
this._triggerAction("Update");
|
||||
this._triggerAction("Commit");
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert the global transition rule
|
||||
// Use a ref count to make sure we do not add it multiple times.. and remove
|
||||
// it only when all pending StyleEditor-generated transitions ended.
|
||||
if (!this._transitionRefCount) {
|
||||
this._styleSheet.insertRule(TRANSITION_RULE, 0);
|
||||
content.documentElement.classList.add(TRANSITION_CLASS);
|
||||
}
|
||||
|
||||
this._transitionRefCount++;
|
||||
|
||||
// Set up clean up and commit after transition duration (+10% buffer)
|
||||
// @see _onTransitionEnd
|
||||
content.defaultView.setTimeout(this._onTransitionEnd.bind(this),
|
||||
Math.floor(TRANSITION_DURATION_MS * 1.1));
|
||||
|
||||
this._triggerAction("Update");
|
||||
},
|
||||
|
||||
/**
|
||||
* This cleans up class and rule added for transition effect and then trigger
|
||||
* Commit as the changes have been completed.
|
||||
*/
|
||||
_onTransitionEnd: function SE__onTransitionEnd()
|
||||
{
|
||||
if (--this._transitionRefCount == 0) {
|
||||
this.contentDocument.documentElement.classList.remove(TRANSITION_CLASS);
|
||||
this.styleSheet.deleteRule(0);
|
||||
}
|
||||
|
||||
this._triggerAction("Commit");
|
||||
},
|
||||
|
||||
|
|
|
@ -156,11 +156,14 @@ StyleEditorChrome.prototype = {
|
|||
aContentWindow.addEventListener("unload", onContentUnload, false);
|
||||
|
||||
if (aContentWindow.document.readyState == "complete") {
|
||||
this._root.classList.remove("loading");
|
||||
this._populateChrome();
|
||||
return;
|
||||
} else {
|
||||
this._root.classList.add("loading");
|
||||
let onContentReady = function () {
|
||||
aContentWindow.removeEventListener("load", onContentReady, false);
|
||||
this._root.classList.remove("loading");
|
||||
this._populateChrome();
|
||||
}.bind(this);
|
||||
aContentWindow.addEventListener("load", onContentReady, false);
|
||||
|
@ -299,7 +302,7 @@ StyleEditorChrome.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Reset the chrome UI to an empty state.
|
||||
* Reset the chrome UI to an empty and ready state.
|
||||
*/
|
||||
_resetChrome: function SEC__resetChrome()
|
||||
{
|
||||
|
@ -309,6 +312,12 @@ StyleEditorChrome.prototype = {
|
|||
this._editors = [];
|
||||
|
||||
this._view.removeAll();
|
||||
|
||||
// (re)enable UI
|
||||
let matches = this._root.querySelectorAll("toolbarbutton,input,select");
|
||||
for (let i = 0; i < matches.length; ++i) {
|
||||
matches[i].removeAttribute("disabled");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,10 @@ box,
|
|||
-moz-box-pack: center;
|
||||
}
|
||||
|
||||
.loading .splitview-nav-container > .placeholder {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.splitview-controller,
|
||||
.splitview-main {
|
||||
-moz-box-flex: 0;
|
||||
|
|
|
@ -54,18 +54,20 @@
|
|||
persist="screenX screenY width height sizemode">
|
||||
<xul:script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<xul:box id="style-editor-chrome" class="splitview-root">
|
||||
<xul:box id="style-editor-chrome" class="splitview-root loading">
|
||||
<xul:box class="splitview-controller" id="stylesheets-controller" persist="width height">
|
||||
<xul:box class="splitview-main">
|
||||
<xul:toolbar class="devtools-toolbar">
|
||||
<xul:toolbarbutton class="style-editor-newButton devtools-toolbarbutton"
|
||||
accesskey="&newButton.accesskey;"
|
||||
tooltiptext="&newButton.tooltip;"
|
||||
label="&newButton.label;"/>
|
||||
label="&newButton.label;"
|
||||
disabled="true"/>
|
||||
<xul:toolbarbutton class="style-editor-importButton devtools-toolbarbutton"
|
||||
accesskey="&importButton.accesskey;"
|
||||
tooltiptext="&importButton.tooltip;"
|
||||
label="&importButton.label;"/>
|
||||
label="&importButton.label;"
|
||||
disabled="true"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:textbox class="splitview-filter devtools-searchinput"
|
||||
type="search" flex="1"
|
||||
|
|
|
@ -18,6 +18,18 @@ function test()
|
|||
isnot(gBrowser.selectedBrowser.contentWindow.document.readyState, "complete",
|
||||
"content document is still loading");
|
||||
|
||||
let root = gChromeWindow.document.querySelector(".splitview-root");
|
||||
ok(root.classList.contains("loading"),
|
||||
"style editor root element has 'loading' class name");
|
||||
|
||||
let button = gChromeWindow.document.querySelector(".style-editor-newButton");
|
||||
ok(button.hasAttribute("disabled"),
|
||||
"new style sheet button is disabled");
|
||||
|
||||
button = gChromeWindow.document.querySelector(".style-editor-importButton");
|
||||
ok(button.hasAttribute("disabled"),
|
||||
"import button is disabled");
|
||||
|
||||
if (!aChrome.isContentAttached) {
|
||||
aChrome.addChromeListener({
|
||||
onContentAttach: run
|
||||
|
@ -35,5 +47,17 @@ function run(aChrome)
|
|||
is(aChrome.contentWindow.document.readyState, "complete",
|
||||
"content document is complete");
|
||||
|
||||
let root = gChromeWindow.document.querySelector(".splitview-root");
|
||||
ok(!root.classList.contains("loading"),
|
||||
"style editor root element does not have 'loading' class name anymore");
|
||||
|
||||
let button = gChromeWindow.document.querySelector(".style-editor-newButton");
|
||||
ok(!button.hasAttribute("disabled"),
|
||||
"new style sheet button is enabled");
|
||||
|
||||
button = gChromeWindow.document.querySelector(".style-editor-importButton");
|
||||
ok(!button.hasAttribute("disabled"),
|
||||
"import button is enabled");
|
||||
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
const TESTCASE_URI = TEST_BASE + "simple.html";
|
||||
|
||||
const TRANSITION_CLASS = "moz-styleeditor-transitioning";
|
||||
|
||||
|
||||
function test()
|
||||
{
|
||||
|
@ -30,6 +32,7 @@ function run(aChrome)
|
|||
|
||||
let gAddedCount = 0; // to add new stylesheet after the 2 initial stylesheets
|
||||
let gNewEditor; // to make sure only one new stylesheet got created
|
||||
let gUpdateCount = 0; // to make sure only one Update event is triggered
|
||||
let gCommitCount = 0; // to make sure only one Commit event is triggered
|
||||
|
||||
function testEditorAdded(aChrome, aEditor)
|
||||
|
@ -82,6 +85,13 @@ function testEditorAdded(aChrome, aEditor)
|
|||
}, gChromeWindow) ;
|
||||
},
|
||||
|
||||
onUpdate: function (aEditor) {
|
||||
gUpdateCount++;
|
||||
|
||||
ok(content.document.documentElement.classList.contains(TRANSITION_CLASS),
|
||||
"StyleEditor's transition class has been added to content");
|
||||
},
|
||||
|
||||
onCommit: function (aEditor) {
|
||||
gCommitCount++;
|
||||
|
||||
|
@ -99,7 +109,11 @@ function testEditorAdded(aChrome, aEditor)
|
|||
is(computedStyle.backgroundColor, "rgb(255, 0, 0)",
|
||||
"content's background color has been updated to red");
|
||||
|
||||
ok(!content.document.documentElement.classList.contains(TRANSITION_CLASS),
|
||||
"StyleEditor's transition class has been removed from content");
|
||||
|
||||
executeSoon(function () {
|
||||
is(gUpdateCount, 1, "received only one Update event (throttle)");
|
||||
is(gCommitCount, 1, "received only one Commit event (throttle)");
|
||||
|
||||
aEditor.removeActionListener(listener);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_REPLACED_API_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console-replaced-api.html";
|
||||
const TEST_REPLACED_API_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-replaced-api.html";
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
// Tests that the page's resources are displayed in the console as they're
|
||||
// loaded
|
||||
|
||||
const TEST_NETWORK_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-network.html" + "?_date=" + Date.now();
|
||||
const TEST_NETWORK_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network.html" + "?_date=" + Date.now();
|
||||
|
||||
function test() {
|
||||
addTab("data:text/html,Web Console basic network logging test");
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Tests that the console object still exists after a page reload.
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
// Tests that errors still show up in the Web Console after a page reload.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-error.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-error.html";
|
||||
|
||||
function test() {
|
||||
expectUncaughtException();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
Cu.import("resource:///modules/HUDService.jsm");
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// Tests that the Web Console close button functions.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// Tests that the Web Console limits the number of lines displayed according to
|
||||
// the user's preferences.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-585956-console-trace.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-585956-console-trace.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
// Tests that adding text to one of the output labels doesn't cause errors.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-593003-iframe-wrong-hud.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html";
|
||||
|
||||
const TEST_IFRAME_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-593003-iframe-wrong-hud-iframe.html";
|
||||
const TEST_IFRAME_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html";
|
||||
|
||||
const TEST_DUMMY_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_DUMMY_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
let tab1, tab2;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
let tab1, tab2, win1, win2;
|
||||
let noErrors = true;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-network.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network.html";
|
||||
|
||||
function tabLoad(aEvent) {
|
||||
browser.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-597756-reopen-closed-tab.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html";
|
||||
|
||||
let newTabIsOpen = false;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-599725-response-headers.sjs";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs";
|
||||
|
||||
let lastFinishedRequest = null;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-600183-charset.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-600183-charset.html";
|
||||
|
||||
let lastFinishedRequest = null;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-601177-log-levels.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-601177-log-levels.html";
|
||||
|
||||
let msgs;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-603750-websocket.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-603750-websocket.html";
|
||||
const pref_ws = "network.websocket.enabled";
|
||||
const pref_block = "network.websocket.override-security-block";
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-613013-console-api-iframe.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html";
|
||||
|
||||
let TestObserver = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*/
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-630733-response-redirect-headers.sjs";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs";
|
||||
|
||||
let lastFinishedRequests = {};
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
// Tests that network log messages bring up the network panel.
|
||||
|
||||
const TEST_NETWORK_REQUEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-network-request.html";
|
||||
const TEST_NETWORK_REQUEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network-request.html";
|
||||
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test//test-image.png";
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
|
||||
|
||||
const TEST_DATA_JSON_CONTENT =
|
||||
'{ id: "test JSON data", myArray: [ "foo", "bar", "baz", "biff" ] }';
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
// Tests that the basic console.log()-style APIs and filtering work.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console-extras.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-extras.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
// Tests that the message type filter checkboxes work.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
// Tests that the text filter box works.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
// Tests that console logging via the console API produces nodes of the correct
|
||||
// CSS classes.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
// Tests that network log messages bring up the network panel.
|
||||
|
||||
const TEST_NETWORK_REQUEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-network-request.html";
|
||||
const TEST_NETWORK_REQUEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network-request.html";
|
||||
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test//test-image.png";
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
|
||||
|
||||
const TEST_DATA_JSON_CONTENT =
|
||||
'{ id: "test JSON data", myArray: [ "foo", "bar", "baz", "biff" ] }';
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
|
||||
// Tests that the network panel works.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test//test-image.png";
|
||||
const TEST_ENCODING_ISO_8859_1 = "http://example.com/browser/browser/devtools/webconsole/test//test-encoding-ISO-8859-1.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
|
||||
const TEST_ENCODING_ISO_8859_1 = "http://example.com/browser/browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html";
|
||||
|
||||
let testDriver;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
// Tests that the HUD service keeps an accurate registry of all the Web Console
|
||||
// instances.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Tests that source URLs in the Web Console can be clicked to display the
|
||||
// standard View Source window.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-error.html";
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-error.html";
|
||||
|
||||
function test() {
|
||||
expectUncaughtException();
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
<body>
|
||||
<p>WebConsole test: iframe associated to the wrong HUD.</p>
|
||||
<iframe
|
||||
src="http://example.com/browser/browser/devtools/webconsole/test//test-bug-593003-iframe-wrong-hud-iframe.html"></iframe>
|
||||
src="http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<h1>Heads Up Display HTTP Logging Testpage</h1>
|
||||
<h2>This page is used to test the HTTP logging.</h2>
|
||||
|
||||
<form action="http://example.com/browser/browser/devtools/webconsole/test//test-network-request.html" method="post">
|
||||
<form action="http://example.com/browser/browser/devtools/webconsole/test/test-network-request.html" method="post">
|
||||
<input name="name" type="text" value="foo bar"><br>
|
||||
<input name="age" type="text" value="144"><br>
|
||||
</form>
|
||||
|
|
|
@ -92,6 +92,10 @@ ifneq (,$(filter aurora beta,$(MOZ_UPDATE_CHANNEL)))
|
|||
DEFINES += -DSHIP_FEEDBACK=1
|
||||
endif
|
||||
|
||||
ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
|
||||
DEFINES += -DMOZ_SHARED_MOZGLUE=1
|
||||
endif
|
||||
|
||||
ifdef MOZ_PKG_MANIFEST_P
|
||||
MOZ_PKG_MANIFEST = package-manifest
|
||||
|
||||
|
|
|
@ -49,7 +49,9 @@
|
|||
@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
|
||||
#ifdef MOZ_SHARED_MOZGLUE
|
||||
@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
@BINPATH@/XUL
|
||||
#else
|
||||
|
|
|
@ -932,6 +932,8 @@ xpicleanup@BIN_SUFFIX@
|
|||
#endif
|
||||
components/txEXSLTRegExFunctions.js
|
||||
components/Weave.js
|
||||
components/Webapps.js
|
||||
components/Webapps.manifest
|
||||
components/WebContentConverter.js
|
||||
defaults/autoconfig/platform.js
|
||||
defaults/autoconfig/prefcalls.js
|
||||
|
@ -1057,6 +1059,7 @@ xpicleanup@BIN_SUFFIX@
|
|||
modules/tabview/AllTabs.jsm
|
||||
modules/tabview/groups.jsm
|
||||
modules/tabview/utils.jsm
|
||||
modules/Webapps.jsm
|
||||
modules/WindowDraggingUtils.jsm
|
||||
#ifdef XP_WIN
|
||||
modules/WindowsJumpLists.jsm
|
||||
|
@ -1147,6 +1150,7 @@ xpicleanup@BIN_SUFFIX@
|
|||
components/directory.xpt
|
||||
components/docshell.xpt
|
||||
components/dom.xpt
|
||||
components/dom_apps.xpt
|
||||
components/dom_base.xpt
|
||||
#ifdef MOZ_B2G_RIL
|
||||
components/dom_telephony.xpt
|
||||
|
|
|
@ -41,6 +41,12 @@
|
|||
color: white;
|
||||
}
|
||||
|
||||
.loading .splitview-nav-container {
|
||||
background-image: url(chrome://global/skin/icons/loading_16.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.splitview-nav {
|
||||
-moz-appearance: none;
|
||||
margin: 0;
|
||||
|
@ -70,7 +76,6 @@
|
|||
|
||||
.placeholder {
|
||||
-moz-box-flex: 1;
|
||||
-moz-box-back: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#style-editor-chrome {
|
||||
background-color: hsl(208,11%,27%);
|
||||
}
|
||||
|
||||
.stylesheet-title,
|
||||
.stylesheet-name {
|
||||
text-decoration: none;
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.5 KiB |
|
@ -41,6 +41,12 @@
|
|||
color: white;
|
||||
}
|
||||
|
||||
.loading .splitview-nav-container {
|
||||
background-image: url(chrome://global/skin/icons/loading_16.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.splitview-nav {
|
||||
-moz-appearance: none;
|
||||
margin: 0;
|
||||
|
@ -70,7 +76,6 @@
|
|||
|
||||
.placeholder {
|
||||
-moz-box-flex: 1;
|
||||
-moz-box-back: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#style-editor-chrome {
|
||||
background-color: hsl(208,11%,27%);
|
||||
}
|
||||
|
||||
.stylesheet-title,
|
||||
.stylesheet-name {
|
||||
text-decoration: none;
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.5 KiB |
|
@ -41,6 +41,12 @@
|
|||
color: white;
|
||||
}
|
||||
|
||||
.loading .splitview-nav-container {
|
||||
background-image: url(chrome://global/skin/icons/loading_16.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.splitview-nav {
|
||||
-moz-appearance: none;
|
||||
margin: 0;
|
||||
|
@ -70,7 +76,6 @@
|
|||
|
||||
.placeholder {
|
||||
-moz-box-flex: 1;
|
||||
-moz-box-back: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#style-editor-chrome {
|
||||
background-color: hsl(211,21%,26%);
|
||||
}
|
||||
|
||||
.stylesheet-title,
|
||||
.stylesheet-name {
|
||||
text-decoration: none;
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.7 KiB |
|
@ -1999,6 +1999,7 @@ nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
|
|||
LOG(PR_LOG_DEBUG, ("%p Cloned decoder %p from %p", this, decoder.get(), aOriginal));
|
||||
|
||||
if (!decoder->Init(this)) {
|
||||
LOG(PR_LOG_DEBUG, ("%p Failed to init cloned decoder %p", this, decoder.get()));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -2010,6 +2011,7 @@ nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
|
|||
|
||||
nsMediaStream* stream = originalStream->CloneData(decoder);
|
||||
if (!stream) {
|
||||
LOG(PR_LOG_DEBUG, ("%p Failed to cloned stream for decoder %p", this, decoder.get()));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -2017,6 +2019,7 @@ nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
|
|||
|
||||
nsresult rv = decoder->Load(stream, nsnull, aOriginal);
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(PR_LOG_DEBUG, ("%p Failed to load decoder/stream for decoder %p", this, decoder.get()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,6 +193,7 @@ nsresult nsBuiltinDecoder::Load(nsMediaStream* aStream,
|
|||
|
||||
nsresult rv = aStream->Open(aStreamListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(PR_LOG_DEBUG, ("%p Failed to open stream!", this));
|
||||
delete aStream;
|
||||
return rv;
|
||||
}
|
||||
|
@ -245,6 +246,7 @@ nsresult nsBuiltinDecoder::ScheduleStateMachineThread()
|
|||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
NS_ASSERTION(mDecoderStateMachine,
|
||||
"Must have state machine to start state machine thread");
|
||||
NS_ENSURE_STATE(mDecoderStateMachine);
|
||||
|
||||
if (mShuttingDown)
|
||||
return NS_OK;
|
||||
|
@ -258,6 +260,7 @@ nsresult nsBuiltinDecoder::Play()
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
NS_ASSERTION(mDecoderStateMachine != nsnull, "Should have state machine.");
|
||||
nsresult res = ScheduleStateMachineThread();
|
||||
NS_ENSURE_SUCCESS(res,res);
|
||||
if (mPlayState == PLAY_STATE_SEEKING) {
|
||||
|
@ -832,29 +835,19 @@ void nsBuiltinDecoder::ChangeState(PlayState aState)
|
|||
}
|
||||
|
||||
mPlayState = aState;
|
||||
switch (aState) {
|
||||
case PLAY_STATE_PAUSED:
|
||||
/* No action needed */
|
||||
break;
|
||||
case PLAY_STATE_PLAYING:
|
||||
mDecoderStateMachine->Play();
|
||||
break;
|
||||
case PLAY_STATE_SEEKING:
|
||||
mDecoderStateMachine->Seek(mRequestedSeekTime);
|
||||
mRequestedSeekTime = -1.0;
|
||||
break;
|
||||
case PLAY_STATE_LOADING:
|
||||
/* No action needed */
|
||||
break;
|
||||
case PLAY_STATE_START:
|
||||
/* No action needed */
|
||||
break;
|
||||
case PLAY_STATE_ENDED:
|
||||
/* No action needed */
|
||||
break;
|
||||
case PLAY_STATE_SHUTDOWN:
|
||||
/* No action needed */
|
||||
break;
|
||||
if (mDecoderStateMachine) {
|
||||
switch (aState) {
|
||||
case PLAY_STATE_PLAYING:
|
||||
mDecoderStateMachine->Play();
|
||||
break;
|
||||
case PLAY_STATE_SEEKING:
|
||||
mDecoderStateMachine->Seek(mRequestedSeekTime);
|
||||
mRequestedSeekTime = -1.0;
|
||||
break;
|
||||
default:
|
||||
/* No action needed */
|
||||
break;
|
||||
}
|
||||
}
|
||||
mReentrantMonitor.NotifyAll();
|
||||
}
|
||||
|
@ -973,7 +966,9 @@ void nsBuiltinDecoder::Resume(bool aForceBuffering)
|
|||
}
|
||||
if (aForceBuffering) {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mDecoderStateMachine->StartBuffering();
|
||||
if (mDecoderStateMachine) {
|
||||
mDecoderStateMachine->StartBuffering();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "mozilla/mozalloc.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "nsTimeRanges.h"
|
||||
#include "nsDeque.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StdInt.h"
|
||||
|
@ -229,6 +230,17 @@ public:
|
|||
return mStateMachineThread;
|
||||
}
|
||||
|
||||
// Requests that a decode thread be created for aStateMachine. The thread
|
||||
// may be created immediately, or after some delay, once a thread becomes
|
||||
// available. The request can be cancelled using CancelCreateDecodeThread().
|
||||
// It's the callers responsibility to not call this more than once for any
|
||||
// given state machine.
|
||||
nsresult RequestCreateDecodeThread(nsBuiltinDecoderStateMachine* aStateMachine);
|
||||
|
||||
// Cancels a request made by RequestCreateDecodeThread to create a decode
|
||||
// thread for aStateMachine.
|
||||
nsresult CancelCreateDecodeThread(nsBuiltinDecoderStateMachine* aStateMachine);
|
||||
|
||||
// Maximum number of active decode threads allowed. When more
|
||||
// than this number are active the thread creation will fail.
|
||||
static const PRUint32 MAX_DECODE_THREADS = 25;
|
||||
|
@ -238,16 +250,17 @@ public:
|
|||
// call with any other monitor held to avoid deadlock.
|
||||
PRUint32 GetDecodeThreadCount();
|
||||
|
||||
// Keep track of the fact that a decode thread was created.
|
||||
// Call on any thread. Holds the internal monitor so don't
|
||||
// call with any other monitor held to avoid deadlock.
|
||||
void NoteDecodeThreadCreated();
|
||||
|
||||
// Keep track of the fact that a decode thread was destroyed.
|
||||
// Call on any thread. Holds the internal monitor so don't
|
||||
// call with any other monitor held to avoid deadlock.
|
||||
void NoteDecodeThreadDestroyed();
|
||||
|
||||
#ifdef DEBUG
|
||||
// Returns true if aStateMachine has a pending request for a
|
||||
// decode thread.
|
||||
bool IsQueued(nsBuiltinDecoderStateMachine* aStateMachine);
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Holds global instance of StateMachineTracker.
|
||||
// Writable on main thread only.
|
||||
|
@ -271,6 +284,10 @@ private:
|
|||
// only, read from the decoder threads. Synchronized via
|
||||
// the mMonitor.
|
||||
nsIThread* mStateMachineThread;
|
||||
|
||||
// Queue of state machines waiting for decode threads. Entries at the front
|
||||
// get their threads first.
|
||||
nsDeque mPending;
|
||||
};
|
||||
|
||||
StateMachineTracker* StateMachineTracker::mInstance = nsnull;
|
||||
|
@ -296,7 +313,23 @@ void StateMachineTracker::EnsureGlobalStateMachine()
|
|||
}
|
||||
mStateMachineCount++;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
bool StateMachineTracker::IsQueued(nsBuiltinDecoderStateMachine* aStateMachine)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
PRInt32 size = mPending.GetSize();
|
||||
for (int i = 0; i < size; ++i) {
|
||||
nsBuiltinDecoderStateMachine* m =
|
||||
static_cast<nsBuiltinDecoderStateMachine*>(mPending.ObjectAt(i));
|
||||
if (m == aStateMachine) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void StateMachineTracker::CleanupGlobalStateMachine()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
|
@ -305,6 +338,7 @@ void StateMachineTracker::CleanupGlobalStateMachine()
|
|||
mStateMachineCount--;
|
||||
if (mStateMachineCount == 0) {
|
||||
LOG(PR_LOG_DEBUG, ("Destroying media state machine thread"));
|
||||
NS_ASSERTION(mPending.GetSize() == 0, "Shouldn't all requests be handled by now?");
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(mStateMachineThread);
|
||||
|
@ -319,16 +353,22 @@ void StateMachineTracker::CleanupGlobalStateMachine()
|
|||
}
|
||||
}
|
||||
|
||||
void StateMachineTracker::NoteDecodeThreadCreated()
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
++mDecodeThreadCount;
|
||||
}
|
||||
|
||||
void StateMachineTracker::NoteDecodeThreadDestroyed()
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
--mDecodeThreadCount;
|
||||
while (mDecodeThreadCount < MAX_DECODE_THREADS && mPending.GetSize() > 0) {
|
||||
nsBuiltinDecoderStateMachine* m =
|
||||
static_cast<nsBuiltinDecoderStateMachine*>(mPending.PopFront());
|
||||
nsresult rv;
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mMonitor);
|
||||
rv = m->StartDecodeThread();
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
++mDecodeThreadCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 StateMachineTracker::GetDecodeThreadCount()
|
||||
|
@ -337,6 +377,45 @@ PRUint32 StateMachineTracker::GetDecodeThreadCount()
|
|||
return mDecodeThreadCount;
|
||||
}
|
||||
|
||||
nsresult StateMachineTracker::CancelCreateDecodeThread(nsBuiltinDecoderStateMachine* aStateMachine) {
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
PRInt32 size = mPending.GetSize();
|
||||
for (PRInt32 i = 0; i < size; ++i) {
|
||||
void* m = static_cast<nsBuiltinDecoderStateMachine*>(mPending.ObjectAt(i));
|
||||
if (m == aStateMachine) {
|
||||
mPending.RemoveObjectAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(!IsQueued(aStateMachine), "State machine should no longer have queued request.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult StateMachineTracker::RequestCreateDecodeThread(nsBuiltinDecoderStateMachine* aStateMachine)
|
||||
{
|
||||
NS_ENSURE_STATE(aStateMachine);
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
if (mPending.GetSize() > 0 || mDecodeThreadCount + 1 >= MAX_DECODE_THREADS) {
|
||||
// If there's already state machines in the queue, or we've exceeded the
|
||||
// limit, append the state machine to the queue of state machines waiting
|
||||
// for a decode thread. This ensures state machines already waiting get
|
||||
// their threads first.
|
||||
mPending.Push(aStateMachine);
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult rv;
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mMonitor);
|
||||
rv = aStateMachine->StartDecodeThread();
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
++mDecodeThreadCount;
|
||||
}
|
||||
NS_ASSERTION(mDecodeThreadCount <= MAX_DECODE_THREADS,
|
||||
"Should keep to thread limit!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsBuiltinDecoderStateMachine::nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDecoder,
|
||||
nsBuiltinDecoderReader* aReader,
|
||||
bool aRealTime) :
|
||||
|
@ -367,6 +446,7 @@ nsBuiltinDecoderStateMachine::nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDe
|
|||
mDispatchedRunEvent(false),
|
||||
mDecodeThreadWaiting(false),
|
||||
mRealTime(aRealTime),
|
||||
mRequestedNewDecodeThread(false),
|
||||
mEventManager(aDecoder)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsBuiltinDecoderStateMachine);
|
||||
|
@ -386,6 +466,10 @@ nsBuiltinDecoderStateMachine::~nsBuiltinDecoderStateMachine()
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
MOZ_COUNT_DTOR(nsBuiltinDecoderStateMachine);
|
||||
NS_ASSERTION(!StateMachineTracker::Instance().IsQueued(this),
|
||||
"Should not have a pending request for a new decode thread");
|
||||
NS_ASSERTION(!mRequestedNewDecodeThread,
|
||||
"Should not have (or flagged) a pending request for a new decode thread");
|
||||
if (mTimer)
|
||||
mTimer->Cancel();
|
||||
mTimer = nsnull;
|
||||
|
@ -1191,6 +1275,14 @@ void nsBuiltinDecoderStateMachine::StopDecodeThread()
|
|||
{
|
||||
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
if (mRequestedNewDecodeThread) {
|
||||
// We've requested that the decode be created, but it hasn't been yet.
|
||||
// Cancel that request.
|
||||
NS_ASSERTION(!mDecodeThread,
|
||||
"Shouldn't have a decode thread until after request processed");
|
||||
StateMachineTracker::Instance().CancelCreateDecodeThread(this);
|
||||
mRequestedNewDecodeThread = false;
|
||||
}
|
||||
mStopDecodeThread = true;
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
if (mDecodeThread) {
|
||||
|
@ -1203,6 +1295,10 @@ void nsBuiltinDecoderStateMachine::StopDecodeThread()
|
|||
mDecodeThread = nsnull;
|
||||
mDecodeThreadIdle = false;
|
||||
}
|
||||
NS_ASSERTION(!mRequestedNewDecodeThread,
|
||||
"Any pending requests for decode threads must be canceled and unflagged");
|
||||
NS_ASSERTION(!StateMachineTracker::Instance().IsQueued(this),
|
||||
"Any pending requests for decode threads must be canceled");
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::StopAudioThread()
|
||||
|
@ -1221,52 +1317,68 @@ void nsBuiltinDecoderStateMachine::StopAudioThread()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsBuiltinDecoderStateMachine::StartDecodeThread()
|
||||
nsBuiltinDecoderStateMachine::ScheduleDecodeThread()
|
||||
{
|
||||
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
PRUint32 count = 0;
|
||||
bool created = false;
|
||||
{
|
||||
ReentrantMonitorAutoExit mon(mDecoder->GetReentrantMonitor());
|
||||
count = StateMachineTracker::Instance().GetDecodeThreadCount();
|
||||
}
|
||||
|
||||
|
||||
mStopDecodeThread = false;
|
||||
if ((mDecodeThread && !mDecodeThreadIdle) || mState >= DECODER_STATE_COMPLETED)
|
||||
if (mState >= DECODER_STATE_COMPLETED) {
|
||||
return NS_OK;
|
||||
|
||||
if (!mDecodeThread && count > StateMachineTracker::MAX_DECODE_THREADS) {
|
||||
// Have to run one iteration of the state machine loop to ensure the
|
||||
// shutdown state is processed.
|
||||
ScheduleStateMachine();
|
||||
mState = DECODER_STATE_SHUTDOWN;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!mDecodeThread) {
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(mDecodeThread),
|
||||
nsnull,
|
||||
MEDIA_THREAD_STACK_SIZE);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Have to run one iteration of the state machine loop to ensure the
|
||||
// shutdown state is processed.
|
||||
ScheduleStateMachine();
|
||||
mState = DECODER_STATE_SHUTDOWN;
|
||||
return rv;
|
||||
if (mDecodeThread) {
|
||||
NS_ASSERTION(!mRequestedNewDecodeThread,
|
||||
"Shouldn't have requested new decode thread when we have a decode thread");
|
||||
// We already have a decode thread...
|
||||
if (mDecodeThreadIdle) {
|
||||
// ... and it's not been shutdown yet, wake it up.
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &nsBuiltinDecoderStateMachine::DecodeThreadRun);
|
||||
mDecodeThread->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
mDecodeThreadIdle = false;
|
||||
}
|
||||
created = true;
|
||||
return NS_OK;
|
||||
} else if (!mRequestedNewDecodeThread) {
|
||||
// We don't already have a decode thread, request a new one.
|
||||
mRequestedNewDecodeThread = true;
|
||||
ReentrantMonitorAutoExit mon(mDecoder->GetReentrantMonitor());
|
||||
StateMachineTracker::Instance().RequestCreateDecodeThread(this);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBuiltinDecoderStateMachine::StartDecodeThread()
|
||||
{
|
||||
NS_ASSERTION(StateMachineTracker::Instance().GetDecodeThreadCount() <
|
||||
StateMachineTracker::MAX_DECODE_THREADS,
|
||||
"Should not have reached decode thread limit");
|
||||
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
NS_ASSERTION(!StateMachineTracker::Instance().IsQueued(this),
|
||||
"Should not already have a pending request for a new decode thread.");
|
||||
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
|
||||
NS_ASSERTION(!mDecodeThread, "Should not have decode thread yet");
|
||||
NS_ASSERTION(mRequestedNewDecodeThread, "Should have requested this...");
|
||||
|
||||
mRequestedNewDecodeThread = false;
|
||||
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(mDecodeThread),
|
||||
nsnull,
|
||||
MEDIA_THREAD_STACK_SIZE);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Give up, report error to media element.
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::DecodeError);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &nsBuiltinDecoderStateMachine::DecodeThreadRun);
|
||||
mDecodeThread->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
mDecodeThreadIdle = false;
|
||||
|
||||
if (created) {
|
||||
ReentrantMonitorAutoExit mon(mDecoder->GetReentrantMonitor());
|
||||
StateMachineTracker::Instance().NoteDecodeThreadCreated();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1282,6 +1394,7 @@ nsBuiltinDecoderStateMachine::StartAudioThread()
|
|||
nsnull,
|
||||
MEDIA_THREAD_STACK_SIZE);
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state to SHUTDOWN because failed to create audio thread", mDecoder.get()));
|
||||
mState = DECODER_STATE_SHUTDOWN;
|
||||
return rv;
|
||||
}
|
||||
|
@ -1639,7 +1752,7 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine()
|
|||
|
||||
case DECODER_STATE_DECODING_METADATA: {
|
||||
// Ensure we have a decode thread to decode metadata.
|
||||
return StartDecodeThread();
|
||||
return ScheduleDecodeThread();
|
||||
}
|
||||
|
||||
case DECODER_STATE_DECODING: {
|
||||
|
@ -1663,7 +1776,7 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine()
|
|||
|
||||
// We're playing and/or our decode buffers aren't full. Ensure we have
|
||||
// an active decode thread.
|
||||
if (NS_FAILED(StartDecodeThread())) {
|
||||
if (NS_FAILED(ScheduleDecodeThread())) {
|
||||
NS_WARNING("Failed to start media decode thread!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -1728,7 +1841,7 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine()
|
|||
|
||||
case DECODER_STATE_SEEKING: {
|
||||
// Ensure we have a decode thread to perform the seek.
|
||||
return StartDecodeThread();
|
||||
return ScheduleDecodeThread();
|
||||
}
|
||||
|
||||
case DECODER_STATE_COMPLETED: {
|
||||
|
|
|
@ -253,6 +253,12 @@ public:
|
|||
// earlier, in which case the request is discarded.
|
||||
nsresult ScheduleStateMachine(PRInt64 aUsecs);
|
||||
|
||||
// Creates and starts a new decode thread. Don't call this directly,
|
||||
// request a new decode thread by calling
|
||||
// StateMachineTracker::RequestCreateDecodeThread().
|
||||
// The decoder monitor must not be held. Called on the state machine thread.
|
||||
nsresult StartDecodeThread();
|
||||
|
||||
// Timer function to implement ScheduleStateMachine(aUsecs).
|
||||
void TimeoutExpired();
|
||||
|
||||
|
@ -352,7 +358,8 @@ protected:
|
|||
// here. Called on the audio thread.
|
||||
PRUint32 PlayFromAudioQueue(PRUint64 aFrameOffset, PRUint32 aChannels);
|
||||
|
||||
// Stops the decode thread. The decoder monitor must be held with exactly
|
||||
// Stops the decode thread, and if we have a pending request for a new
|
||||
// decode thread it is canceled. The decoder monitor must be held with exactly
|
||||
// one lock count. Called on the state machine thread.
|
||||
void StopDecodeThread();
|
||||
|
||||
|
@ -360,9 +367,11 @@ protected:
|
|||
// one lock count. Called on the state machine thread.
|
||||
void StopAudioThread();
|
||||
|
||||
// Starts the decode thread. The decoder monitor must be held with exactly
|
||||
// one lock count. Called on the state machine thread.
|
||||
nsresult StartDecodeThread();
|
||||
// Ensures the decode thread is running if it already exists, or requests
|
||||
// a new decode thread be started if there currently is no decode thread.
|
||||
// The decoder monitor must be held with exactly one lock count. Called on
|
||||
// the state machine thread.
|
||||
nsresult ScheduleDecodeThread();
|
||||
|
||||
// Starts the audio thread. The decoder monitor must be held with exactly
|
||||
// one lock count. Called on the state machine thread.
|
||||
|
@ -625,6 +634,10 @@ protected:
|
|||
|
||||
// True is we are decoding a realtime stream, like a camera stream
|
||||
bool mRealTime;
|
||||
|
||||
// True if we've requested a new decode thread, but it has not yet been
|
||||
// created. Synchronized by the decoder monitor.
|
||||
bool mRequestedNewDecodeThread;
|
||||
|
||||
PRUint32 mBufferingWait;
|
||||
PRInt64 mLowDataThresholdUsecs;
|
||||
|
|
|
@ -150,6 +150,7 @@ _TEST_FILES = \
|
|||
test_source_write.html \
|
||||
test_standalone.html \
|
||||
test_timeupdate_small_files.html \
|
||||
test_too_many_elements.html \
|
||||
test_volume.html \
|
||||
test_video_to_canvas.html \
|
||||
use_large_cache.js \
|
||||
|
|
|
@ -8,4 +8,4 @@ load 493915-1.html
|
|||
skip-if(Android) load 495794-1.html
|
||||
load 492286-1.xhtml
|
||||
load 576612-1.html
|
||||
load 691096-1.html
|
||||
skip-if(Android) load 691096-1.html # Android sound API can't handle playing large number of sounds at once.
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
// These are small test files, good for just seeing if something loads. We
|
||||
// really only need one test file per backend here.
|
||||
var gSmallTests = [
|
||||
{ name:"small-shot.ogg", type:"audio/ogg", duration:0.276 },
|
||||
{ name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 },
|
||||
{ name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.233 },
|
||||
{ name:"small-shot.ogg", type:"audio/ogg", duration:0.276 },
|
||||
{ name:"seek.webm", type:"video/webm", duration:3.966 },
|
||||
{ name:"bogus.duh", type:"bogus/duh" }
|
||||
];
|
||||
|
@ -299,6 +299,14 @@ function getPlayableVideo(candidates) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function getPlayableAudio(candidates) {
|
||||
var v = document.createElement("audio");
|
||||
var resources = candidates.filter(function(x){return /^audio/.test(x.type) && v.canPlayType(x.type);});
|
||||
if (resources.length > 0)
|
||||
return resources[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
// Number of tests to run in parallel. Warning: Each media element requires
|
||||
// at least 3 threads (4 on Linux), and on Linux each thread uses 10MB of
|
||||
// virtual address space. Beware!
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=713381
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 713381</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=713381">Mozilla Bug 713381</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<p>Received loadeddata event for <span id="result">0</span> <span id="expected"></span>audio elements.</p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 713381 **/
|
||||
|
||||
const num = 500;
|
||||
var loadeddata = 0;
|
||||
|
||||
var result = document.getElementById("result");
|
||||
document.getElementById("expected").innerHTML = " of " + num + " ";
|
||||
|
||||
var finish = function(testNum) {
|
||||
return function() {
|
||||
ok(true, "Received loadeddata event for instance " + testNum );
|
||||
loadeddata++;
|
||||
if (loadeddata == num) {
|
||||
ok(true, "Should receive loadeddata events for all " + num + " elements.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var resource = getPlayableAudio(gSmallTests);
|
||||
|
||||
if (resource == null) {
|
||||
todo(false, "No types supported");
|
||||
} else {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
// Load the resource, and play it to ensure it's entirely downloaded.
|
||||
// Once it's played through, create a large number of audio elements which
|
||||
// are the same resource. These will share data with the other resource, and
|
||||
// so be really cheap to create.
|
||||
var res = new Audio(resource.name);
|
||||
res.addEventListener("ended",
|
||||
function() {
|
||||
for (var i=0; i<num; ++i) {
|
||||
var a = new Audio(resource.name);
|
||||
a.addEventListener("loadeddata", finish(i), false);
|
||||
}
|
||||
}, false);
|
||||
res.play();
|
||||
}
|
||||
|
||||
setInterval(function() { result.innerHTML = loadeddata; }, 1000);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -66,8 +66,13 @@ DIRS = \
|
|||
interfaces/notification \
|
||||
interfaces/svg \
|
||||
interfaces/smil \
|
||||
$(NULL)
|
||||
|
||||
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
|
||||
DIRS += \
|
||||
interfaces/apps \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
base \
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mounir Lamouri <mounir.lamouri@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "SmsDatabaseService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace sms {
|
||||
|
||||
NS_IMPL_ISUPPORTS1(SmsDatabaseService, nsISmsDatabaseService)
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::SaveSentMessage(const nsAString& aReceiver,
|
||||
const nsAString& aBody,
|
||||
PRUint64 aDate, PRInt32* aId)
|
||||
{
|
||||
*aId = -1;
|
||||
NS_ERROR("We should not be here!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::GetMessageMoz(PRInt32 aMessageId, PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
NS_ERROR("We should not be here!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::DeleteMessage(PRInt32 aMessageId, PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
NS_ERROR("We should not be here!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::CreateMessageList(nsIDOMMozSmsFilter* aFilter,
|
||||
bool aReverse, PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
NS_ERROR("We should not be here!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::GetNextMessageInList(PRInt32 aListId, PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
NS_ERROR("We should not be here!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::ClearMessageList(PRInt32 aListId)
|
||||
{
|
||||
NS_ERROR("We should not be here!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace sms
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mounir Lamouri <mounir.lamouri@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_dom_sms_SmsDatabaseService_h
|
||||
#define mozilla_dom_sms_SmsDatabaseService_h
|
||||
|
||||
#include "nsISmsDatabaseService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace sms {
|
||||
|
||||
class SmsDatabaseService : public nsISmsDatabaseService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISMSDATABASESERVICE
|
||||
};
|
||||
|
||||
} // namespace sms
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_sms_SmsDatabaseService_h
|
|
@ -80,7 +80,10 @@ SmsService::GetNumberOfMessagesForText(const nsAString& aText, PRUint16* aResult
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsService::Send(const nsAString& aNumber, const nsAString& aMessage)
|
||||
SmsService::Send(const nsAString& aNumber,
|
||||
const nsAString& aMessage,
|
||||
PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
if (!mRIL) {
|
||||
return NS_OK;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "nsISmsService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsITelephone.h"
|
||||
#include "nsIRadioInterfaceLayer.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
SmsService();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsITelephone> mRIL;
|
||||
nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
|
||||
};
|
||||
|
||||
} // namespace sms
|
||||
|
|
|
@ -79,6 +79,11 @@ LOCAL_INCLUDES += -I$(topsrcdir)/dom/system/android \
|
|||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gonk)
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/dom/system/b2g \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
EXPORTS += nsGeoPositionIPCSerialiser.h
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
|
|
@ -88,6 +88,10 @@
|
|||
#include "AndroidLocationProvider.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "GonkGPSGeolocationProvider.h"
|
||||
#endif
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
|
@ -577,6 +581,13 @@ nsresult nsGeolocationService::Init()
|
|||
if (provider)
|
||||
mProviders.AppendObject(provider);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
provider = GonkGPSGeolocationProvider::GetSingleton();
|
||||
if (provider)
|
||||
mProviders.AppendObject(provider);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2012
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kan-Ru Chen <kchen@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <pthread.h>
|
||||
#include <hardware/gps.h>
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsGeoPosition.h"
|
||||
#include "GonkGPSGeolocationProvider.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(GonkGPSGeolocationProvider, nsIGeolocationProvider)
|
||||
|
||||
GonkGPSGeolocationProvider* GonkGPSGeolocationProvider::sSingleton;
|
||||
|
||||
static void
|
||||
LocationCallback(GpsLocation* location)
|
||||
{
|
||||
nsRefPtr<GonkGPSGeolocationProvider> provider =
|
||||
GonkGPSGeolocationProvider::GetSingleton();
|
||||
nsCOMPtr<nsIGeolocationUpdate> callback = provider->GetLocationCallback();
|
||||
|
||||
if (!callback)
|
||||
return;
|
||||
|
||||
nsRefPtr<nsGeoPosition> somewhere = new nsGeoPosition(location->latitude,
|
||||
location->longitude,
|
||||
location->altitude,
|
||||
location->accuracy,
|
||||
location->accuracy,
|
||||
location->bearing,
|
||||
location->speed,
|
||||
location->timestamp);
|
||||
callback->Update(somewhere);
|
||||
}
|
||||
|
||||
typedef void *(*pthread_func)(void *);
|
||||
|
||||
/** Callback for creating a thread that can call into the JS codes.
|
||||
*/
|
||||
static pthread_t
|
||||
CreateThreadCallback(const char* name, void (*start)(void *), void* arg)
|
||||
{
|
||||
pthread_t thread;
|
||||
pthread_attr_t attr;
|
||||
|
||||
pthread_attr_init(&attr);
|
||||
|
||||
/* Unfortunately pthread_create and the callback disagreed on what
|
||||
* start function should return.
|
||||
*/
|
||||
pthread_create(&thread, &attr, reinterpret_cast<pthread_func>(start), arg);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
static GpsCallbacks gCallbacks = {
|
||||
sizeof(GpsCallbacks),
|
||||
LocationCallback,
|
||||
NULL, /* StatusCallback */
|
||||
NULL, /* SvStatusCallback */
|
||||
NULL, /* NmeaCallback */
|
||||
NULL, /* SetCapabilitiesCallback */
|
||||
NULL, /* AcquireWakelockCallback */
|
||||
NULL, /* ReleaseWakelockCallback */
|
||||
CreateThreadCallback,
|
||||
};
|
||||
|
||||
GonkGPSGeolocationProvider::GonkGPSGeolocationProvider()
|
||||
: mStarted(false)
|
||||
{
|
||||
mGpsInterface = GetGPSInterface();
|
||||
}
|
||||
|
||||
GonkGPSGeolocationProvider::~GonkGPSGeolocationProvider()
|
||||
{
|
||||
Shutdown();
|
||||
sSingleton = NULL;
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<GonkGPSGeolocationProvider>
|
||||
GonkGPSGeolocationProvider::GetSingleton()
|
||||
{
|
||||
if (!sSingleton)
|
||||
sSingleton = new GonkGPSGeolocationProvider();
|
||||
|
||||
NS_ADDREF(sSingleton);
|
||||
return sSingleton;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIGeolocationUpdate>
|
||||
GonkGPSGeolocationProvider::GetLocationCallback()
|
||||
{
|
||||
nsCOMPtr<nsIGeolocationUpdate> callback = mLocationCallback;
|
||||
return callback.forget();
|
||||
}
|
||||
|
||||
const GpsInterface*
|
||||
GonkGPSGeolocationProvider::GetGPSInterface()
|
||||
{
|
||||
hw_module_t* module;
|
||||
|
||||
if (hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module))
|
||||
return NULL;
|
||||
|
||||
hw_device_t* device;
|
||||
if (module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device))
|
||||
return NULL;
|
||||
|
||||
gps_device_t* gps_device = (gps_device_t *)device;
|
||||
return gps_device->get_gps_interface(gps_device);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GonkGPSGeolocationProvider::Startup()
|
||||
{
|
||||
if (mStarted)
|
||||
return NS_OK;
|
||||
|
||||
NS_ENSURE_TRUE(mGpsInterface, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 update = Preferences::GetInt("geo.default.update", 1000);
|
||||
|
||||
mGpsInterface->init(&gCallbacks);
|
||||
mGpsInterface->start();
|
||||
mGpsInterface->set_position_mode(GPS_POSITION_MODE_STANDALONE,
|
||||
GPS_POSITION_RECURRENCE_PERIODIC,
|
||||
update, 0, 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GonkGPSGeolocationProvider::Watch(nsIGeolocationUpdate* aCallback)
|
||||
{
|
||||
mLocationCallback = aCallback;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GonkGPSGeolocationProvider::Shutdown()
|
||||
{
|
||||
if (!mStarted)
|
||||
return NS_OK;
|
||||
|
||||
mGpsInterface->stop();
|
||||
mGpsInterface->cleanup();
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2012
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kan-Ru Chen <kchen@mozilla.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef GonkGPSGeolocationProvider_h
|
||||
#define GonkGPSGeolocationProvider_h
|
||||
|
||||
#include <hardware/gps.h> // for GpsInterface
|
||||
#include "nsIGeolocationProvider.h"
|
||||
|
||||
class GonkGPSGeolocationProvider : public nsIGeolocationProvider
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIGEOLOCATIONPROVIDER
|
||||
|
||||
static already_AddRefed<GonkGPSGeolocationProvider> GetSingleton();
|
||||
|
||||
already_AddRefed<nsIGeolocationUpdate> GetLocationCallback();
|
||||
|
||||
private:
|
||||
|
||||
/* Client should use GetSingleton() to get the provider instance. */
|
||||
GonkGPSGeolocationProvider();
|
||||
GonkGPSGeolocationProvider(const GonkGPSGeolocationProvider &);
|
||||
GonkGPSGeolocationProvider & operator = (const GonkGPSGeolocationProvider &);
|
||||
~GonkGPSGeolocationProvider();
|
||||
|
||||
const GpsInterface* GetGPSInterface();
|
||||
|
||||
static GonkGPSGeolocationProvider* sSingleton;
|
||||
|
||||
bool mStarted;
|
||||
const GpsInterface* mGpsInterface;
|
||||
nsCOMPtr<nsIGeolocationUpdate> mLocationCallback;
|
||||
};
|
||||
|
||||
#endif /* GonkGPSGeolocationProvider_h */
|
|
@ -55,19 +55,34 @@ CPPSRCS = \
|
|||
$(NULL)
|
||||
|
||||
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
|
||||
CPPSRCS += AudioManager.cpp
|
||||
CPPSRCS += \
|
||||
AudioManager.cpp \
|
||||
GonkGPSGeolocationProvider.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAudioManager.idl \
|
||||
nsIRadioInterfaceLayer.idl \
|
||||
nsIWorkerHolder.idl \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
-I$(topsrcdir)/dom/src/geolocation \
|
||||
-I$(topsrcdir)/dom/telephony \
|
||||
-I$(topsrcdir)/dom/wifi \
|
||||
-I$(topsrcdir)/content/events/src \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
RadioInterfaceLayer.manifest \
|
||||
RadioInterfaceLayer.js \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_JS_MODULES = \
|
||||
ril_consts.js \
|
||||
ril_worker.js \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
* The Original Code is Telephony.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Turner <bent.mozilla@gmail.com> (Original Author)
|
||||
* Philipp von Weitershausen <philipp@weitershausen.de>
|
||||
* Sinker Li <thinker@codemud.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -48,13 +49,13 @@ Cu.import("resource://gre/modules/ril_consts.js", RIL);
|
|||
|
||||
const DEBUG = true; // set to false to suppress debug messages
|
||||
|
||||
const TELEPHONYWORKER_CID =
|
||||
const RADIOINTERFACELAYER_CID =
|
||||
Components.ID("{2d831c8d-6017-435b-a80c-e5d422810cea}");
|
||||
const DATACALLINFO_CID =
|
||||
Components.ID("{ef474cd9-94f7-4c05-a31b-29b9de8a10d2}");
|
||||
|
||||
const nsIAudioManager = Ci.nsIAudioManager;
|
||||
const nsITelephone = Ci.nsITelephone;
|
||||
const nsIRadioInterfaceLayer = Ci.nsIRadioInterfaceLayer;
|
||||
|
||||
const kSmsReceivedObserverTopic = "sms-received";
|
||||
const DOM_SMS_DELIVERY_RECEIVED = "received";
|
||||
|
@ -66,17 +67,17 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSmsService",
|
|||
function convertRILCallState(state) {
|
||||
switch (state) {
|
||||
case RIL.CALL_STATE_ACTIVE:
|
||||
return nsITelephone.CALL_STATE_CONNECTED;
|
||||
return nsIRadioInterfaceLayer.CALL_STATE_CONNECTED;
|
||||
case RIL.CALL_STATE_HOLDING:
|
||||
return nsITelephone.CALL_STATE_HELD;
|
||||
return nsIRadioInterfaceLayer.CALL_STATE_HELD;
|
||||
case RIL.CALL_STATE_DIALING:
|
||||
return nsITelephone.CALL_STATE_DIALING;
|
||||
return nsIRadioInterfaceLayer.CALL_STATE_DIALING;
|
||||
case RIL.CALL_STATE_ALERTING:
|
||||
return nsITelephone.CALL_STATE_RINGING;
|
||||
return nsIRadioInterfaceLayer.CALL_STATE_RINGING;
|
||||
case RIL.CALL_STATE_INCOMING:
|
||||
return nsITelephone.CALL_STATE_INCOMING;
|
||||
return nsIRadioInterfaceLayer.CALL_STATE_INCOMING;
|
||||
case RIL.CALL_STATE_WAITING:
|
||||
return nsITelephone.CALL_STATE_HELD; // XXX This may not be right...
|
||||
return nsIRadioInterfaceLayer.CALL_STATE_HELD; // XXX This may not be right...
|
||||
default:
|
||||
throw new Error("Unknown rilCallState: " + state);
|
||||
}
|
||||
|
@ -126,7 +127,7 @@ DataCallInfo.protoptype = {
|
|||
};
|
||||
|
||||
|
||||
function nsTelephonyWorker() {
|
||||
function RadioInterfaceLayer() {
|
||||
this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
|
||||
this.worker.onerror = this.onerror.bind(this);
|
||||
this.worker.onmessage = this.onmessage.bind(this);
|
||||
|
@ -138,16 +139,16 @@ function nsTelephonyWorker() {
|
|||
cardState: null
|
||||
};
|
||||
}
|
||||
nsTelephonyWorker.prototype = {
|
||||
RadioInterfaceLayer.prototype = {
|
||||
|
||||
classID: TELEPHONYWORKER_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: TELEPHONYWORKER_CID,
|
||||
classDescription: "Telephone",
|
||||
classID: RADIOINTERFACELAYER_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: RADIOINTERFACELAYER_CID,
|
||||
classDescription: "RadioInterfaceLayer",
|
||||
interfaces: [Ci.nsIWorkerHolder,
|
||||
Ci.nsITelephone]}),
|
||||
Ci.nsIRadioInterfaceLayer]}),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWorkerHolder,
|
||||
Ci.nsITelephone]),
|
||||
Ci.nsIRadioInterfaceLayer]),
|
||||
|
||||
onerror: function onerror(event) {
|
||||
debug("Got an error: " + event.filename + ":" +
|
||||
|
@ -219,12 +220,12 @@ nsTelephonyWorker.prototype = {
|
|||
return;
|
||||
}
|
||||
switch (this._activeCall.state) {
|
||||
case nsITelephone.CALL_STATE_INCOMING:
|
||||
case nsIRadioInterfaceLayer.CALL_STATE_INCOMING:
|
||||
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_RINGTONE;
|
||||
debug("Incoming call, put audio system into PHONE_STATE_RINGTONE.");
|
||||
break;
|
||||
case nsITelephone.CALL_STATE_DIALING: // Fall through...
|
||||
case nsITelephone.CALL_STATE_CONNECTED:
|
||||
case nsIRadioInterfaceLayer.CALL_STATE_DIALING: // Fall through...
|
||||
case nsIRadioInterfaceLayer.CALL_STATE_CONNECTED:
|
||||
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_IN_CALL;
|
||||
gAudioManager.setForceForUse(nsIAudioManager.USE_COMMUNICATION,
|
||||
nsIAudioManager.FORCE_NONE);
|
||||
|
@ -240,7 +241,7 @@ nsTelephonyWorker.prototype = {
|
|||
handleCallStateChange: function handleCallStateChange(call) {
|
||||
debug("handleCallStateChange: " + JSON.stringify(call));
|
||||
call.state = convertRILCallState(call.state);
|
||||
if (call.state == nsITelephone.CALL_STATE_CONNECTED) {
|
||||
if (call.state == nsIRadioInterfaceLayer.CALL_STATE_CONNECTED) {
|
||||
// This is now the active call.
|
||||
this._activeCall = call;
|
||||
}
|
||||
|
@ -259,7 +260,8 @@ nsTelephonyWorker.prototype = {
|
|||
}
|
||||
this.updateCallAudioState();
|
||||
this._deliverCallback("callStateChanged",
|
||||
[call.callIndex, nsITelephone.CALL_STATE_DISCONNECTED,
|
||||
[call.callIndex,
|
||||
nsIRadioInterfaceLayer.CALL_STATE_DISCONNECTED,
|
||||
call.number]);
|
||||
},
|
||||
|
||||
|
@ -327,7 +329,7 @@ nsTelephonyWorker.prototype = {
|
|||
|
||||
worker: null,
|
||||
|
||||
// nsITelephone
|
||||
// nsIRadioInterfaceLayer
|
||||
|
||||
currentState: null,
|
||||
|
||||
|
@ -540,12 +542,12 @@ nsTelephonyWorker.prototype = {
|
|||
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([nsTelephonyWorker]);
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([RadioInterfaceLayer]);
|
||||
|
||||
let debug;
|
||||
if (DEBUG) {
|
||||
debug = function (s) {
|
||||
dump("-*- TelephonyWorker component: " + s + "\n");
|
||||
dump("-*- RadioInterfaceLayer: " + s + "\n");
|
||||
};
|
||||
} else {
|
||||
debug = function (s) {};
|
|
@ -0,0 +1 @@
|
|||
component {2d831c8d-6017-435b-a80c-e5d422810cea} RadioInterfaceLayer.js
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nsITelephone.h"
|
||||
#include "nsIRadioInterfaceLayer.h"
|
||||
#include "nsIWifi.h"
|
||||
#include "nsIWorkerHolder.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
@ -51,8 +51,8 @@
|
|||
#include "mozilla/ipc/Ril.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsTelephonyWorker.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsRadioInterfaceLayer.h"
|
||||
#include "nsWifiWorker.h"
|
||||
|
||||
USING_TELEPHONY_NAMESPACE
|
||||
|
@ -61,7 +61,7 @@ using namespace mozilla::ipc;
|
|||
|
||||
namespace {
|
||||
|
||||
NS_DEFINE_CID(kTelephonyWorkerCID, NS_TELEPHONYWORKER_CID);
|
||||
NS_DEFINE_CID(kRadioInterfaceLayerCID, NS_RADIOINTERFACELAYER_CID);
|
||||
NS_DEFINE_CID(kWifiWorkerCID, NS_WIFIWORKER_CID);
|
||||
|
||||
// Doesn't carry a reference, we're owned by services.
|
||||
|
@ -224,7 +224,7 @@ SystemWorkerManager::Init()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = InitTelephone(cx);
|
||||
rv = InitRIL(cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = InitWifi(cx);
|
||||
|
@ -252,7 +252,7 @@ SystemWorkerManager::Shutdown()
|
|||
|
||||
StopRil();
|
||||
|
||||
mTelephoneWorker = nsnull;
|
||||
mRILWorker = nsnull;
|
||||
mWifiWorker = nsnull;
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs =
|
||||
|
@ -295,9 +295,9 @@ SystemWorkerManager::GetInterface(const nsIID &aIID, void **aResult)
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsITelephone))) {
|
||||
return CallQueryInterface(mTelephoneWorker,
|
||||
reinterpret_cast<nsITelephone**>(aResult));
|
||||
if (aIID.Equals(NS_GET_IID(nsIRadioInterfaceLayer))) {
|
||||
return CallQueryInterface(mRILWorker,
|
||||
reinterpret_cast<nsIRadioInterfaceLayer**>(aResult));
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIWifi))) {
|
||||
|
@ -310,12 +310,12 @@ SystemWorkerManager::GetInterface(const nsIID &aIID, void **aResult)
|
|||
}
|
||||
|
||||
nsresult
|
||||
SystemWorkerManager::InitTelephone(JSContext *cx)
|
||||
SystemWorkerManager::InitRIL(JSContext *cx)
|
||||
{
|
||||
// We're keeping as much of this implementation as possible in JS, so the real
|
||||
// worker lives in nsTelephonyWorker.js. All we do here is hold it alive and
|
||||
// worker lives in RadioInterfaceLayer.js. All we do here is hold it alive and
|
||||
// hook it up to the RIL thread.
|
||||
nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kTelephonyWorkerCID);
|
||||
nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kRadioInterfaceLayerCID);
|
||||
NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
|
||||
|
||||
jsval workerval;
|
||||
|
@ -345,7 +345,7 @@ SystemWorkerManager::InitTelephone(JSContext *cx)
|
|||
mozilla::RefPtr<RILReceiver> receiver = new RILReceiver(wctd);
|
||||
StartRil(receiver);
|
||||
|
||||
mTelephoneWorker = worker;
|
||||
mRILWorker = worker;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,10 +70,10 @@ private:
|
|||
SystemWorkerManager();
|
||||
~SystemWorkerManager();
|
||||
|
||||
nsresult InitTelephone(JSContext *cx);
|
||||
nsresult InitRIL(JSContext *cx);
|
||||
nsresult InitWifi(JSContext *cx);
|
||||
|
||||
nsCOMPtr<nsIWorkerHolder> mTelephoneWorker;
|
||||
nsCOMPtr<nsIWorkerHolder> mRILWorker;
|
||||
nsCOMPtr<nsIWorkerHolder> mWifiWorker;
|
||||
|
||||
bool mShutdown;
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Philipp von Weitershausen <philipp@weitershausen.de>
|
||||
* Philipp von Weitershausen <philipp@weitershausen.de>
|
||||
* Ben Turner <bent.mozilla@gmail.com>
|
||||
* Sinker Li <thinker@codemud.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -37,48 +39,85 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(9b7e3a01-9c45-4af3-81bb-1bf08a842226)]
|
||||
interface nsITelephoneCallback : nsISupports
|
||||
[scriptable, uuid(03eafd60-d138-4f09-81b4-90cd4996b3c7)]
|
||||
interface nsIRILTelephonyCallback : nsISupports
|
||||
{
|
||||
// 'callState' uses the CALL_STATE values from nsITelephone.
|
||||
/**
|
||||
* Notified when a telephony call changes state.
|
||||
*
|
||||
* @param callIndex
|
||||
* Call identifier assigned by the RIL.
|
||||
* @param callState
|
||||
* One of the nsIRadioInterfaceLayer::CALL_STATE_* values.
|
||||
* @param number
|
||||
* Number of the other party.
|
||||
*/
|
||||
void callStateChanged(in unsigned long callIndex,
|
||||
in unsigned short callState,
|
||||
in AString number);
|
||||
|
||||
// 'callState' uses the CALL_STATE values from nsITelephone. Return true to
|
||||
// continue enumeration or false to cancel.
|
||||
/**
|
||||
* Called when nsIRadioInterfaceLayer is asked to enumerate the current
|
||||
* telephony call state (nsIRadioInterfaceLayer::enumerateCalls). This is
|
||||
* called once per call that is currently managed by the RIL.
|
||||
*
|
||||
* @param callIndex
|
||||
* Call identifier assigned by the RIL.
|
||||
* @param callState
|
||||
* One of the nsIRadioInterfaceLayer::CALL_STATE_* values.
|
||||
* @param number
|
||||
* Number of the other party.
|
||||
* @param isActive
|
||||
* Indicates whether this call is the active one.
|
||||
*
|
||||
* @return true to continue enumeration or false to cancel.
|
||||
*/
|
||||
boolean enumerateCallState(in unsigned long callIndex,
|
||||
in unsigned short callState,
|
||||
in AString number,
|
||||
in boolean isActive);
|
||||
};
|
||||
|
||||
[scriptable, uuid(8399fddd-471c-41ac-8f35-99f7dbb738ec)]
|
||||
interface nsIDataCallInfo : nsISupports
|
||||
[scriptable, uuid(66a55943-e63b-4731-aece-9c04bfc14019)]
|
||||
interface nsIRILDataCallInfo : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long callState;
|
||||
readonly attribute AString cid;
|
||||
readonly attribute AString apn;
|
||||
};
|
||||
|
||||
[scriptable, uuid(36cc4b89-0338-4ff7-a3c2-d78e60f2ea98)]
|
||||
interface nsIPhoneDataCallCallback : nsISupports
|
||||
[scriptable, uuid(cea91bcb-3cfb-42bb-8638-dae89e8870fc)]
|
||||
interface nsIRILDataCallback : nsISupports
|
||||
{
|
||||
/**
|
||||
* This method is called when the state of a data call is changed.
|
||||
* Notified when a data call changes state.
|
||||
*
|
||||
* @param dataState use DATACALL_STATE_* values from nsITelephone.
|
||||
* @param cid
|
||||
* The CID of the data call.
|
||||
* @param interfaceName
|
||||
* Name of the associated network interface.
|
||||
* @param dataState
|
||||
* One of the nsIRadioInterfaceLayer::DATACALL_STATE_* values.
|
||||
*/
|
||||
void dataCallStateChanged(in AString cid,
|
||||
in AString interfaceName,
|
||||
in unsigned short callState);
|
||||
|
||||
void receiveDataCallList([array,size_is(aLength)] in nsIDataCallInfo aDataCalls,
|
||||
in unsigned long aLength);
|
||||
/**
|
||||
* Called when nsIRadioInterfaceLayer is asked to enumerate the current
|
||||
* data call state.
|
||||
*
|
||||
* @param datacalls
|
||||
* Array of nsIRILDataCallInfo objects.
|
||||
* @param length
|
||||
* Lenght of the aforementioned array.
|
||||
*/
|
||||
void receiveDataCallList([array,size_is(length)] in nsIRILDataCallInfo dataCalls,
|
||||
in unsigned long length);
|
||||
};
|
||||
|
||||
[scriptable, uuid(78ed0beb-d6ad-42f8-929a-8d003285784f)]
|
||||
interface nsITelephone : nsISupports
|
||||
[scriptable, uuid(9b7e3a01-9c45-4af3-81bb-1bf08a842226)]
|
||||
interface nsIRadioInterfaceLayer : nsISupports
|
||||
{
|
||||
const unsigned short CALL_STATE_UNKNOWN = 0;
|
||||
const unsigned short CALL_STATE_DIALING = 1;
|
||||
|
@ -102,14 +141,14 @@ interface nsITelephone : nsISupports
|
|||
|
||||
readonly attribute jsval currentState;
|
||||
|
||||
void registerCallback(in nsITelephoneCallback callback);
|
||||
void unregisterCallback(in nsITelephoneCallback callback);
|
||||
void registerCallback(in nsIRILTelephonyCallback callback);
|
||||
void unregisterCallback(in nsIRILTelephonyCallback callback);
|
||||
|
||||
/**
|
||||
* Will continue calling callback.enumerateCallState until the callback
|
||||
* returns false.
|
||||
*/
|
||||
void enumerateCalls(in nsITelephoneCallback callback);
|
||||
void enumerateCalls(in nsIRILTelephonyCallback callback);
|
||||
|
||||
/**
|
||||
* Functionality for making and managing phone calls.
|
||||
|
@ -126,7 +165,9 @@ interface nsITelephone : nsISupports
|
|||
attribute bool microphoneMuted;
|
||||
attribute bool speakerEnabled;
|
||||
|
||||
// PDP APIs
|
||||
/**
|
||||
* PDP APIs
|
||||
*/
|
||||
void setupDataCall(in long radioTech,
|
||||
in DOMString apn,
|
||||
in DOMString user,
|
||||
|
@ -137,8 +178,8 @@ interface nsITelephone : nsISupports
|
|||
in DOMString reason);
|
||||
void getDataCallList();
|
||||
|
||||
void registerDataCallCallback(in nsIPhoneDataCallCallback callback);
|
||||
void unregisterDataCallCallback(in nsIPhoneDataCallCallback callback);
|
||||
void registerDataCallCallback(in nsIRILDataCallback callback);
|
||||
void unregisterDataCallCallback(in nsIRILDataCallback callback);
|
||||
|
||||
/**
|
||||
* SMS-related functionality.
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// This must always match the CID given in nsTelephonyWorker.manifest!
|
||||
#define NS_TELEPHONYWORKER_CID \
|
||||
// This must always match the CID given in RadioInterfaceLayer.manifest!
|
||||
#define NS_RADIOINTERFACELAYER_CID \
|
||||
{ 0x2d831c8d, 0x6017, 0x435b, \
|
||||
{ 0xa8, 0x0c, 0xe5, 0xd4, 0x22, 0x81, 0x0c, 0xea } }
|
|
@ -61,18 +61,12 @@ XPIDLSRCS = \
|
|||
nsIDOMTelephony.idl \
|
||||
nsIDOMTelephonyCall.idl \
|
||||
nsIDOMCallEvent.idl \
|
||||
nsITelephone.idl \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
nsTelephonyWorker.manifest \
|
||||
nsTelephonyWorker.js \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_JS_MODULES = \
|
||||
ril_consts.js \
|
||||
ril_worker.js \
|
||||
$(NULL)
|
||||
#LOCAL_INCLUDES = \
|
||||
# -I$(topsrcdir)/dom/base \
|
||||
# -I$(topsrcdir)/dom/system/b2g \
|
||||
# -I$(topsrcdir)/content/events/src \
|
||||
# $(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -112,8 +112,8 @@ nsTArrayToJSArray(JSContext* aCx, JSObject* aGlobal,
|
|||
|
||||
Telephony::~Telephony()
|
||||
{
|
||||
if (mTelephone && mTelephoneCallback) {
|
||||
mTelephone->UnregisterCallback(mTelephoneCallback);
|
||||
if (mRIL && mRILTelephonyCallback) {
|
||||
mRIL->UnregisterCallback(mRILTelephonyCallback);
|
||||
}
|
||||
|
||||
if (mRooted) {
|
||||
|
@ -123,10 +123,10 @@ Telephony::~Telephony()
|
|||
|
||||
// static
|
||||
already_AddRefed<Telephony>
|
||||
Telephony::Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone)
|
||||
Telephony::Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL)
|
||||
{
|
||||
NS_ASSERTION(aOwner, "Null owner!");
|
||||
NS_ASSERTION(aTelephone, "Null telephone!");
|
||||
NS_ASSERTION(aRIL, "Null RIL!");
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aOwner);
|
||||
NS_ENSURE_TRUE(sgo, nsnull);
|
||||
|
@ -138,13 +138,13 @@ Telephony::Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone)
|
|||
|
||||
telephony->mOwner = aOwner;
|
||||
telephony->mScriptContext.swap(scriptContext);
|
||||
telephony->mTelephone = aTelephone;
|
||||
telephony->mTelephoneCallback = new TelephoneCallback(telephony);
|
||||
telephony->mRIL = aRIL;
|
||||
telephony->mRILTelephonyCallback = new RILTelephonyCallback(telephony);
|
||||
|
||||
nsresult rv = aTelephone->EnumerateCalls(telephony->mTelephoneCallback);
|
||||
nsresult rv = aRIL->EnumerateCalls(telephony->mRILTelephonyCallback);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
rv = aTelephone->RegisterCallback(telephony->mTelephoneCallback);
|
||||
rv = aRIL->RegisterCallback(telephony->mRILTelephonyCallback);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
return telephony.forget();
|
||||
|
@ -195,7 +195,7 @@ NS_IMPL_RELEASE_INHERITED(Telephony, nsDOMEventTargetWrapperCache)
|
|||
|
||||
DOMCI_DATA(Telephony, Telephony)
|
||||
|
||||
NS_IMPL_ISUPPORTS1(Telephony::TelephoneCallback, nsITelephoneCallback)
|
||||
NS_IMPL_ISUPPORTS1(Telephony::RILTelephonyCallback, nsIRILTelephonyCallback)
|
||||
|
||||
NS_IMETHODIMP
|
||||
Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
|
||||
|
@ -205,7 +205,7 @@ Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
|
|||
for (PRUint32 index = 0; index < mCalls.Length(); index++) {
|
||||
const nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
|
||||
if (tempCall->IsOutgoing() &&
|
||||
tempCall->CallState() < nsITelephone::CALL_STATE_CONNECTED) {
|
||||
tempCall->CallState() < nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) {
|
||||
// One call has been dialed already and we only support one outgoing call
|
||||
// at a time.
|
||||
NS_WARNING("Only permitted to dial one call at a time!");
|
||||
|
@ -213,11 +213,11 @@ Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
|
|||
}
|
||||
}
|
||||
|
||||
nsresult rv = mTelephone->Dial(aNumber);
|
||||
nsresult rv = mRIL->Dial(aNumber);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<TelephonyCall> call =
|
||||
TelephonyCall::Create(this, aNumber, nsITelephone::CALL_STATE_DIALING);
|
||||
TelephonyCall::Create(this, aNumber, nsIRadioInterfaceLayer::CALL_STATE_DIALING);
|
||||
NS_ASSERTION(call, "This should never fail!");
|
||||
|
||||
NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
|
||||
|
@ -229,7 +229,7 @@ Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
|
|||
NS_IMETHODIMP
|
||||
Telephony::GetMuted(bool* aMuted)
|
||||
{
|
||||
nsresult rv = mTelephone->GetMicrophoneMuted(aMuted);
|
||||
nsresult rv = mRIL->GetMicrophoneMuted(aMuted);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -238,7 +238,7 @@ Telephony::GetMuted(bool* aMuted)
|
|||
NS_IMETHODIMP
|
||||
Telephony::SetMuted(bool aMuted)
|
||||
{
|
||||
nsresult rv = mTelephone->SetMicrophoneMuted(aMuted);
|
||||
nsresult rv = mRIL->SetMicrophoneMuted(aMuted);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -247,7 +247,7 @@ Telephony::SetMuted(bool aMuted)
|
|||
NS_IMETHODIMP
|
||||
Telephony::GetSpeakerEnabled(bool* aSpeakerEnabled)
|
||||
{
|
||||
nsresult rv = mTelephone->GetSpeakerEnabled(aSpeakerEnabled);
|
||||
nsresult rv = mRIL->GetSpeakerEnabled(aSpeakerEnabled);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -256,7 +256,7 @@ Telephony::GetSpeakerEnabled(bool* aSpeakerEnabled)
|
|||
NS_IMETHODIMP
|
||||
Telephony::SetSpeakerEnabled(bool aSpeakerEnabled)
|
||||
{
|
||||
nsresult rv = mTelephone->SetSpeakerEnabled(aSpeakerEnabled);
|
||||
nsresult rv = mRIL->SetSpeakerEnabled(aSpeakerEnabled);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -339,7 +339,7 @@ Telephony::StartTone(const nsAString& aDTMFChar)
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsresult rv = mTelephone->StartTone(aDTMFChar);
|
||||
nsresult rv = mRIL->StartTone(aDTMFChar);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -348,7 +348,7 @@ Telephony::StartTone(const nsAString& aDTMFChar)
|
|||
NS_IMETHODIMP
|
||||
Telephony::StopTone()
|
||||
{
|
||||
nsresult rv = mTelephone->StopTone();
|
||||
nsresult rv = mRIL->StopTone();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -378,7 +378,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
|
|||
nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
|
||||
if (tempCall->CallIndex() == kOutgoingPlaceholderCallIndex) {
|
||||
NS_ASSERTION(!outgoingCall, "More than one outgoing call not supported!");
|
||||
NS_ASSERTION(tempCall->CallState() == nsITelephone::CALL_STATE_DIALING,
|
||||
NS_ASSERTION(tempCall->CallState() == nsIRadioInterfaceLayer::CALL_STATE_DIALING,
|
||||
"Something really wrong here!");
|
||||
// Stash this for later, we may need it if aCallIndex doesn't match one of
|
||||
// our other calls.
|
||||
|
@ -395,7 +395,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
|
|||
// an outgoing call then we must be seeing a status update for our outgoing
|
||||
// call.
|
||||
if (!modifiedCall &&
|
||||
aCallState != nsITelephone::CALL_STATE_INCOMING &&
|
||||
aCallState != nsIRadioInterfaceLayer::CALL_STATE_INCOMING &&
|
||||
outgoingCall) {
|
||||
outgoingCall->UpdateCallIndex(aCallIndex);
|
||||
modifiedCall.swap(outgoingCall);
|
||||
|
@ -406,7 +406,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
|
|||
modifiedCall->ChangeState(aCallState);
|
||||
|
||||
// See if this should replace our current active call.
|
||||
if (aCallState == nsITelephone::CALL_STATE_CONNECTED) {
|
||||
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) {
|
||||
SwitchActiveCall(modifiedCall);
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ Telephony::CallStateChanged(PRUint32 aCallIndex, PRUint16 aCallState,
|
|||
}
|
||||
|
||||
// Didn't know anything about this call before now, must be incoming.
|
||||
NS_ASSERTION(aCallState == nsITelephone::CALL_STATE_INCOMING,
|
||||
NS_ASSERTION(aCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING,
|
||||
"Serious logic problem here!");
|
||||
|
||||
nsRefPtr<TelephonyCall> call =
|
||||
|
@ -511,10 +511,10 @@ NS_NewTelephony(nsPIDOMWindow* aWindow, nsIDOMTelephony** aTelephony)
|
|||
nsIInterfaceRequestor* ireq = SystemWorkerManager::GetInterfaceRequestor();
|
||||
NS_ENSURE_TRUE(ireq, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsITelephone> telephone = do_GetInterface(ireq);
|
||||
NS_ENSURE_TRUE(telephone, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetInterface(ireq);
|
||||
NS_ENSURE_TRUE(ril, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsRefPtr<Telephony> telephony = Telephony::Create(innerWindow, telephone);
|
||||
nsRefPtr<Telephony> telephony = Telephony::Create(innerWindow, ril);
|
||||
NS_ENSURE_TRUE(telephony, NS_ERROR_UNEXPECTED);
|
||||
|
||||
telephony.forget(aTelephony);
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include "nsIDOMTelephony.h"
|
||||
#include "nsIDOMTelephonyCall.h"
|
||||
#include "nsITelephone.h"
|
||||
#include "nsIRadioInterfaceLayer.h"
|
||||
|
||||
class nsIScriptContext;
|
||||
class nsPIDOMWindow;
|
||||
|
@ -54,8 +54,8 @@ BEGIN_TELEPHONY_NAMESPACE
|
|||
class Telephony : public nsDOMEventTargetWrapperCache,
|
||||
public nsIDOMTelephony
|
||||
{
|
||||
nsCOMPtr<nsITelephone> mTelephone;
|
||||
nsCOMPtr<nsITelephoneCallback> mTelephoneCallback;
|
||||
nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
|
||||
nsCOMPtr<nsIRILTelephonyCallback> mRILTelephonyCallback;
|
||||
|
||||
NS_DECL_EVENT_HANDLER(incoming);
|
||||
|
||||
|
@ -71,14 +71,14 @@ class Telephony : public nsDOMEventTargetWrapperCache,
|
|||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMTELEPHONY
|
||||
NS_DECL_NSITELEPHONECALLBACK
|
||||
NS_DECL_NSIRILTELEPHONYCALLBACK
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
|
||||
Telephony,
|
||||
nsDOMEventTargetWrapperCache)
|
||||
|
||||
static already_AddRefed<Telephony>
|
||||
Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone);
|
||||
Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL);
|
||||
|
||||
nsIDOMEventTarget*
|
||||
ToIDOMEventTarget() const
|
||||
|
@ -109,10 +109,10 @@ public:
|
|||
mCallsArray = nsnull;
|
||||
}
|
||||
|
||||
nsITelephone*
|
||||
Telephone() const
|
||||
nsIRadioInterfaceLayer*
|
||||
RIL() const
|
||||
{
|
||||
return mTelephone;
|
||||
return mRIL;
|
||||
}
|
||||
|
||||
nsPIDOMWindow*
|
||||
|
@ -137,15 +137,15 @@ private:
|
|||
void
|
||||
SwitchActiveCall(TelephonyCall* aCall);
|
||||
|
||||
class TelephoneCallback : public nsITelephoneCallback
|
||||
class RILTelephonyCallback : public nsIRILTelephonyCallback
|
||||
{
|
||||
Telephony* mTelephony;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_NSITELEPHONECALLBACK(mTelephony->)
|
||||
NS_FORWARD_NSIRILTELEPHONYCALLBACK(mTelephony->)
|
||||
|
||||
TelephoneCallback(Telephony* aTelephony)
|
||||
RILTelephonyCallback(Telephony* aTelephony)
|
||||
: mTelephony(aTelephony)
|
||||
{
|
||||
NS_ASSERTION(mTelephony, "Null pointer!");
|
||||
|
|
|
@ -75,37 +75,37 @@ TelephonyCall::ChangeStateInternal(PRUint16 aCallState, bool aFireEvents)
|
|||
|
||||
nsString stateString;
|
||||
switch (aCallState) {
|
||||
case nsITelephone::CALL_STATE_DIALING:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_DIALING:
|
||||
stateString.AssignLiteral("dialing");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_RINGING:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_RINGING:
|
||||
stateString.AssignLiteral("ringing");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_BUSY:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_BUSY:
|
||||
stateString.AssignLiteral("busy");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_CONNECTING:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_CONNECTING:
|
||||
stateString.AssignLiteral("connecting");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_CONNECTED:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_CONNECTED:
|
||||
stateString.AssignLiteral("connected");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_HOLDING:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_HOLDING:
|
||||
stateString.AssignLiteral("holding");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_HELD:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_HELD:
|
||||
stateString.AssignLiteral("held");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_RESUMING:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_RESUMING:
|
||||
stateString.AssignLiteral("resuming");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_DISCONNECTING:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING:
|
||||
stateString.AssignLiteral("disconnecting");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_DISCONNECTED:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED:
|
||||
stateString.AssignLiteral("disconnected");
|
||||
break;
|
||||
case nsITelephone::CALL_STATE_INCOMING:
|
||||
case nsIRadioInterfaceLayer::CALL_STATE_INCOMING:
|
||||
stateString.AssignLiteral("incoming");
|
||||
break;
|
||||
default:
|
||||
|
@ -115,11 +115,11 @@ TelephonyCall::ChangeStateInternal(PRUint16 aCallState, bool aFireEvents)
|
|||
mState = stateString;
|
||||
mCallState = aCallState;
|
||||
|
||||
if (aCallState == nsITelephone::CALL_STATE_DIALING) {
|
||||
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DIALING) {
|
||||
mOutgoing = true;
|
||||
}
|
||||
|
||||
if (aCallState == nsITelephone::CALL_STATE_DISCONNECTED) {
|
||||
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
|
||||
NS_ASSERTION(mLive, "Should be live!");
|
||||
mTelephony->RemoveCall(this);
|
||||
mLive = false;
|
||||
|
@ -208,33 +208,33 @@ TelephonyCall::GetState(nsAString& aState)
|
|||
NS_IMETHODIMP
|
||||
TelephonyCall::Answer()
|
||||
{
|
||||
if (mCallState != nsITelephone::CALL_STATE_INCOMING) {
|
||||
if (mCallState != nsIRadioInterfaceLayer::CALL_STATE_INCOMING) {
|
||||
NS_WARNING("Answer on non-incoming call ignored!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = mTelephony->Telephone()->AnswerCall(mCallIndex);
|
||||
nsresult rv = mTelephony->RIL()->AnswerCall(mCallIndex);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ChangeStateInternal(nsITelephone::CALL_STATE_CONNECTING, true);
|
||||
ChangeStateInternal(nsIRadioInterfaceLayer::CALL_STATE_CONNECTING, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCall::HangUp()
|
||||
{
|
||||
if (mCallState == nsITelephone::CALL_STATE_DISCONNECTING ||
|
||||
mCallState == nsITelephone::CALL_STATE_DISCONNECTED) {
|
||||
if (mCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING ||
|
||||
mCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
|
||||
NS_WARNING("HangUp on previously disconnected call ignored!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = mCallState == nsITelephone::CALL_STATE_INCOMING ?
|
||||
mTelephony->Telephone()->RejectCall(mCallIndex) :
|
||||
mTelephony->Telephone()->HangUp(mCallIndex);
|
||||
nsresult rv = mCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING ?
|
||||
mTelephony->RIL()->RejectCall(mCallIndex) :
|
||||
mTelephony->RIL()->HangUp(mCallIndex);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ChangeStateInternal(nsITelephone::CALL_STATE_DISCONNECTING, true);
|
||||
ChangeStateInternal(nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "TelephonyCommon.h"
|
||||
|
||||
#include "nsIDOMTelephonyCall.h"
|
||||
#include "nsITelephone.h"
|
||||
#include "nsIRadioInterfaceLayer.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
private:
|
||||
TelephonyCall()
|
||||
: mCallIndex(kOutgoingPlaceholderCallIndex),
|
||||
mCallState(nsITelephone::CALL_STATE_UNKNOWN), mLive(false), mOutgoing(false)
|
||||
mCallState(nsIRadioInterfaceLayer::CALL_STATE_UNKNOWN), mLive(false), mOutgoing(false)
|
||||
{ }
|
||||
|
||||
~TelephonyCall()
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
component {2d831c8d-6017-435b-a80c-e5d422810cea} nsTelephonyWorker.js
|
|
@ -14,8 +14,8 @@ SimpleTest.waitForFocus(function () opener.framesetWindowLoaded(window));
|
|||
<frame src="data:text/html,<html id='f7'><body id='framebody4'><input id='f8'><body></html>">
|
||||
</frameset>
|
||||
<noframes>
|
||||
<input id="unusued1"/>
|
||||
<input id="unusued2" tabindex="1"/>
|
||||
<input id="unused1"/>
|
||||
<input id="unused2" tabindex="1"/>
|
||||
</noframes>
|
||||
</frameset>
|
||||
|
||||
|
|
|
@ -113,7 +113,8 @@ public class GeckoAppShell
|
|||
public static native void onLowMemory();
|
||||
public static native void callObserver(String observerKey, String topic, String data);
|
||||
public static native void removeObserver(String observerKey);
|
||||
public static native void loadLibs(String apkName, boolean shouldExtract);
|
||||
public static native void loadGeckoLibsNative(String apkName);
|
||||
public static native void loadSQLiteLibsNative(String apkName, boolean shouldExtract);
|
||||
public static native void onChangeNetworkLinkStatus(String status);
|
||||
public static native void reportJavaCrash(String stack);
|
||||
|
||||
|
@ -396,7 +397,8 @@ public class GeckoAppShell
|
|||
}
|
||||
}
|
||||
}
|
||||
loadLibs(apkName, extractLibs);
|
||||
loadSQLiteLibsNative(apkName, extractLibs);
|
||||
loadGeckoLibsNative(apkName);
|
||||
}
|
||||
|
||||
private static void putLocaleEnv() {
|
||||
|
|
|
@ -116,6 +116,7 @@ DrawTargetCG::~DrawTargetCG()
|
|||
CGColorSpaceRelease(mColorSpace);
|
||||
if (mCg)
|
||||
CGContextRelease(mCg);
|
||||
free(mData);
|
||||
}
|
||||
|
||||
TemporaryRef<SourceSurface>
|
||||
|
@ -845,7 +846,6 @@ DrawTargetCG::Init(const IntSize &aSize, SurfaceFormat &)
|
|||
// XXX: currently we allocate ourselves so that we can easily return a gfxImageSurface
|
||||
// we might not need to later if once we don't need to support gfxImageSurface
|
||||
//XXX: currently Init implicitly clears, that can often be a waste of time
|
||||
// XXX: leaked
|
||||
mData = calloc(mSize.height * stride, 1);
|
||||
// XXX: what should we do if this fails?
|
||||
mCg = CGBitmapContextCreate (mData,
|
||||
|
|
|
@ -131,12 +131,19 @@ endif
|
|||
EXPORTS_NAMESPACES = gfxipc mozilla/layers
|
||||
EXPORTS_gfxipc = ShadowLayerUtils.h
|
||||
EXPORTS_mozilla/layers =\
|
||||
CompositorCocoaWidgetHelper.h \
|
||||
CompositorChild.h \
|
||||
CompositorParent.h \
|
||||
ShadowLayers.h \
|
||||
ShadowLayersChild.h \
|
||||
ShadowLayersParent.h \
|
||||
ShadowLayersManager.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS += \
|
||||
CompositorCocoaWidgetHelper.cpp \
|
||||
CompositorChild.cpp \
|
||||
CompositorParent.cpp \
|
||||
ShadowLayers.cpp \
|
||||
ShadowLayerChild.cpp \
|
||||
ShadowLayersChild.cpp \
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче