Merge mozilla-central to b2g-inbound

This commit is contained in:
Carsten "Tomcat" Book 2014-12-03 13:45:36 +01:00
Родитель bf13de29d8 32170ac2c3
Коммит 13bd1becaf
124 изменённых файлов: 1255 добавлений и 1112 удалений

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

@ -29,7 +29,7 @@ exports.testDebugger = function(assert, done) {
set('devtools.debugger.log', true);
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -36,7 +36,7 @@ exports.testDebugger = function(assert, done) {
ok(true, 'PageMod was created');
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -74,7 +74,7 @@ let RemoteDebugger = {
}
// Ask for remote connections.
DebuggerServer.init(this.prompt.bind(this));
DebuggerServer.init();
// /!\ Be careful when adding a new actor, especially global actors.
// Any new global actor will be exposed and returned by the root actor.
@ -119,6 +119,8 @@ let RemoteDebugger = {
}
};
RemoteDebugger.prompt = RemoteDebugger.prompt.bind(RemoteDebugger);
let USBRemoteDebugger = {
get isDebugging() {
@ -144,6 +146,7 @@ let USBRemoteDebugger = {
try {
debug("Starting USB debugger on " + portOrPath);
this._listener = DebuggerServer.openListener(portOrPath);
this._listener.allowConnection = RemoteDebugger.prompt;
// Temporary event, until bug 942756 lands and offers a way to know
// when the server is up and running.
Services.obs.notifyObservers(null, "debugger-server-started", null);
@ -179,6 +182,7 @@ let WiFiRemoteDebugger = {
try {
debug("Starting WiFi debugger");
this._listener = DebuggerServer.openListener(-1);
this._listener.allowConnection = RemoteDebugger.prompt;
let port = this._listener.port;
debug("Started WiFi debugger on " + port);
discovery.addService("devtools", { port: port });

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

@ -28,7 +28,7 @@ Bug 901519 - [app manager] data store for connections
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -22,7 +22,7 @@ Bug 901520 - [app manager] data store for device
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -22,7 +22,7 @@ Bug 912646 - Closing app toolbox causes phone to disconnect
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -184,7 +184,7 @@ function reload(aTarget, aWaitForTargetEvent = "navigate") {
function initServer() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
}

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

@ -10,7 +10,7 @@ var gAddon, gClient, gThreadClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -11,7 +11,7 @@ let gClient, gThreadClient, gInput, gButton;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -12,7 +12,7 @@ let gClient, gThreadClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -20,7 +20,7 @@ let DebuggerServer = loader.DebuggerServer;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -12,7 +12,7 @@ let gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -12,7 +12,7 @@ let gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -13,7 +13,7 @@ let gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -13,7 +13,7 @@ let gTab;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -12,7 +12,7 @@ function test() {
let gClient;
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -11,7 +11,7 @@ let gAddon1, gAddon1Actor, gAddon2, gAddon2Actor, gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -12,7 +12,7 @@ let gTab1, gTab1Actor, gTab2, gTab2Actor, gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -25,7 +25,7 @@ function onListChangedHandler() {
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -27,7 +27,7 @@ function request(params) {
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -14,7 +14,7 @@ let gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -12,7 +12,7 @@ let gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -13,7 +13,7 @@ let gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -13,7 +13,7 @@ let gClient;
function test() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -551,7 +551,7 @@ AddonDebugger.prototype = {
info("Initializing an addon debugger panel.");
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -62,9 +62,9 @@ function submit() {
// Initiate the connection
let transport;
try {
transport = debuggerSocketConnect(host, port);
transport = DebuggerClient.socketConnect(host, port);
} catch(e) {
// Bug 921850: catch rare exception from debuggerSocketConnect
// Bug 921850: catch rare exception from DebuggerClient.socketConnect
showError("unexpected");
return;
}

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

@ -13,7 +13,7 @@ function test() {
waitForExplicitFinish();
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -61,7 +61,7 @@ function test() {
waitForExplicitFinish();
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -66,7 +66,7 @@ function getClient() {
let deferred = promise.defer();
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -23,7 +23,7 @@ function test() {
waitForExplicitFinish();
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -81,6 +81,9 @@ function OptionsPanel(iframeWindow, toolbox) {
this._prefChanged = this._prefChanged.bind(this);
this._themeRegistered = this._themeRegistered.bind(this);
this._themeUnregistered = this._themeUnregistered.bind(this);
this._disableJSClicked = this._disableJSClicked.bind(this);
this.disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript");
this._addListeners();
@ -112,11 +115,6 @@ OptionsPanel.prototype = {
this.setupBrowserThemeButton();
this.populatePreferences();
this.updateDefaultTheme();
this._disableJSClicked = this._disableJSClicked.bind(this);
let disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript");
disableJSNode.addEventListener("click", this._disableJSClicked, false);
}).then(() => {
this.isReady = true;
this.emit("ready");
@ -369,11 +367,15 @@ OptionsPanel.prototype = {
}.bind(menulist));
}
this.target.client.attachTab(this.target.activeTab._actor, (response) => {
this._origJavascriptEnabled = response.javascriptEnabled;
this._populateDisableJSCheckbox();
});
if (this.target.activeTab) {
this.target.client.attachTab(this.target.activeTab._actor, (response) => {
this._origJavascriptEnabled = response.javascriptEnabled;
this.disableJSNode.checked = !this._origJavascriptEnabled
this.disableJSNode.addEventListener("click", this._disableJSClicked, false);
});
} else {
this.disableJSNode.hidden = true;
}
},
updateDefaultTheme: function() {
@ -395,11 +397,6 @@ OptionsPanel.prototype = {
}
},
_populateDisableJSCheckbox: function() {
let cbx = this.panelDoc.getElementById("devtools-disable-javascript");
cbx.checked = !this._origJavascriptEnabled;
},
/**
* Disables JavaScript for the currently loaded tab. We force a page refresh
* here because setting docShell.allowJavascript to true fails to block JS
@ -447,23 +444,21 @@ OptionsPanel.prototype = {
let deferred = promise.defer();
this.destroyPromise = deferred.promise;
let disableJSNode = this.panelDoc.getElementById("devtools-disable-javascript");
disableJSNode.removeEventListener("click", this._disableJSClicked, false);
this._removeListeners();
this.panelWin = this.panelDoc = null;
this._disableJSClicked = null;
if (this.target.activeTab) {
this.disableJSNode.removeEventListener("click", this._disableJSClicked, false);
// If JavaScript is disabled we need to revert it to it's original value.
let options = {
"javascriptEnabled": this._origJavascriptEnabled
};
this.target.activeTab.reconfigure(options, () => {
this.toolbox = null;
deferred.resolve();
}, true);
}
// If JavaScript is disabled we need to revert it to it's original value.
let options = {
"javascriptEnabled": this._origJavascriptEnabled
};
this.target.activeTab.reconfigure(options, () => {
this.toolbox = null;
deferred.resolve();
}, true);
this.panelWin = this.panelDoc = this.disableJSNode = null;
Services.obs.removeObserver(this, kDeveditionChangedNotification);

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

@ -8,7 +8,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
let { debuggerSocketConnect, DebuggerClient } =
let { DebuggerClient } =
Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
let { ViewHelpers } =
Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {});
@ -26,7 +26,7 @@ let gToolbox, gClient;
function connect() {
window.removeEventListener("load", connect);
// Initiate the connection
let transport = debuggerSocketConnect(
let transport = DebuggerClient.socketConnect(
Prefs.chromeDebuggingHost,
Prefs.chromeDebuggingPort
);

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

@ -139,7 +139,7 @@ function initBackend(aUrl) {
info("Initializing a performance front.");
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -234,7 +234,7 @@ function initBackend(aUrl) {
info("Initializing a shader editor front.");
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -129,7 +129,7 @@ function initBackend(aUrl) {
info("Initializing a web audio editor front.");
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -15,7 +15,7 @@ function test() {
// Since we test the connections set below, destroy the server in case it
// was left open.
DebuggerServer.destroy();
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
let tab = yield addTab(TEST_URI);

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

@ -21,7 +21,7 @@
Task.spawn(function* () {
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
let win = yield openWebIDE();

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

@ -21,7 +21,7 @@
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -22,7 +22,7 @@
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -43,7 +43,7 @@
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -223,7 +223,7 @@
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -216,6 +216,7 @@ browser.jar:
skin/classic/browser/devtools/filters.svg (../shared/devtools/filters.svg)
skin/classic/browser/devtools/controls.png (../shared/devtools/images/controls.png)
skin/classic/browser/devtools/controls@2x.png (../shared/devtools/images/controls@2x.png)
skin/classic/browser/devtools/performance-icons.svg (../shared/devtools/images/performance-icons.svg)
skin/classic/browser/devtools/newtab.png (../shared/devtools/images/newtab.png)
skin/classic/browser/devtools/newtab@2x.png (../shared/devtools/images/newtab@2x.png)
skin/classic/browser/devtools/newtab-inverted.png (../shared/devtools/images/newtab-inverted.png)

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

@ -342,6 +342,7 @@ browser.jar:
skin/classic/browser/devtools/filters.svg (../shared/devtools/filters.svg)
skin/classic/browser/devtools/controls.png (../shared/devtools/images/controls.png)
skin/classic/browser/devtools/controls@2x.png (../shared/devtools/images/controls@2x.png)
skin/classic/browser/devtools/performance-icons.svg (../shared/devtools/images/performance-icons.svg)
skin/classic/browser/devtools/newtab.png (../shared/devtools/images/newtab.png)
skin/classic/browser/devtools/newtab@2x.png (../shared/devtools/images/newtab@2x.png)
skin/classic/browser/devtools/newtab-inverted.png (../shared/devtools/images/newtab-inverted.png)

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

@ -0,0 +1,41 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px">
<style>
g {
fill: #edf0f1;
}
g:not(:target) {
display: none;
}
</style>
<g id="call-tree">
<rect x="1px" y="3.5px" width="14px" height="2px" rx="1" ry="1"/>
<rect x="1px" y="7.5px" width="7px" height="2px" rx="1" ry="1"/>
<rect x="11px" y="7.5px" width="4px" height="2px" rx="1" ry="1"/>
<rect x="4px" y="11.5px" width="4px" height="2px" rx="1" ry="1"/>
</g>
<g id="flamechart">
<rect x="1px" y="3px" width="14px" height="4px" style="shape-rendering: crispEdges"/>
<rect x="1px" y="5px" width="3px" height="5px" rx="1" ry="1"/>
<rect x="4px" y="5px" width="3px" height="10px" rx="1" ry="1"/>
<rect x="7px" y="5px" width="5px" height="3px" rx="1" ry="1"/>
<rect x="12px" y="5px" width="3px" height="7px" rx="1" ry="1"/>
</g>
<g id="frame">
<rect x="1px" y="4px" width="2px" height="13px" rx="1" ry="1"/>
<rect x="5px" y="12px" width="2px" height="5px" rx="1" ry="1"/>
<rect x="9px" y="9px" width="2px" height="8px" rx="1" ry="1"/>
<rect x="13px" y="7px" width="2px" height="10px" rx="1" ry="1"/>
</g>
<g id="markers">
<path d="m2.1,2.1h9.6c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-9.6c-.6,0-1.1-.5-1.1-1.1 .1-.6 .5-1.1 1.1-1.1z"/>
<path d="m7.4,5.3h7.4c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-7.4c-.5-.1-1-.5-1-1.1 0-.6 .5-1.1 1-1.1z"/>
<path d="m5.3,8.5h3.2c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-3.2c-.6,0-1.1-.5-1.1-1.1 .1-.6 .5-1.1 1.1-1.1z"/>
<path d="m4.3,11.7h2.1c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-2.1c-.6,0-1.1-.5-1.1-1.1 0-.6 .5-1.1 1.1-1.1z"/>
<path d="m4.3,11.7h2.1c.6,0 1.1,.5 1.1,1.1 0,.6-.5,1.1-1.1,1.1h-2.1c-.6,0-1.1-.5-1.1-1.1 0-.6 .5-1.1 1.1-1.1z" style="transform: translateX(7px)"/>
</g>
<g id="waterfall">
<rect x="1px" y="3px" width="8px" height="2.5px" rx="1" ry="1"/>
<rect x="5px" y="7px" width="8px" height="2.5px" rx="1" ry="1"/>
<rect x="7px" y="11.5px" width="8px" height="2.5px" rx="1" ry="1"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

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

@ -251,6 +251,7 @@ browser.jar:
skin/classic/browser/devtools/filters.svg (../shared/devtools/filters.svg)
skin/classic/browser/devtools/controls.png (../shared/devtools/images/controls.png)
skin/classic/browser/devtools/controls@2x.png (../shared/devtools/images/controls@2x.png)
skin/classic/browser/devtools/performance-icons.svg (../shared/devtools/images/performance-icons.svg)
skin/classic/browser/devtools/newtab.png (../shared/devtools/images/newtab.png)
skin/classic/browser/devtools/newtab@2x.png (../shared/devtools/images/newtab@2x.png)
skin/classic/browser/devtools/newtab-inverted.png (../shared/devtools/images/newtab-inverted.png)
@ -696,6 +697,7 @@ browser.jar:
skin/classic/aero/browser/devtools/filters.svg (../shared/devtools/filters.svg)
skin/classic/aero/browser/devtools/controls.png (../shared/devtools/images/controls.png)
skin/classic/aero/browser/devtools/controls@2x.png (../shared/devtools/images/controls@2x.png)
skin/classic/aero/browser/devtools/performance-icons.svg (../shared/devtools/images/performance-icons.svg)
skin/classic/aero/browser/devtools/newtab.png (../shared/devtools/images/newtab.png)
skin/classic/aero/browser/devtools/newtab@2x.png (../shared/devtools/images/newtab@2x.png)
skin/classic/aero/browser/devtools/newtab-inverted.png (../shared/devtools/images/newtab-inverted.png)

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

@ -583,7 +583,6 @@ MP4Reader::Update(TrackType aTrack)
bool needInput = false;
bool needOutput = false;
bool eos = false;
auto& decoder = GetDecoderData(aTrack);
nsRefPtr<MediaData> output;
{
@ -599,7 +598,6 @@ MP4Reader::Update(TrackType aTrack)
output = decoder.mOutput[0];
decoder.mOutput.RemoveElementAt(0);
}
eos = decoder.mEOS;
}
VLOG("Update(%s) ni=%d no=%d iex=%d or=%d fl=%d",
TrackTypeToStr(aTrack),
@ -617,16 +615,15 @@ MP4Reader::Update(TrackType aTrack)
{
MonitorAutoLock lock(decoder.mMonitor);
MOZ_ASSERT(!decoder.mEOS);
eos = decoder.mEOS = true;
decoder.mEOS = true;
}
// DrainComplete takes care of reporting EOS upwards
decoder.mDecoder->Drain();
}
}
if (needOutput) {
if (output) {
ReturnOutput(output, aTrack);
} else if (eos) {
ReturnEOS(aTrack);
}
}
}
@ -730,9 +727,14 @@ void
MP4Reader::DrainComplete(TrackType aTrack)
{
DecoderData& data = GetDecoderData(aTrack);
MonitorAutoLock mon(data.mMonitor);
data.mDrainComplete = true;
mon.NotifyAll();
bool eos;
{
MonitorAutoLock mon(data.mMonitor);
eos = data.mEOS;
}
if (eos) {
ReturnEOS(aTrack);
}
}
void
@ -771,7 +773,6 @@ MP4Reader::Flush(TrackType aTrack)
{
MonitorAutoLock mon(data.mMonitor);
data.mIsFlushing = true;
data.mDrainComplete = false;
data.mEOS = false;
}
data.mDecoder->Flush();

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

@ -156,7 +156,6 @@ private:
, mInputExhausted(false)
, mError(false)
, mIsFlushing(false)
, mDrainComplete(false)
, mOutputRequested(false)
, mUpdateScheduled(false)
, mEOS(false)
@ -186,7 +185,6 @@ private:
bool mInputExhausted;
bool mError;
bool mIsFlushing;
bool mDrainComplete;
bool mOutputRequested;
bool mUpdateScheduled;
bool mEOS;

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

@ -28,10 +28,9 @@ function startTest(test, token)
var v1 = SetupEME(test, case1token, { onSetKeysFail: setKeysFailed });
var context = new AudioContext();
var node = context.createMediaElementSource(v1);
v1.preload = "auto"; // Required due to "canplay" not firing for MSE unless we do this.
v1.addEventListener("error", bail(case1token + " got error event"));
v1.addEventListener("canplay", function(ev) {
ok(false, TimeStamp(case1token) + " should never reach canplay, as setMediaKeys should fail");
v1.addEventListener("loadeddata", function(ev) {
ok(false, TimeStamp(case1token) + " should never reach loadeddata, as setMediaKeys should fail");
});
manager.started(case1token);
LoadTest(test, v1, case1token);
@ -40,10 +39,9 @@ function startTest(test, token)
// Case 2. creating a MediaElementSource on a media element with a MediaKeys should fail.
var case2token = token + "_case2";
var v2 = SetupEME(test, case2token);
v2.preload = "auto"; // Required due to "canplay" not firing for MSE unless we do this.
v2.addEventListener("error", bail(case2token + " got error event"));
v2.addEventListener("canplay", function(ev) {
ok(true, case2token + " should reach canplay");
v2.addEventListener("loadeddata", function(ev) {
ok(true, case2token + " should reach loadeddata");
var threw = false;
try {
var context = new AudioContext();
@ -61,10 +59,9 @@ function startTest(test, token)
// Case 3. capturing a media element with mozCaptureStream that has a MediaKeys should fail.
var case3token = token + "_case3";
var v3 = SetupEME(test, case3token);
v3.preload = "auto"; // Required due to "canplay" not firing for MSE unless we do this.
v3.addEventListener("error", bail(case3token + " got error event"));
v3.addEventListener("canplay", function(ev) {
ok(true, TimeStamp(case3token) + " should reach canplay");
v3.addEventListener("loadeddata", function(ev) {
ok(true, TimeStamp(case3token) + " should reach loadeddata");
var threw = false;
try {
var stream = v3.mozCaptureStreamUntilEnded();

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

@ -26,9 +26,8 @@
#include "OggReader.h"
// IntelWebMVideoDecoder uses the WMF backend, which is Windows Vista+ only.
#if defined(MOZ_FMP4) && defined(MOZ_WMF)
#if defined(MOZ_PDM_VPX)
#include "IntelWebMVideoDecoder.h"
#define MOZ_PDM_VPX 1
#endif
// Un-comment to enable logging of seek bisections.

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

@ -19,7 +19,8 @@ UNIFIED_SOURCES += [
'WebMReader.cpp',
]
if CONFIG['MOZ_FMP4']:
if CONFIG['MOZ_FMP4'] and CONFIG['MOZ_WMF']:
DEFINES['MOZ_PDM_VPX'] = True
UNIFIED_SOURCES += ['IntelWebMVideoDecoder.cpp']
if CONFIG['MOZ_WEBM_ENCODER']:

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

@ -47,6 +47,56 @@ CSPService::~CSPService()
NS_IMPL_ISUPPORTS(CSPService, nsIContentPolicy, nsIChannelEventSink)
// Helper function to identify protocols not subject to CSP.
bool
subjectToCSP(nsIURI* aURI) {
// The three protocols: data:, blob: and filesystem: share the same
// protocol flag (URI_IS_LOCAL_RESOURCE) with other protocols, like
// chrome:, resource:, moz-icon:, but those three protocols get
// special attention in CSP and are subject to CSP, hence we have
// to make sure those protocols are subject to CSP, see:
// http://www.w3.org/TR/CSP2/#source-list-guid-matching
bool match = false;
nsresult rv = aURI->SchemeIs("data", &match);
if (NS_SUCCEEDED(rv) && match) {
return true;
}
rv = aURI->SchemeIs("blob", &match);
if (NS_SUCCEEDED(rv) && match) {
return true;
}
rv = aURI->SchemeIs("filesystem", &match);
if (NS_SUCCEEDED(rv) && match) {
return true;
}
// finally we have to whitelist "about:" which does not fall in
// any of the two categories underneath but is not subject to CSP.
rv = aURI->SchemeIs("about", &match);
if (NS_SUCCEEDED(rv) && match) {
return false;
}
// Other protocols are not subject to CSP and can be whitelisted:
// * URI_IS_LOCAL_RESOURCE
// e.g. chrome:, data:, blob:, resource:, moz-icon:
// * URI_INHERITS_SECURITY_CONTEXT
// e.g. javascript:
//
// Please note that it should be possible for websites to
// whitelist their own protocol handlers with respect to CSP,
// hence we use protocol flags to accomplish that.
rv = NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_IS_LOCAL_RESOURCE, &match);
if (NS_SUCCEEDED(rv) && match) {
return false;
}
rv = NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT, &match);
if (NS_SUCCEEDED(rv) && match) {
return false;
}
// all other protocols are subject To CSP.
return true;
}
/* nsIContentPolicy implementation */
NS_IMETHODIMP
CSPService::ShouldLoad(uint32_t aContentType,
@ -58,8 +108,9 @@ CSPService::ShouldLoad(uint32_t aContentType,
nsIPrincipal *aRequestPrincipal,
int16_t *aDecision)
{
if (!aContentLocation)
if (!aContentLocation) {
return NS_ERROR_FAILURE;
}
#ifdef PR_LOGGING
{
@ -73,26 +124,14 @@ CSPService::ShouldLoad(uint32_t aContentType,
// default decision, CSP can revise it if there's a policy to enforce
*aDecision = nsIContentPolicy::ACCEPT;
// No need to continue processing if CSP is disabled
if (!sCSPEnabled)
// No need to continue processing if CSP is disabled or if the protocol
// is *not* subject to CSP.
// Please note, the correct way to opt-out of CSP using a custom
// protocolHandler is to set one of the nsIProtocolHandler flags
// that are whitelistet in subjectToCSP()
if (!sCSPEnabled || !subjectToCSP(aContentLocation)) {
return NS_OK;
// shortcut for about: chrome: and resource: and javascript: uris since
// they're not subject to CSP content policy checks.
bool schemeMatch = false;
NS_ENSURE_SUCCESS(aContentLocation->SchemeIs("about", &schemeMatch), NS_OK);
if (schemeMatch)
return NS_OK;
NS_ENSURE_SUCCESS(aContentLocation->SchemeIs("chrome", &schemeMatch), NS_OK);
if (schemeMatch)
return NS_OK;
NS_ENSURE_SUCCESS(aContentLocation->SchemeIs("resource", &schemeMatch), NS_OK);
if (schemeMatch)
return NS_OK;
NS_ENSURE_SUCCESS(aContentLocation->SchemeIs("javascript", &schemeMatch), NS_OK);
if (schemeMatch)
return NS_OK;
}
// These content types are not subject to CSP content policy checks:
// TYPE_CSP_REPORT -- csp can't block csp reports

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

@ -105,6 +105,23 @@ GetLoadContext(nsIEditor* aEditor)
return loadContext.forget();
}
/**
* Helper function for converting underscore to dash in dictionary name,
* ie. en_CA to en-CA. This is required for some Linux distributions which
* use underscore as separator in system-wide installed dictionaries.
* We use it for nsStyleUtil::DashMatchCompare.
*/
static nsString
GetDictNameWithDash(const nsAString& aDictName)
{
nsString dictNameWithDash(aDictName);
int32_t underScore = dictNameWithDash.FindChar('_');
if (underScore != -1) {
dictNameWithDash.Replace(underScore, 1, '-');
}
return dictNameWithDash;
}
/**
* Fetches the dictionary stored in content prefs and maintains state during the
* fetch, which is asynchronous.
@ -603,8 +620,8 @@ nsEditorSpellCheck::SetCurrentDictionary(const nsAString& aDictionary)
} else {
langCode.Assign(aDictionary);
}
if (mPreferredLang.IsEmpty() || !nsStyleUtil::DashMatchCompare(mPreferredLang, langCode, comparator)) {
if (mPreferredLang.IsEmpty() ||
!nsStyleUtil::DashMatchCompare(GetDictNameWithDash(mPreferredLang), langCode, comparator)) {
// When user sets dictionary manually, we store this value associated
// with editor url.
StoreCurrentDictionary(mEditor, aDictionary);
@ -750,12 +767,6 @@ nsEditorSpellCheck::DictionaryFetched(DictionaryFetcher* aFetcher)
// otherwise, get language from preferences
nsAutoString preferedDict(Preferences::GetLocalizedString("spellchecker.dictionary"));
// Replace '_' with '-' in case the user has an underscore stored in their
// pref, see bug 992118 for how this could have happened.
int32_t underScore = preferedDict.FindChar('_');
if (underScore != -1) {
preferedDict.Replace(underScore, 1, '-');
}
if (dictName.IsEmpty()) {
dictName.Assign(preferedDict);
}
@ -794,8 +805,8 @@ nsEditorSpellCheck::DictionaryFetched(DictionaryFetcher* aFetcher)
// try dictionary.spellchecker preference if it starts with langCode (and
// if we haven't tried it already)
if (!preferedDict.IsEmpty() && !dictName.Equals(preferedDict) &&
nsStyleUtil::DashMatchCompare(preferedDict, langCode, comparator)) {
if (!preferedDict.IsEmpty() && !dictName.Equals(preferedDict) &&
nsStyleUtil::DashMatchCompare(GetDictNameWithDash(preferedDict), langCode, comparator)) {
rv = SetCurrentDictionary(preferedDict);
}
@ -823,8 +834,7 @@ nsEditorSpellCheck::DictionaryFetched(DictionaryFetcher* aFetcher)
// We have already tried it
continue;
}
if (nsStyleUtil::DashMatchCompare(dictStr, langCode, comparator) &&
if (nsStyleUtil::DashMatchCompare(GetDictNameWithDash(dictStr), langCode, comparator) &&
NS_SUCCEEDED(SetCurrentDictionary(dictStr))) {
break;
}

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

@ -266,9 +266,9 @@ class UnboundnessFixer
{
CGRect mClipBounds;
CGLayerRef mLayer;
CGContextRef mCg;
CGContextRef mLayerCg;
public:
UnboundnessFixer() : mCg(nullptr) {}
UnboundnessFixer() : mLayerCg(nullptr) {}
CGContextRef Check(CGContextRef baseCg, CompositionOp blend, const Rect* maskBounds = nullptr)
{
@ -287,14 +287,14 @@ class UnboundnessFixer
//XXX: The size here is in default user space units, of the layer relative to the graphics context.
// is the clip bounds still correct if, for example, we have a scale applied to the context?
mLayer = CGLayerCreateWithContext(baseCg, mClipBounds.size, nullptr);
mCg = CGLayerGetContext(mLayer);
mLayerCg = CGLayerGetContext(mLayer);
// CGContext's default to have the origin at the bottom left
// so flip it to the top left and adjust for the origin
// of the layer
CGContextTranslateCTM(mCg, -mClipBounds.origin.x, mClipBounds.origin.y + mClipBounds.size.height);
CGContextScaleCTM(mCg, 1, -1);
CGContextTranslateCTM(mLayerCg, -mClipBounds.origin.x, mClipBounds.origin.y + mClipBounds.size.height);
CGContextScaleCTM(mLayerCg, 1, -1);
return mCg;
return mLayerCg;
} else {
return baseCg;
}
@ -302,12 +302,13 @@ class UnboundnessFixer
void Fix(CGContextRef baseCg)
{
if (mCg) {
if (mLayerCg) {
// we pushed a layer so draw it to baseCg
CGContextTranslateCTM(baseCg, 0, mClipBounds.size.height);
CGContextScaleCTM(baseCg, 1, -1);
mClipBounds.origin.y *= -1;
CGContextDrawLayerAtPoint(baseCg, mClipBounds.origin, mLayer);
CGContextRelease(mCg);
CGContextRelease(mLayerCg);
}
}
};

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

@ -1,3 +1,3 @@
#define ANGLE_COMMIT_HASH "f0cacb827771"
#define ANGLE_COMMIT_HASH "0fb6a60df77b"
#define ANGLE_COMMIT_HASH_SIZE 12
#define ANGLE_COMMIT_DATE "2014-10-28 23:00:12 -0400"
#define ANGLE_COMMIT_DATE "2014-11-28 13:56:37 -0500"

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

@ -16,12 +16,14 @@
#include "common/debug.h"
#include "common/platform.h"
#ifdef ANGLE_ENABLE_D3D11
// DXGISwapChain and DXGIFactory are typedef'd to specific required
// types. The HWND NativeWindow implementation requires IDXGISwapChain
// and IDXGIFactory and the Windows Store NativeWindow
// implementation requires IDXGISwapChain1 and IDXGIFactory2.
typedef IDXGISwapChain DXGISwapChain;
typedef IDXGIFactory DXGIFactory;
#endif
namespace rx
{
@ -37,9 +39,11 @@ class NativeWindow
inline bool getClientRect(LPRECT rect) { return GetClientRect(mWindow, rect) == TRUE; }
inline bool isIconic() { return IsIconic(mWindow) == TRUE; }
#ifdef ANGLE_ENABLE_D3D11
HRESULT createSwapChain(ID3D11Device* device, DXGIFactory* factory,
DXGI_FORMAT format, UINT width, UINT height,
DXGISwapChain** swapChain);
#endif
inline EGLNativeWindowType getNativeWindow() const { return mWindow; }

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

@ -20,6 +20,7 @@ NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window)
{
}
#ifdef ANGLE_ENABLE_D3D11
HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory,
DXGI_FORMAT format, unsigned int width, unsigned int height,
DXGISwapChain** swapChain)
@ -48,4 +49,5 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory
return factory->CreateSwapChain(device, &swapChainDesc, swapChain);
}
};
#endif
};

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

@ -987,6 +987,22 @@ void PadDrawTargetOutFromRegion(RefPtr<DrawTarget> drawTarget, nsIntRegion &regi
return x;
}
static void ensure_memcpy(uint8_t *dst, uint8_t *src, size_t n, uint8_t *bitmap, int stride, int height)
{
if (src + n > bitmap + stride*height) {
MOZ_CRASH("long src memcpy");
}
if (src < bitmap) {
MOZ_CRASH("short src memcpy");
}
if (dst + n > bitmap + stride*height) {
MOZ_CRASH("long dst mempcy");
}
if (dst < bitmap) {
MOZ_CRASH("short dst mempcy");
}
}
static void visitor(void *closure, VisitSide side, int x1, int y1, int x2, int y2) {
LockedBits *lb = static_cast<LockedBits*>(closure);
uint8_t *bitmap = lb->data;
@ -999,12 +1015,14 @@ void PadDrawTargetOutFromRegion(RefPtr<DrawTarget> drawTarget, nsIntRegion &regi
if (y1 > 0) {
x1 = clamp(x1, 0, width - 1);
x2 = clamp(x2, 0, width - 1);
ensure_memcpy(&bitmap[x1*bpp + (y1-1) * stride], &bitmap[x1*bpp + y1 * stride], (x2 - x1) * bpp, bitmap, stride, height);
memcpy(&bitmap[x1*bpp + (y1-1) * stride], &bitmap[x1*bpp + y1 * stride], (x2 - x1) * bpp);
}
} else if (side == VisitSide::BOTTOM) {
if (y1 < height) {
x1 = clamp(x1, 0, width - 1);
x2 = clamp(x2, 0, width - 1);
ensure_memcpy(&bitmap[x1*bpp + y1 * stride], &bitmap[x1*bpp + (y1-1) * stride], (x2 - x1) * bpp, bitmap, stride, height);
memcpy(&bitmap[x1*bpp + y1 * stride], &bitmap[x1*bpp + (y1-1) * stride], (x2 - x1) * bpp);
}
} else if (side == VisitSide::LEFT) {

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

@ -86,13 +86,15 @@ public:
*
* This class is used on the compositor side.
*/
class TextureSource
class TextureSource: public RefCounted<TextureSource>
{
public:
NS_INLINE_DECL_REFCOUNTING(TextureSource)
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(TextureSource)
TextureSource();
virtual ~TextureSource();
/**
* Should be overridden in order to deallocate the data that is associated
* with the rendering backend, such as GL textures.
@ -159,7 +161,6 @@ public:
int NumCompositableRefs() const { return mCompositableCount; }
protected:
virtual ~TextureSource();
RefPtr<TextureSource> mNextSibling;
int mCompositableCount;

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

@ -938,7 +938,15 @@ CompositorD3D11::VerifyBufferSize()
return;
}
mDefaultRT = nullptr;
if (mDefaultRT) {
// Make sure the texture, which belongs to the swapchain, is destroyed
// before resizing the swapchain.
if (mCurrentRT == mDefaultRT) {
mCurrentRT = nullptr;
}
MOZ_ASSERT(mDefaultRT->hasOneRef());
mDefaultRT = nullptr;
}
if (IsRunningInWindowsMetro()) {
hr = mSwapChain->ResizeBuffers(2, mSize.width, mSize.height,

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

@ -454,7 +454,7 @@ js::gc::GCRuntime::markRuntime(JSTracer *trc,
if (!c->zone()->isCollecting())
c->markCrossCompartmentWrappers(trc);
}
Debugger::markCrossCompartmentDebuggerObjectReferents(trc);
Debugger::markAllCrossCompartmentEdges(trc);
}
AutoGCRooter::traceAll(trc);

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

@ -550,14 +550,14 @@ IonBuilder::InliningStatus
IonBuilder::inlineArrayJoin(CallInfo &callInfo)
{
if (callInfo.argc() != 1 || callInfo.constructing())
return InliningStatus_Error;
return InliningStatus_NotInlined;
if (getInlineReturnType() != MIRType_String)
return InliningStatus_Error;
return InliningStatus_NotInlined;
if (callInfo.thisArg()->type() != MIRType_Object)
return InliningStatus_Error;
return InliningStatus_NotInlined;
if (callInfo.getArg(0)->type() != MIRType_String)
return InliningStatus_Error;
return InliningStatus_NotInlined;
callInfo.setImplicitlyUsedUnchecked();

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

@ -2033,8 +2033,8 @@ MacroAssemblerMIPSCompat::store32(Register src, const Address &address)
void
MacroAssemblerMIPSCompat::store32(Imm32 src, const Address &address)
{
move32(src, ScratchRegister);
storePtr(ScratchRegister, address);
move32(src, SecondScratchReg);
storePtr(SecondScratchReg, address);
}
void
@ -2053,8 +2053,8 @@ template <typename T>
void
MacroAssemblerMIPSCompat::storePtr(ImmWord imm, T address)
{
ma_li(ScratchRegister, Imm32(imm.value));
ma_sw(ScratchRegister, address);
ma_li(SecondScratchReg, Imm32(imm.value));
ma_sw(SecondScratchReg, address);
}
template void MacroAssemblerMIPSCompat::storePtr<Address>(ImmWord imm, Address address);
@ -2074,8 +2074,8 @@ template <typename T>
void
MacroAssemblerMIPSCompat::storePtr(ImmGCPtr imm, T address)
{
ma_li(ScratchRegister, imm);
ma_sw(ScratchRegister, address);
ma_li(SecondScratchReg, imm);
ma_sw(SecondScratchReg, address);
}
template void MacroAssemblerMIPSCompat::storePtr<Address>(ImmGCPtr imm, Address address);

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

@ -1675,36 +1675,36 @@ class AssemblerX86Shared : public AssemblerShared
MOZ_CRASH("unexpected operand kind");
}
}
void cmpps(const Operand &src, FloatRegister dest, uint8_t order) {
void cmpps(uint8_t order, const Operand &src, FloatRegister dest) {
MOZ_ASSERT(HasSSE2());
switch (src.kind()) {
case Operand::FPREG:
masm.cmpps_rr(src.fpu(), dest.code(), order);
masm.cmpps_rr(order, src.fpu(), dest.code());
break;
case Operand::MEM_REG_DISP:
masm.cmpps_mr(src.disp(), src.base(), dest.code(), order);
masm.cmpps_mr(order, src.disp(), src.base(), dest.code());
break;
case Operand::MEM_ADDRESS32:
masm.cmpps_mr(src.address(), dest.code(), order);
masm.cmpps_mr(order, src.address(), dest.code());
break;
default:
MOZ_CRASH("unexpected operand kind");
}
}
void cmpeqps(const Operand &src, FloatRegister dest) {
cmpps(src, dest, X86Assembler::ConditionCmp_EQ);
cmpps(X86Assembler::ConditionCmp_EQ, src, dest);
}
void cmpltps(const Operand &src, FloatRegister dest) {
cmpps(src, dest, X86Assembler::ConditionCmp_LT);
cmpps(X86Assembler::ConditionCmp_LT, src, dest);
}
void cmpleps(const Operand &src, FloatRegister dest) {
cmpps(src, dest, X86Assembler::ConditionCmp_LE);
cmpps(X86Assembler::ConditionCmp_LE, src, dest);
}
void cmpunordps(const Operand &src, FloatRegister dest) {
cmpps(src, dest, X86Assembler::ConditionCmp_UNORD);
cmpps(X86Assembler::ConditionCmp_UNORD, src, dest);
}
void cmpneqps(const Operand &src, FloatRegister dest) {
cmpps(src, dest, X86Assembler::ConditionCmp_NEQ);
cmpps(X86Assembler::ConditionCmp_NEQ, src, dest);
}
void rcpps(const Operand &src, FloatRegister dest) {
MOZ_ASSERT(HasSSE2());
@ -2173,13 +2173,13 @@ class AssemblerX86Shared : public AssemblerShared
MOZ_ASSERT(HasSSE2());
masm.sqrtss_rr(src.code(), dest.code());
}
void roundsd(FloatRegister src, FloatRegister dest, X86Assembler::RoundingMode mode) {
void roundsd(X86Assembler::RoundingMode mode, FloatRegister src, FloatRegister dest) {
MOZ_ASSERT(HasSSE41());
masm.roundsd_rr(src.code(), dest.code(), mode);
masm.roundsd_rr(mode, src.code(), dest.code());
}
void roundss(FloatRegister src, FloatRegister dest, X86Assembler::RoundingMode mode) {
void roundss(X86Assembler::RoundingMode mode, FloatRegister src, FloatRegister dest) {
MOZ_ASSERT(HasSSE41());
masm.roundss_rr(src.code(), dest.code(), mode);
masm.roundss_rr(mode, src.code(), dest.code());
}
unsigned insertpsMask(SimdLane sourceLane, SimdLane destLane, unsigned zeroMask = 0)
{

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1688,7 +1688,7 @@ CodeGeneratorX86Shared::visitFloor(LFloor *lir)
return false;
// Round toward -Infinity.
masm.roundsd(input, scratch, X86Assembler::RoundDown);
masm.roundsd(X86Assembler::RoundDown, input, scratch);
if (!bailoutCvttsd2si(scratch, output, lir->snapshot()))
return false;
@ -1751,7 +1751,7 @@ CodeGeneratorX86Shared::visitFloorF(LFloorF *lir)
return false;
// Round toward -Infinity.
masm.roundss(input, scratch, X86Assembler::RoundDown);
masm.roundss(X86Assembler::RoundDown, input, scratch);
if (!bailoutCvttss2si(scratch, output, lir->snapshot()))
return false;
@ -1822,7 +1822,7 @@ CodeGeneratorX86Shared::visitCeil(LCeil *lir)
// x <= -1 or x > -0
masm.bind(&lessThanMinusOne);
// Round toward +Infinity.
masm.roundsd(input, scratch, X86Assembler::RoundUp);
masm.roundsd(X86Assembler::RoundUp, input, scratch);
return bailoutCvttsd2si(scratch, output, lir->snapshot());
}
@ -1878,7 +1878,7 @@ CodeGeneratorX86Shared::visitCeilF(LCeilF *lir)
// x <= -1 or x > -0
masm.bind(&lessThanMinusOne);
// Round toward +Infinity.
masm.roundss(input, scratch, X86Assembler::RoundUp);
masm.roundss(X86Assembler::RoundUp, input, scratch);
return bailoutCvttss2si(scratch, output, lir->snapshot());
}
@ -1958,7 +1958,7 @@ CodeGeneratorX86Shared::visitRound(LRound *lir)
// Add 0.5 and round toward -Infinity. The result is stored in the temp
// register (currently contains 0.5).
masm.addsd(input, temp);
masm.roundsd(temp, scratch, X86Assembler::RoundDown);
masm.roundsd(X86Assembler::RoundDown, temp, scratch);
// Truncate.
if (!bailoutCvttsd2si(scratch, output, lir->snapshot()))
@ -2049,7 +2049,7 @@ CodeGeneratorX86Shared::visitRoundF(LRoundF *lir)
// Add 0.5 and round toward -Infinity. The result is stored in the temp
// register (currently contains 0.5).
masm.addss(input, temp);
masm.roundss(temp, scratch, X86Assembler::RoundDown);
masm.roundss(X86Assembler::RoundDown, temp, scratch);
// Truncate.
if (!bailoutCvttss2si(scratch, output, lir->snapshot()))

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

@ -2082,20 +2082,6 @@ size_t ArenaHeader::countUsedCells()
return Arena::thingsPerArena(getThingSize()) - countFreeCells();
}
/*
* Iterate throught the list and count the number of cells used.
*
* We may be able to precalculate this while sweeping and store the result
* somewhere.
*/
size_t ArenaList::countUsedCells()
{
size_t count = 0;
for (ArenaHeader *arena = head_; arena; arena = arena->next)
count += arena->countUsedCells();
return count;
}
ArenaHeader *
ArenaList::removeRemainingArenas(ArenaHeader **arenap, const AutoLockGC &lock)
{
@ -2153,7 +2139,12 @@ ArenaList::pickArenasToRelocate(JSRuntime *runtime)
ArenaHeader **arenap = cursorp_; // Next arena to consider
size_t previousFreeCells = 0; // Count of free cells before
size_t followingUsedCells = countUsedCells(); // Count of used cells after
// Count of used cells after arenap.
size_t followingUsedCells = 0;
for (ArenaHeader *arena = *arenap; arena; arena = arena->next)
followingUsedCells += arena->countUsedCells();
mozilla::DebugOnly<size_t> lastFreeCells(0);
size_t cellsPerArena = Arena::thingsPerArena((*arenap)->getThingSize());
@ -2662,7 +2653,7 @@ GCRuntime::updatePointersToRelocatedCells()
// Mark roots to update them.
markRuntime(&trc, MarkRuntime);
Debugger::markAll(&trc);
Debugger::markCrossCompartmentDebuggerObjectReferents(&trc);
Debugger::markAllCrossCompartmentEdges(&trc);
for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
WeakMapBase::markAll(c, &trc);

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

@ -503,7 +503,6 @@ class ArenaList {
}
#ifdef JSGC_COMPACTING
size_t countUsedCells();
ArenaHeader *removeRemainingArenas(ArenaHeader **arenap, const AutoLockGC &lock);
ArenaHeader *pickArenasToRelocate(JSRuntime *runtime);
ArenaHeader *relocateArenas(ArenaHeader *toRelocate, ArenaHeader *relocated);

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

@ -93,6 +93,11 @@ enum {
JSSLOT_DEBUGSOURCE_COUNT
};
void DebuggerObject_trace(JSTracer *trc, JSObject *obj);
void DebuggerEnv_trace(JSTracer *trc, JSObject *obj);
void DebuggerScript_trace(JSTracer *trc, JSObject *obj);
void DebuggerSource_trace(JSTracer *trc, JSObject *obj);
/*** Utils ***************************************************************************************/
@ -2073,17 +2078,12 @@ Debugger::setObservesAllExecution(JSContext *cx, IsObserving observing)
/*** Debugger JSObjects **************************************************************************/
void
Debugger::markKeysInCompartment(JSTracer *trc)
Debugger::markCrossCompartmentEdges(JSTracer *trc)
{
/*
* WeakMap::Range is deliberately private, to discourage C++ code from
* enumerating WeakMap keys. However in this case we need access, so we
* make a base-class reference. Range is public in HashMap.
*/
objects.markKeys(trc);
environments.markKeys(trc);
scripts.markKeys(trc);
sources.markKeys(trc);
objects.markCrossCompartmentEdges<DebuggerObject_trace>(trc);
environments.markCrossCompartmentEdges<DebuggerEnv_trace>(trc);
scripts.markCrossCompartmentEdges<DebuggerScript_trace>(trc);
sources.markCrossCompartmentEdges<DebuggerSource_trace>(trc);
}
/*
@ -2091,35 +2091,30 @@ Debugger::markKeysInCompartment(JSTracer *trc)
* discovered that the WeakMap was live; that is, some object containing the
* WeakMap was marked during mark phase.
*
* However, during compartment GC, we have to do something about
* cross-compartment WeakMaps in non-GC'd compartments. If their keys and values
* might need to be marked, we have to do it manually.
* However, during zone GC, we have to do something about cross-compartment
* edges in non-GC'd compartments. Since the source may be live, we
* conservatively assume it is and mark the edge.
*
* Each Debugger object keeps found cross-compartment WeakMaps: objects, scripts,
* script source objects, and environments. They have the nice property that all
* their values are in the same compartment as the Debugger object, so we only
* need to mark the keys. We must simply mark all keys that are in a compartment
* being GC'd.
* Each Debugger object keeps four cross-compartment WeakMaps: objects, scripts,
* script source objects, and environments. They have the property that all
* their values are in the same compartment as the Debugger object, but we have
* to mark the keys and the private pointer in the wrapper object.
*
* We must scan all Debugger objects regardless of whether they *currently*
* have any debuggees in a compartment being GC'd, because the WeakMap
* entries persist even when debuggees are removed.
* We must scan all Debugger objects regardless of whether they *currently* have
* any debuggees in a compartment being GC'd, because the WeakMap entries
* persist even when debuggees are removed.
*
* This happens during the initial mark phase, not iterative marking, because
* all the edges being reported here are strong references.
*/
/* static */ void
Debugger::markCrossCompartmentDebuggerObjectReferents(JSTracer *trc)
Debugger::markAllCrossCompartmentEdges(JSTracer *trc)
{
JSRuntime *rt = trc->runtime();
/*
* Mark all objects in comp that are referents of Debugger.Objects in other
* compartments.
*/
for (Debugger *dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
if (!dbg->object->zone()->isCollecting())
dbg->markKeysInCompartment(trc);
dbg->markCrossCompartmentEdges(trc);
}
}
@ -2213,7 +2208,6 @@ Debugger::markAll(JSTracer *trc)
GlobalObjectSet &debuggees = dbg->debuggees;
for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) {
GlobalObject *global = e.front();
MarkObjectUnbarriered(trc, &global, "Global Object");
if (global != e.front())
e.rekeyFront(global);
@ -3814,7 +3808,7 @@ GetScriptReferent(JSObject *obj)
return static_cast<JSScript *>(obj->as<NativeObject>().getPrivate());
}
static void
void
DebuggerScript_trace(JSTracer *trc, JSObject *obj)
{
/* This comes from a private pointer, so no barrier needed. */
@ -4765,7 +4759,7 @@ GetSourceReferent(JSObject *obj)
return static_cast<ScriptSourceObject *>(obj->as<NativeObject>().getPrivate());
}
static void
void
DebuggerSource_trace(JSTracer *trc, JSObject *obj)
{
/*
@ -5845,7 +5839,7 @@ static const JSFunctionSpec DebuggerFrame_methods[] = {
/*** Debugger.Object *****************************************************************************/
static void
void
DebuggerObject_trace(JSTracer *trc, JSObject *obj)
{
/*
@ -6753,7 +6747,7 @@ static const JSFunctionSpec DebuggerObject_methods[] = {
/*** Debugger.Environment ************************************************************************/
static void
void
DebuggerEnv_trace(JSTracer *trc, JSObject *obj)
{
/*

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

@ -36,10 +36,9 @@ class Breakpoint;
class DebuggerMemory;
/*
* A weakmap that supports the keys being in different compartments to the
* values, although all values must be in the same compartment.
*
* The Key and Value classes must support the compartment() method.
* A weakmap from GC thing keys to JSObject values that supports the keys being
* in different compartments to the values. All values must be in the same
* compartment.
*
* The purpose of this is to allow the garbage collector to easily find edges
* from debugee object compartments to debugger compartments when calculating
@ -55,10 +54,13 @@ class DebuggerMemory;
* debugger compartments. If it is false, we assert that such entries are never
* created.
*/
template <class Key, class Value, bool InvisibleKeysOk=false>
class DebuggerWeakMap : private WeakMap<Key, Value, DefaultHasher<Key> >
template <class UnbarrieredKey, bool InvisibleKeysOk=false>
class DebuggerWeakMap : private WeakMap<PreBarriered<UnbarrieredKey>, RelocatablePtrObject>
{
private:
typedef PreBarriered<UnbarrieredKey> Key;
typedef RelocatablePtrObject Value;
typedef HashMap<JS::Zone *,
uintptr_t,
DefaultHasher<JS::Zone *>,
@ -112,8 +114,10 @@ class DebuggerWeakMap : private WeakMap<Key, Value, DefaultHasher<Key> >
}
public:
void markKeys(JSTracer *tracer) {
template <void (traceValueEdges)(JSTracer *, JSObject *)>
void markCrossCompartmentEdges(JSTracer *tracer) {
for (Enum e(*static_cast<Base *>(this)); !e.empty(); e.popFront()) {
traceValueEdges(tracer, e.front().value());
Key key = e.front().key();
gc::Mark(tracer, &key, "Debugger WeakMap key");
if (key != e.front().key())
@ -282,15 +286,15 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
FrameMap frames;
/* An ephemeral map from JSScript* to Debugger.Script instances. */
typedef DebuggerWeakMap<PreBarrieredScript, RelocatablePtrObject> ScriptWeakMap;
typedef DebuggerWeakMap<JSScript*> ScriptWeakMap;
ScriptWeakMap scripts;
/* The map from debuggee source script objects to their Debugger.Source instances. */
typedef DebuggerWeakMap<PreBarrieredObject, RelocatablePtrObject, true> SourceWeakMap;
typedef DebuggerWeakMap<JSObject*, true> SourceWeakMap;
SourceWeakMap sources;
/* The map from debuggee objects to their Debugger.Object instances. */
typedef DebuggerWeakMap<PreBarrieredObject, RelocatablePtrObject> ObjectWeakMap;
typedef DebuggerWeakMap<JSObject*> ObjectWeakMap;
ObjectWeakMap objects;
/* The map from debuggee Envs to Debugger.Environment instances. */
@ -356,7 +360,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
static void traceObject(JSTracer *trc, JSObject *obj);
void trace(JSTracer *trc);
static void finalize(FreeOp *fop, JSObject *obj);
void markKeysInCompartment(JSTracer *tracer);
void markCrossCompartmentEdges(JSTracer *tracer);
static const Class jsclass;
@ -506,7 +510,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
* Debugger objects that are definitely live but not yet marked, it marks
* them and returns true. If not, it returns false.
*/
static void markCrossCompartmentDebuggerObjectReferents(JSTracer *tracer);
static void markAllCrossCompartmentEdges(JSTracer *tracer);
static bool markAllIteratively(GCMarker *trc);
static void markAll(JSTracer *trc);
static void sweepAll(FreeOp *fop);

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

@ -3382,13 +3382,16 @@ PropertyProvider::SetupJustificationSpacing(bool aPostReflow)
return;
}
// Remember that textrun measurements are in the run's orientation,
// so its advance "width" is actually a height in vertical writing modes,
// corresponding to the inline-direction of the frame.
gfxFloat naturalWidth =
mTextRun->GetAdvanceWidth(mStart.GetSkippedOffset(),
GetSkippedDistance(mStart, realEnd), this);
if (mFrame->GetStateBits() & TEXT_HYPHEN_BREAK) {
naturalWidth += GetHyphenWidth();
}
mJustificationSpacing = mFrame->GetSize().width - naturalWidth;
mJustificationSpacing = mFrame->ISize() - naturalWidth;
if (mJustificationSpacing <= 0) {
// No space available
return;

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

@ -7295,7 +7295,7 @@ var RemoteDebugger = {
_start: function rd_start() {
try {
if (!DebuggerServer.initialized) {
DebuggerServer.init(this._showConnectionPrompt.bind(this));
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.registerModule("resource://gre/modules/dbg-browser-actors.js");
}
@ -7303,7 +7303,8 @@ var RemoteDebugger = {
let pathOrPort = this._getPath();
if (!pathOrPort)
pathOrPort = this._getPort();
DebuggerServer.openListener(pathOrPort);
let listener = DebuggerServer.openListener(pathOrPort);
listener.allowConnection = this._showConnectionPrompt.bind(this);
dump("Remote debugger listening at path " + pathOrPort);
} catch(e) {
dump("Remote debugger didn't start: " + e);

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

@ -1172,7 +1172,6 @@ uint32_t tlsIntoleranceTelemetryBucket(PRErrorCode err)
case SSL_ERROR_NO_CYPHER_OVERLAP: return 7;
case SSL_ERROR_BAD_SERVER: return 8;
case SSL_ERROR_BAD_BLOCK_PADDING: return 9;
case SSL_ERROR_UNSUPPORTED_VERSION: return 10;
case SSL_ERROR_PROTOCOL_VERSION_ALERT: return 11;
case SSL_ERROR_RX_MALFORMED_FINISHED: return 12;
case SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE: return 13;

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

@ -2,7 +2,7 @@ import os
from setuptools import setup, find_packages
import sys
version = '0.8.4'
version = '0.8.5'
# dependencies
with open('requirements.txt') as f:

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

@ -4,7 +4,7 @@
from setuptools import setup
PACKAGE_VERSION = '1.0'
PACKAGE_VERSION = '1.1'
dependencies = ['mozdevice >= 0.44',
'mozfile >= 1.0',

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

@ -354,7 +354,7 @@ function _initDebugging(port) {
}
let {DebuggerServer} = Components.utils.import('resource://gre/modules/devtools/dbg-server.jsm', {});
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.addActors("resource://testing-common/dbg-actors.js");
@ -406,7 +406,8 @@ function _initDebugging(port) {
do_print("*******************************************************************");
do_print("")
DebuggerServer.openListener(port);
let listener = DebuggerServer.openListener(port);
listener.allowConnection = () => true;
// spin an event loop until the debugger connects.
let thr = Components.classes["@mozilla.org/thread-manager;1"]

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

@ -28,14 +28,14 @@ function connect(onDone) {
let observer = {
observe: function (subject, topic, data) {
Services.obs.removeObserver(observer, "debugger-server-started");
let transport = debuggerSocketConnect("127.0.0.1", 6000);
let transport = DebuggerClient.socketConnect("127.0.0.1", 6000);
startClient(transport, onDone);
}
};
Services.obs.addObserver(observer, "debugger-server-started", false);
} else {
// Initialize a loopback remote protocol connection
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
// We need to register browser actors to have `listTabs` working
// and also have a root actor
DebuggerServer.addBrowserActors();

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

@ -21,7 +21,7 @@ let gClient, gActor, gActorFront;
function connect(onDone) {
// Initialize a loopback remote protocol connection
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
// We need to register browser actors to have `listTabs` working
// and also have a root actor
DebuggerServer.addBrowserActors();

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

@ -231,10 +231,10 @@ Connection.prototype = {
transport = DebuggerServer.connectPipe();
} else {
try {
transport = debuggerSocketConnect(this.host, this.port);
transport = DebuggerClient.socketConnect(this.host, this.port);
} catch (e) {
// In some cases, especially on Mac, the openOutputStream call in
// debuggerSocketConnect may throw NS_ERROR_NOT_INITIALIZED.
// DebuggerClient.socketConnect may throw NS_ERROR_NOT_INITIALIZED.
// It occurs when we connect agressively to the simulator,
// and keep trying to open a socket to the server being started in
// the simulator.
@ -299,4 +299,3 @@ Connection.prototype = {
exports.ConnectionManager = ConnectionManager;
exports.Connection = Connection;

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

@ -21,7 +21,6 @@ this.CC = CC;
this.EXPORTED_SYMBOLS = ["DebuggerTransport",
"DebuggerClient",
"RootClient",
"debuggerSocketConnect",
"LongStringClient",
"EnvironmentClient",
"ObjectClient"];
@ -33,10 +32,6 @@ Cu.import("resource://gre/modules/Services.jsm");
let promise = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js").Promise;
const { defer, resolve, reject } = promise;
XPCOMUtils.defineLazyServiceGetter(this, "socketTransportService",
"@mozilla.org/network/socket-transport-service;1",
"nsISocketTransportService");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
@ -84,6 +79,11 @@ let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader);
loader.loadSubScript("resource://gre/modules/devtools/transport/transport.js", this);
DevToolsUtils.defineLazyGetter(this, "DebuggerSocket", () => {
let { DebuggerSocket } = devtools.require("devtools/toolkit/security/socket");
return DebuggerSocket;
});
/**
* TODO: Get rid of this API in favor of EventTarget (bug 1042642)
*
@ -371,6 +371,12 @@ DebuggerClient.Argument.prototype.getArgument = function (aParams) {
return aParams[this.position];
};
// Expose this to save callers the trouble of importing DebuggerSocket
DebuggerClient.socketConnect = function(host, port) {
// Defined here instead of just copying the function to allow lazy-load
return DebuggerSocket.connect(host, port);
};
DebuggerClient.prototype = {
/**
* Connect to the server and start exchanging protocol messages.
@ -2578,33 +2584,3 @@ EnvironmentClient.prototype = {
};
eventSource(EnvironmentClient.prototype);
/**
* Connects to a debugger server socket and returns a DebuggerTransport.
*
* @param aHost string
* The host name or IP address of the debugger server.
* @param aPort number
* The port number of the debugger server.
*/
this.debuggerSocketConnect = function (aHost, aPort)
{
let s = socketTransportService.createTransport(null, 0, aHost, aPort, null);
// By default the CONNECT socket timeout is very long, 65535 seconds,
// so that if we race to be in CONNECT state while the server socket is still
// initializing, the connection is stuck in connecting state for 18.20 hours!
s.setTimeout(Ci.nsISocketTransport.TIMEOUT_CONNECT, 2);
// openOutputStream may throw NS_ERROR_NOT_INITIALIZED if we hit some race
// where the nsISocketTransport gets shutdown in between its instantiation and
// the call to this method.
let transport;
try {
transport = new DebuggerTransport(s.openInputStream(0, 0, 0),
s.openOutputStream(0, 0, 0));
} catch(e) {
DevToolsUtils.reportException("debuggerSocketConnect", e);
throw e;
}
return transport;
}

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

@ -18,7 +18,6 @@
var Cu = require('chrome').Cu;
var debuggerSocketConnect = Cu.import('resource://gre/modules/devtools/dbg-client.jsm', {}).debuggerSocketConnect;
var DebuggerClient = Cu.import('resource://gre/modules/devtools/dbg-client.jsm', {}).DebuggerClient;
var Promise = require('../util/promise').Promise;
@ -72,7 +71,7 @@ RdpConnection.create = function(url) {
this._emit = this._emit.bind(this);
return new Promise(function(resolve, reject) {
this.transport = debuggerSocketConnect(this.host, this.port);
this.transport = DebuggerClient.socketConnect(this.host, this.port);
this.client = new DebuggerClient(this.transport);
this.client.connect(function() {
this.client.listTabs(function(response) {

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

@ -19,3 +19,7 @@ UNIFIED_SOURCES += [
FAIL_ON_WARNINGS = True
FINAL_LIBRARY = 'xul'
EXTRA_JS_MODULES.devtools.security += [
'socket.js',
]

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

@ -0,0 +1,203 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
let { Ci, Cc, CC, Cr } = require("chrome");
let Services = require("Services");
let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
let { dumpn } = DevToolsUtils;
loader.lazyRequireGetter(this, "DebuggerTransport",
"devtools/toolkit/transport/transport", true);
loader.lazyRequireGetter(this, "DebuggerServer",
"devtools/server/main", true);
DevToolsUtils.defineLazyGetter(this, "ServerSocket", () => {
return CC("@mozilla.org/network/server-socket;1",
"nsIServerSocket",
"initSpecialConnection");
});
DevToolsUtils.defineLazyGetter(this, "UnixDomainServerSocket", () => {
return CC("@mozilla.org/network/server-socket;1",
"nsIServerSocket",
"initWithFilename");
});
DevToolsUtils.defineLazyGetter(this, "nsFile", () => {
return CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
});
DevToolsUtils.defineLazyGetter(this, "socketTransportService", () => {
return Cc["@mozilla.org/network/socket-transport-service;1"]
.getService(Ci.nsISocketTransportService);
});
const DBG_STRINGS_URI = "chrome://global/locale/devtools/debugger.properties";
/**
* Connects to a debugger server socket and returns a DebuggerTransport.
*
* @param host string
* The host name or IP address of the debugger server.
* @param port number
* The port number of the debugger server.
*/
function socketConnect(host, port) {
let s = socketTransportService.createTransport(null, 0, host, port, null);
// By default the CONNECT socket timeout is very long, 65535 seconds,
// so that if we race to be in CONNECT state while the server socket is still
// initializing, the connection is stuck in connecting state for 18.20 hours!
s.setTimeout(Ci.nsISocketTransport.TIMEOUT_CONNECT, 2);
// openOutputStream may throw NS_ERROR_NOT_INITIALIZED if we hit some race
// where the nsISocketTransport gets shutdown in between its instantiation and
// the call to this method.
let transport;
try {
transport = new DebuggerTransport(s.openInputStream(0, 0, 0),
s.openOutputStream(0, 0, 0));
} catch(e) {
DevToolsUtils.reportException("socketConnect", e);
throw e;
}
return transport;
}
/**
* Creates a new socket listener for remote connections to the DebuggerServer.
* This helps contain and organize the parts of the server that may differ or
* are particular to one given listener mechanism vs. another.
*/
function SocketListener() {}
/**
* Prompt the user to accept or decline the incoming connection. This is the
* default implementation that products embedding the debugger server may
* choose to override. A separate security handler can be specified for each
* socket via |allowConnection| on a socket listener instance.
*
* @return true if the connection should be permitted, false otherwise
*/
SocketListener.defaultAllowConnection = () => {
let bundle = Services.strings.createBundle(DBG_STRINGS_URI);
let title = bundle.GetStringFromName("remoteIncomingPromptTitle");
let msg = bundle.GetStringFromName("remoteIncomingPromptMessage");
let disableButton = bundle.GetStringFromName("remoteIncomingPromptDisable");
let prompt = Services.prompt;
let flags = prompt.BUTTON_POS_0 * prompt.BUTTON_TITLE_OK +
prompt.BUTTON_POS_1 * prompt.BUTTON_TITLE_CANCEL +
prompt.BUTTON_POS_2 * prompt.BUTTON_TITLE_IS_STRING +
prompt.BUTTON_POS_1_DEFAULT;
let result = prompt.confirmEx(null, title, msg, flags, null, null,
disableButton, null, { value: false });
if (result === 0) {
return true;
}
if (result === 2) {
DebuggerServer.closeAllListeners();
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", false);
}
return false;
};
SocketListener.prototype = {
/**
* Listens on the given port or socket file for remote debugger connections.
*
* @param portOrPath int, string
* If given an integer, the port to listen on.
* Otherwise, the path to the unix socket domain file to listen on.
*/
open: function(portOrPath) {
let flags = Ci.nsIServerSocket.KeepWhenOffline;
// A preference setting can force binding on the loopback interface.
if (Services.prefs.getBoolPref("devtools.debugger.force-local")) {
flags |= Ci.nsIServerSocket.LoopbackOnly;
}
try {
let backlog = 4;
let port = Number(portOrPath);
if (port) {
this._socket = new ServerSocket(port, flags, backlog);
} else {
let file = nsFile(portOrPath);
if (file.exists())
file.remove(false);
this._socket = new UnixDomainServerSocket(file, parseInt("666", 8),
backlog);
}
this._socket.asyncListen(this);
} catch (e) {
dumpn("Could not start debugging listener on '" + portOrPath + "': " + e);
throw Cr.NS_ERROR_NOT_AVAILABLE;
}
},
/**
* Closes the SocketListener. Notifies the server to remove the listener from
* the set of active SocketListeners.
*/
close: function() {
this._socket.close();
DebuggerServer._removeListener(this);
},
/**
* Gets the port that a TCP socket listener is listening on, or null if this
* is not a TCP socket (so there is no port).
*/
get port() {
if (!this._socket) {
return null;
}
return this._socket.port;
},
/**
* Prompt the user to accept or decline the incoming connection. The default
* implementation is used unless this is overridden on a particular socket
* listener instance.
*
* @return true if the connection should be permitted, false otherwise
*/
allowConnection: SocketListener.defaultAllowConnection,
// nsIServerSocketListener implementation
onSocketAccepted:
DevToolsUtils.makeInfallible(function(socket, socketTransport) {
if (Services.prefs.getBoolPref("devtools.debugger.prompt-connection") &&
!this.allowConnection()) {
return;
}
dumpn("New debugging connection on " +
socketTransport.host + ":" + socketTransport.port);
let input = socketTransport.openInputStream(0, 0, 0);
let output = socketTransport.openOutputStream(0, 0, 0);
let transport = new DebuggerTransport(input, output);
DebuggerServer._onConnection(transport);
}, "SocketListener.onSocketAccepted"),
onStopListening: function(socket, status) {
dumpn("onStopListening, status: " + status);
}
};
// TODO: These high-level entry points will branch based on TLS vs. bare TCP as
// part of bug 1059001.
exports.DebuggerSocket = {
createListener() {
return new SocketListener();
},
connect(host, port) {
return socketConnect(host, port);
}
};

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

@ -2121,21 +2121,7 @@ ThreadActor.prototype = {
* @returns true, if the script can be added, false otherwise.
*/
_allowSource: function (aSource) {
let url = getSourceURL(aSource);
if (isHiddenSource(aSource)) {
return false;
}
// Ignore XBL bindings for content debugging.
if (url && url.indexOf("chrome://") == 0) {
return false;
}
// Ignore about:* pages for content debugging.
if (url && url.indexOf("about:") == 0) {
return false;
}
return true;
return !isHiddenSource(aSource);
},
/**
@ -5201,16 +5187,7 @@ update(ChromeDebuggerActor.prototype, {
constructor: ChromeDebuggerActor,
// A constant prefix that will be used to form the actor ID by the server.
actorPrefix: "chromeDebugger",
/**
* Override the eligibility check for scripts and sources to make sure every
* script and source with a URL is stored when debugging chrome.
*/
_allowSource: function(aSource) {
return !isHiddenSource(aSource);
}
actorPrefix: "chromeDebugger"
});
exports.ChromeDebuggerActor = ChromeDebuggerActor;

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

@ -13,13 +13,18 @@
let { Ci, Cc, CC, Cu, Cr } = require("chrome");
let Services = require("Services");
let { ActorPool, RegisteredActorFactory, ObservedActorFactory } = require("devtools/server/actors/common");
let { DebuggerTransport, LocalDebuggerTransport, ChildDebuggerTransport } =
let { LocalDebuggerTransport, ChildDebuggerTransport } =
require("devtools/toolkit/transport/transport");
let DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
let { dumpn, dumpv, dbg_assert } = DevToolsUtils;
let EventEmitter = require("devtools/toolkit/event-emitter");
let Debugger = require("Debugger");
DevToolsUtils.defineLazyGetter(this, "DebuggerSocket", () => {
let { DebuggerSocket } = require("devtools/toolkit/security/socket");
return DebuggerSocket;
});
// On B2G, `this` != Global scope, so `Ci` won't be binded on `this`
// (i.e. this.Ci is undefined) Then later, when using loadSubScript,
// Ci,... won't be defined for sub scripts.
@ -42,12 +47,6 @@ Object.defineProperty(this, "Components", {
get: function () require("chrome").components
});
const DBG_STRINGS_URI = "chrome://global/locale/devtools/debugger.properties";
DevToolsUtils.defineLazyGetter(this, "nsFile", () => {
return CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
});
if (isWorker) {
dumpn.wantLogging = true;
dumpv.wantVerbose = true;
@ -84,19 +83,6 @@ this.resolve = resolve;
this.reject = reject;
this.all = all;
// XPCOM constructors
DevToolsUtils.defineLazyGetter(this, "ServerSocket", () => {
return CC("@mozilla.org/network/server-socket;1",
"nsIServerSocket",
"initSpecialConnection");
});
DevToolsUtils.defineLazyGetter(this, "UnixDomainServerSocket", () => {
return CC("@mozilla.org/network/server-socket;1",
"nsIServerSocket",
"initWithFilename");
});
var gRegisteredModules = Object.create(null);
/**
@ -170,12 +156,6 @@ var DebuggerServer = {
LONG_STRING_INITIAL_LENGTH: 1000,
LONG_STRING_READ_LENGTH: 65 * 1024,
/**
* A handler function that prompts the user to accept or decline the incoming
* connection.
*/
_allowConnection: null,
/**
* The windowtype of the chrome window to use for actors that use the global
* window (i.e the global style editor). Set this to your main window type,
@ -183,48 +163,15 @@ var DebuggerServer = {
*/
chromeWindowType: null,
/**
* Prompt the user to accept or decline the incoming connection. This is the
* default implementation that products embedding the debugger server may
* choose to override.
*
* @return true if the connection should be permitted, false otherwise
*/
_defaultAllowConnection: function DS__defaultAllowConnection() {
let bundle = Services.strings.createBundle(DBG_STRINGS_URI)
let title = bundle.GetStringFromName("remoteIncomingPromptTitle");
let msg = bundle.GetStringFromName("remoteIncomingPromptMessage");
let disableButton = bundle.GetStringFromName("remoteIncomingPromptDisable");
let prompt = Services.prompt;
let flags = prompt.BUTTON_POS_0 * prompt.BUTTON_TITLE_OK +
prompt.BUTTON_POS_1 * prompt.BUTTON_TITLE_CANCEL +
prompt.BUTTON_POS_2 * prompt.BUTTON_TITLE_IS_STRING +
prompt.BUTTON_POS_1_DEFAULT;
let result = prompt.confirmEx(null, title, msg, flags, null, null,
disableButton, null, { value: false });
if (result == 0) {
return true;
}
if (result == 2) {
DebuggerServer.closeAllListeners();
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", false);
}
return false;
},
/**
* Initialize the debugger server.
*
* @param function aAllowConnectionCallback
* The embedder-provider callback, that decides whether an incoming
* remote protocol conection should be allowed or refused.
*/
init: function DS_init(aAllowConnectionCallback) {
init: function DS_init() {
if (this.initialized) {
return;
}
this.initTransport(aAllowConnectionCallback);
this.initTransport();
this._initialized = true;
},
@ -234,12 +181,8 @@ var DebuggerServer = {
/**
* Initialize the debugger server's transport variables. This can be
* in place of init() for cases where the jsdebugger isn't needed.
*
* @param function aAllowConnectionCallback
* The embedder-provider callback, that decides whether an incoming
* remote protocol conection should be allowed or refused.
*/
initTransport: function DS_initTransport(aAllowConnectionCallback) {
initTransport: function DS_initTransport() {
if (this._transportInitialized) {
return;
}
@ -247,9 +190,6 @@ var DebuggerServer = {
this._connections = {};
this._nextConnID = 0;
this._transportInitialized = true;
this._allowConnection = aAllowConnectionCallback ?
aAllowConnectionCallback :
this._defaultAllowConnection;
},
get initialized() this._initialized,
@ -278,7 +218,6 @@ var DebuggerServer = {
this.closeAllListeners();
this.globalActorFactories = {};
this.tabActorFactories = {};
this._allowConnection = null;
this._transportInitialized = false;
this._initialized = false;
@ -621,7 +560,7 @@ var DebuggerServer = {
}
this._checkInit();
let listener = new SocketListener(this);
let listener = DebuggerSocket.createListener();
listener.open(portOrPath);
this._listeners.push(listener);
return listener;
@ -1088,94 +1027,6 @@ if (this.exports) {
exports.ActorPool = ActorPool;
}
/**
* Creates a new socket listener for remote connections to a given
* DebuggerServer. This helps contain and organize the parts of the server that
* may differ or are particular to one given listener mechanism vs. another.
*/
function SocketListener(server) {
this._server = server;
}
SocketListener.prototype = {
/**
* Listens on the given port or socket file for remote debugger connections.
*
* @param portOrPath int, string
* If given an integer, the port to listen on.
* Otherwise, the path to the unix socket domain file to listen on.
*/
open: function(portOrPath) {
let flags = Ci.nsIServerSocket.KeepWhenOffline;
// A preference setting can force binding on the loopback interface.
if (Services.prefs.getBoolPref("devtools.debugger.force-local")) {
flags |= Ci.nsIServerSocket.LoopbackOnly;
}
try {
let backlog = 4;
let port = Number(portOrPath);
if (port) {
this._socket = new ServerSocket(port, flags, backlog);
} else {
let file = nsFile(portOrPath);
if (file.exists())
file.remove(false);
this._socket = new UnixDomainServerSocket(file, parseInt("666", 8),
backlog);
}
this._socket.asyncListen(this);
} catch (e) {
dumpn("Could not start debugging listener on '" + portOrPath + "': " + e);
throw Cr.NS_ERROR_NOT_AVAILABLE;
}
},
/**
* Closes the SocketListener. Notifies the server to remove the listener from
* the set of active SocketListeners.
*/
close: function() {
this._socket.close();
this._server._removeListener(this);
this._server = null;
},
/**
* Gets the port that a TCP socket listener is listening on, or null if this
* is not a TCP socket (so there is no port).
*/
get port() {
if (!this._socket) {
return null;
}
return this._socket.port;
},
// nsIServerSocketListener implementation
onSocketAccepted:
DevToolsUtils.makeInfallible(function(aSocket, aTransport) {
if (Services.prefs.getBoolPref("devtools.debugger.prompt-connection") &&
!this._server._allowConnection()) {
return;
}
dumpn("New debugging connection on " +
aTransport.host + ":" + aTransport.port);
let input = aTransport.openInputStream(0, 0, 0);
let output = aTransport.openOutputStream(0, 0, 0);
let transport = new DebuggerTransport(input, output);
this._server._onConnection(transport);
}, "SocketListener.onSocketAccepted"),
onStopListening: function(aSocket, status) {
dumpn("onStopListening, status: " + status);
}
};
/**
* Creates a DebuggerServerConnection.
*

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

@ -56,7 +56,7 @@ function initDebuggerServer() {
// tests.
DebuggerServer.destroy();
} catch (ex) { }
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -16,7 +16,7 @@ SimpleTest.registerCleanupFunction(function() {
if (!DebuggerServer.initialized) {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
SimpleTest.registerCleanupFunction(function() {
DebuggerServer.destroy();

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

@ -20,7 +20,7 @@ let { require } = devtools;
let { MemoryFront } = require("devtools/server/actors/memory");
function startServerAndGetSelectedTabMemory() {
DebuggerServer.init(() => true);
DebuggerServer.init();
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());

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

@ -44,7 +44,7 @@ function runTests() {
// Instantiate a minimal server
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
}
if (!DebuggerServer.createRootActor) {
DebuggerServer.addBrowserActors();

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

@ -68,7 +68,7 @@ function runTests() {
// Instantiate a minimal server
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
}
if (!DebuggerServer.createRootActor) {
DebuggerServer.addBrowserActors();

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

@ -23,7 +23,7 @@ window.onload = function() {
Cu.import("resource://gre/modules/Services.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -29,7 +29,7 @@ window.onload = function() {
var {getDeviceFront} = devtools.require("devtools/server/actors/device");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -35,7 +35,7 @@ window.onload = function() {
var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -35,7 +35,7 @@ window.onload = function() {
var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -38,7 +38,7 @@ window.onload = function() {
var TOTAL_TIME = 5000;
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}

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

@ -34,7 +34,7 @@ window.onload = function() {
var {FramerateFront} = devtools.require("devtools/server/actors/framerate");
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());

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

@ -27,7 +27,7 @@ function runTests() {
var {getPreferenceFront} = devtools.require("devtools/server/actors/preference");
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
var client = new DebuggerClient(DebuggerServer.connectPipe());

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

@ -16,7 +16,7 @@ function run_test()
DebuggerServer.addActors("resource://test/pre_init_global_actors.js");
DebuggerServer.addActors("resource://test/pre_init_tab_actors.js");
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
DebuggerServer.addActors("resource://test/post_init_global_actors.js");

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

@ -28,7 +28,7 @@ function run_test()
{
DebuggerServer.addGlobalActor(TestActor);
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
add_test(init);

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

@ -15,7 +15,7 @@ function run_test()
check_except(DebuggerServer.connectPipe);
// Allow incoming connections.
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
// These should still fail because we haven't added a createRootActor
// implementation yet.

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

@ -11,7 +11,7 @@ function run_test()
{
let {EventLoopLagFront} = devtools.require("devtools/server/actors/eventlooplag");
DebuggerServer.init(function () { return true; });
DebuggerServer.init();
DebuggerServer.addBrowserActors();
// As seen in EventTracer.cpp

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