Skip to content

Commit

Permalink
Merge fx-team to m-c.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvandermeulen committed Jan 27, 2014
2 parents 805da2b + 1f78f08 commit c574bba
Show file tree
Hide file tree
Showing 63 changed files with 1,470 additions and 944 deletions.
30 changes: 7 additions & 23 deletions b2g/chrome/content/shell.js
Expand Up @@ -1088,28 +1088,12 @@ let RemoteDebugger = {
if (!DebuggerServer.initialized) {
// Ask for remote connections.
DebuggerServer.init(this.prompt.bind(this));
DebuggerServer.chromeWindowType = "navigator:browser";
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webbrowser.js");
// Prevent tab actors to be loaded in parent process,
// unless we enable certified apps debugging
if (!Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps")) {
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/script.js");
DebuggerServer.addGlobalActor(DebuggerServer.ChromeDebuggerActor, "chromeDebugger");
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webconsole.js");
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/gcli.js");
if ("nsIProfiler" in Ci) {
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/profiler.js");
}
DebuggerServer.registerModule("devtools/server/actors/inspector");
DebuggerServer.registerModule("devtools/server/actors/styleeditor");
DebuggerServer.registerModule("devtools/server/actors/stylesheets");
DebuggerServer.registerModule("devtools/server/actors/tracer");
DebuggerServer.registerModule("devtools/server/actors/webgl");
DebuggerServer.registerModule("devtools/server/actors/memory");
}

// Add Firefox-specific actors, but prevent tab actors to be loaded in
// the parent process, unless we enable certified apps debugging.
let restrictPrivileges = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps");
DebuggerServer.addBrowserActors("navigator:browser", restrictPrivileges);
DebuggerServer.addActors('chrome://browser/content/dbg-browser-actors.js');
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webapps.js");
DebuggerServer.registerModule("devtools/server/actors/device");

#ifdef MOZ_WIDGET_GONK
DebuggerServer.onConnectionChange = function(what) {
Expand All @@ -1122,8 +1106,8 @@ let RemoteDebugger = {
"/data/local/debugger-socket";
try {
DebuggerServer.openListener(path);
// Temporary event, until bug 942756 lands and offer a way to know
// when the server is up and running
// 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);
this._running = true;
} catch (e) {
Expand Down
6 changes: 5 additions & 1 deletion browser/base/content/browser.css
Expand Up @@ -786,7 +786,11 @@ chatbar {

/*** Visibility of downloads indicator controls ***/

#downloads-button[indicator] > image.toolbarbutton-icon {
/* Bug 924050: If we've loaded the indicator, for now we hide it in the menu panel,
and just show the icon. This is a hack to side-step very weird layout bugs that
seem to be caused by the indicator stack interacting with the menu panel. */
#downloads-button[indicator]:not([cui-areatype="menu-panel"]) > image.toolbarbutton-icon,
#downloads-button[indicator][cui-areatype="menu-panel"] > #downloads-indicator-anchor {
display: none;
}

Expand Down
2 changes: 1 addition & 1 deletion browser/components/customizableui/content/panelUI.inc.xul
Expand Up @@ -127,7 +127,7 @@
<label value="&feedsMenu.label;" class="panel-subview-header"/>
</panelview>

<panelview id="PanelUI-helpView" flex="1">
<panelview id="PanelUI-helpView" flex="1" class="PanelUI-subView">
<label value="&helpMenu.label;" class="panel-subview-header"/>
<vbox id="PanelUI-helpItems"/>
</panelview>
Expand Down
7 changes: 5 additions & 2 deletions browser/components/customizableui/content/panelUI.js
Expand Up @@ -165,6 +165,9 @@ const PanelUI = {

handleEvent: function(aEvent) {
switch (aEvent.type) {
case "command":
this.onCommandHandler(aEvent);
break;
case "popupshowing":
// Fall through
case "popupshown":
Expand Down Expand Up @@ -408,11 +411,11 @@ const PanelUI = {
}
items.appendChild(fragment);

this.addEventListener("command", PanelUI.onCommandHandler);
this.addEventListener("command", PanelUI);
},

_onHelpViewHide: function(aEvent) {
this.removeEventListener("command", PanelUI.onCommandHandler);
this.removeEventListener("command", PanelUI);
}
};

Expand Down
5 changes: 2 additions & 3 deletions browser/components/customizableui/src/CustomizableWidgets.jsm
Expand Up @@ -268,7 +268,7 @@ const CustomizableWidgets = [{
}
items.appendChild(fragment);

aEvent.target.addEventListener("command", win.PanelUI.onCommandHandler);
aEvent.target.addEventListener("command", win.PanelUI);
},
onViewHiding: function(aEvent) {
let doc = aEvent.target.ownerDocument;
Expand All @@ -284,8 +284,7 @@ const CustomizableWidgets = [{
}

parent.appendChild(items);
aEvent.target.removeEventListener("command",
win.PanelUI.onCommandHandler);
aEvent.target.removeEventListener("command", win.PanelUI);
}
}, {
id: "add-ons-button",
Expand Down
11 changes: 9 additions & 2 deletions browser/components/sessionstore/src/SessionSaver.jsm
Expand Up @@ -242,7 +242,7 @@ let SessionSaverInternal = {
* Write the given state object to disk.
*/
_writeState: function (state) {
stopWatchStart("SERIALIZE_DATA_MS", "SERIALIZE_DATA_LONGEST_OP_MS");
stopWatchStart("SERIALIZE_DATA_MS", "SERIALIZE_DATA_LONGEST_OP_MS", "WRITE_STATE_LONGEST_OP_MS");
let data = JSON.stringify(state);
stopWatchFinish("SERIALIZE_DATA_MS", "SERIALIZE_DATA_LONGEST_OP_MS");

Expand All @@ -251,6 +251,7 @@ let SessionSaverInternal = {

// Don't touch the file if an observer has deleted all state data.
if (!data) {
stopWatchCancel("WRITE_STATE_LONGEST_OP_MS");
return Promise.resolve();
}

Expand All @@ -263,10 +264,16 @@ let SessionSaverInternal = {
// Write (atomically) to a session file, using a tmp file. Once the session
// file is successfully updated, save the time stamp of the last save and
// notify the observers.
return SessionFile.write(data).then(() => {
stopWatchStart("SEND_SERIALIZED_STATE_LONGEST_OP_MS");
let promise = SessionFile.write(data);
stopWatchFinish("WRITE_STATE_LONGEST_OP_MS",
"SEND_SERIALIZED_STATE_LONGEST_OP_MS");
promise = promise.then(() => {
this.updateLastSaveTime();
notify(null, "sessionstore-state-write-complete");
}, console.error);

return promise;
},

/**
Expand Down
14 changes: 12 additions & 2 deletions browser/devtools/framework/ToolboxProcess.jsm
Expand Up @@ -32,6 +32,8 @@ this.BrowserToolboxProcess = function BrowserToolboxProcess(aOnClose, aOnRun) {
this._runCallback = aOnRun;
this._telemetry = new Telemetry();

this.close = this.close.bind(this);
Services.obs.addObserver(this.close, "quit-application", false);
this._initServer();
this._initProfile();
this._create();
Expand Down Expand Up @@ -154,19 +156,27 @@ BrowserToolboxProcess.prototype = {
},

/**
* Closes the remote debugger, removing the profile and killing the process.
* Closes the remote debugging server and kills the toolbox process.
*/
close: function() {
if (this.closed) {
return;
}

dumpn("Cleaning up the chrome debugging process.");
Services.obs.removeObserver(this.close, "quit-application");

if (this._dbgProcess.isRunning) {
this._dbgProcess.kill();
}

this._telemetry.toolClosed("jsbrowserdebugger");
this.debuggerServer.destroy();
if (this.debuggerServer) {
this.debuggerServer.destroy();
}

dumpn("Chrome toolbox is now closed...");
this.closed = true;
if (typeof this._closeCallback == "function") {
this._closeCallback.call({}, this);
}
Expand Down
20 changes: 10 additions & 10 deletions browser/devtools/main.js
Expand Up @@ -60,7 +60,7 @@ Tools.options = {
id: "options",
ordinal: 0,
url: "chrome://browser/content/devtools/framework/toolbox-options.xul",
icon: "chrome://browser/skin/devtools/tool-options@2x.png",
icon: "chrome://browser/skin/devtools/tool-options.svg",
bgTheme: "theme-body",
tooltip: l10n("optionsButton.tooltip", toolboxStrings),
inMenu: false,
Expand All @@ -79,7 +79,7 @@ Tools.webConsole = {
accesskey: l10n("webConsoleCmd.accesskey", webConsoleStrings),
modifiers: Services.appinfo.OS == "Darwin" ? "accel,alt" : "accel,shift",
ordinal: 1,
icon: "chrome://browser/skin/devtools/tool-webconsole@2x.png",
icon: "chrome://browser/skin/devtools/tool-webconsole.svg",
url: "chrome://browser/content/devtools/webconsole.xul",
label: l10n("ToolboxTabWebconsole.label", webConsoleStrings),
menuLabel: l10n("MenuWebconsole.label", webConsoleStrings),
Expand All @@ -101,7 +101,7 @@ Tools.inspector = {
key: l10n("inspector.commandkey", inspectorStrings),
ordinal: 2,
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
icon: "chrome://browser/skin/devtools/tool-inspector@2x.png",
icon: "chrome://browser/skin/devtools/tool-inspector.svg",
url: "chrome://browser/content/devtools/inspector/inspector.xul",
label: l10n("inspector.label", inspectorStrings),
tooltip: l10n("inspector.tooltip", inspectorStrings),
Expand All @@ -128,8 +128,8 @@ Tools.jsdebugger = {
accesskey: l10n("debuggerMenu.accesskey", debuggerStrings),
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
ordinal: 3,
icon: "chrome://browser/skin/devtools/tool-debugger@2x.png",
highlightedicon: "chrome://browser/skin/devtools/tool-debugger-paused@2x.png",
icon: "chrome://browser/skin/devtools/tool-debugger.svg",
highlightedicon: "chrome://browser/skin/devtools/tool-debugger-paused.svg",
url: "chrome://browser/content/devtools/debugger.xul",
label: l10n("ToolboxDebugger.label", debuggerStrings),
tooltip: l10n("ToolboxDebugger.tooltip", debuggerStrings),
Expand All @@ -151,7 +151,7 @@ Tools.styleEditor = {
ordinal: 4,
accesskey: l10n("open.accesskey", styleEditorStrings),
modifiers: "shift",
icon: "chrome://browser/skin/devtools/tool-styleeditor@2x.png",
icon: "chrome://browser/skin/devtools/tool-styleeditor.svg",
url: "chrome://browser/content/devtools/styleeditor.xul",
label: l10n("ToolboxStyleEditor.label", styleEditorStrings),
tooltip: l10n("ToolboxStyleEditor.tooltip2", styleEditorStrings),
Expand All @@ -171,7 +171,7 @@ Tools.shaderEditor = {
id: "shadereditor",
ordinal: 5,
visibilityswitch: "devtools.shadereditor.enabled",
icon: "chrome://browser/skin/devtools/tool-styleeditor@2x.png",
icon: "chrome://browser/skin/devtools/tool-styleeditor.svg",
url: "chrome://browser/content/devtools/shadereditor.xul",
label: l10n("ToolboxShaderEditor.label", shaderEditorStrings),
tooltip: l10n("ToolboxShaderEditor.tooltip", shaderEditorStrings),
Expand All @@ -193,7 +193,7 @@ Tools.jsprofiler = {
ordinal: 6,
modifiers: "shift",
visibilityswitch: "devtools.profiler.enabled",
icon: "chrome://browser/skin/devtools/tool-profiler@2x.png",
icon: "chrome://browser/skin/devtools/tool-profiler.svg",
url: "chrome://browser/content/devtools/profiler.xul",
label: l10n("profiler.label", profilerStrings),
tooltip: l10n("profiler.tooltip2", profilerStrings),
Expand All @@ -216,7 +216,7 @@ Tools.netMonitor = {
ordinal: 7,
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
visibilityswitch: "devtools.netmonitor.enabled",
icon: "chrome://browser/skin/devtools/tool-network@2x.png",
icon: "chrome://browser/skin/devtools/tool-network.svg",
url: "chrome://browser/content/devtools/netmonitor.xul",
label: l10n("netmonitor.label", netMonitorStrings),
tooltip: l10n("netmonitor.tooltip", netMonitorStrings),
Expand All @@ -236,7 +236,7 @@ Tools.scratchpad = {
id: "scratchpad",
ordinal: 8,
visibilityswitch: "devtools.scratchpad.enabled",
icon: "chrome://browser/skin/devtools/tool-scratchpad@2x.png",
icon: "chrome://browser/skin/devtools/tool-scratchpad.svg",
url: "chrome://browser/content/devtools/scratchpad.xul",
label: l10n("scratchpad.label", scratchpadStrings),
tooltip: l10n("scratchpad.tooltip", scratchpadStrings),
Expand Down
61 changes: 59 additions & 2 deletions browser/extensions/shumway/content/ShumwayStreamConverter.jsm
Expand Up @@ -37,18 +37,24 @@ const MAX_CLIPBOARD_DATA_SIZE = 8000;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/NetUtil.jsm');
Cu.import('resource://gre/modules/Promise.jsm');

XPCOMUtils.defineLazyModuleGetter(this, 'PrivateBrowsingUtils',
'resource://gre/modules/PrivateBrowsingUtils.jsm');

XPCOMUtils.defineLazyModuleGetter(this, 'AddonManager',
'resource://gre/modules/AddonManager.jsm');

XPCOMUtils.defineLazyModuleGetter(this, 'ShumwayTelemetry',
'resource://shumway/ShumwayTelemetry.jsm');

let appInfo = Cc['@mozilla.org/xre/app-info;1'].getService(Ci.nsIXULAppInfo);
let Svc = {};
XPCOMUtils.defineLazyServiceGetter(Svc, 'mime',
'@mozilla.org/mime;1', 'nsIMIMEService');

let StringInputStream = Cc["@mozilla.org/io/string-input-stream;1"];
let MimeInputStream = Cc["@mozilla.org/network/mime-input-stream;1"];

function getBoolPref(pref, def) {
try {
return Services.prefs.getBoolPref(pref);
Expand Down Expand Up @@ -188,6 +194,32 @@ function isShumwayEnabledFor(actions) {
return true;
}

function getVersionInfo() {
var deferred = Promise.defer();
var versionInfo = {
geckoMstone : 'unknown',
geckoBuildID: 'unknown',
shumwayVersion: 'unknown'
};
try {
versionInfo.geckoMstone = Services.prefs.getCharPref('gecko.mstone');
versionInfo.geckoBuildID = Services.prefs.getCharPref('gecko.buildID');
} catch (e) {
log('Error encountered while getting platform version info:', e);
}
try {
var addonId = "shumway@research.mozilla.org";
AddonManager.getAddonByID(addonId, function(addon) {
versionInfo.shumwayVersion = addon ? addon.version : 'n/a';
deferred.resolve(versionInfo);
});
} catch (e) {
log('Error encountered while getting Shumway version info:', e);
deferred.resolve(versionInfo);
}
return deferred.promise;
}

function fallbackToNativePlugin(window, userAction, activateCTP) {
var obj = window.frameElement;
var doc = obj.ownerDocument;
Expand Down Expand Up @@ -366,7 +398,7 @@ ChromeActions.prototype = {
});
},
fallback: function(automatic) {
automatic = !!automatic; // cast to boolean
automatic = !!automatic;
fallbackToNativePlugin(this.window, !automatic, automatic);
},
setClipboard: function (data) {
Expand Down Expand Up @@ -432,6 +464,28 @@ ChromeActions.prototype = {
break;
}
},
reportIssue: function(exceptions) {
var base = "http://shumway-issue-reporter.paas.allizom.org/input?";
var windowUrl = this.window.parent.wrappedJSObject.location + '';
var params = 'url=' + encodeURIComponent(windowUrl);
params += '&swf=' + encodeURIComponent(this.url);
getVersionInfo().then(function (versions) {
params += '&ffbuild=' + encodeURIComponent(versions.geckoMstone + ' (' +
versions.geckoBuildID + ')');
params += '&shubuild=' + encodeURIComponent(versions.shumwayVersion);
}).then(function () {
var postDataStream = StringInputStream.
createInstance(Ci.nsIStringInputStream);
postDataStream.data = 'exceptions=' + encodeURIComponent(exceptions);
var postData = MimeInputStream.createInstance(Ci.nsIMIMEInputStream);
postData.addHeader("Content-Type", "application/x-www-form-urlencoded");
postData.addContentLength = true;
postData.setData(postDataStream);
this.window.openDialog('chrome://browser/content', '_blank',
'all,dialog=no', base + params, null, null,
postData);
}.bind(this));
},
externalCom: function (data) {
if (!this.allowScriptAccess)
return;
Expand Down Expand Up @@ -459,6 +513,9 @@ ChromeActions.prototype = {
case 'unregister':
return embedTag.__flash__unregisterCallback(data.functionName);
}
},
getWindowUrl: function() {
return this.window.parent.wrappedJSObject.location + '';
}
};

Expand Down

0 comments on commit c574bba

Please sign in to comment.