Merge m-c to inbound

This commit is contained in:
Wes Kocher 2013-10-22 18:43:11 -04:00
commit 3d55f8e6de
58 changed files with 734 additions and 373 deletions

View File

@ -749,7 +749,7 @@ pref("memory_info_dumper.watch_fifo.directory", "/data/local");
pref("general.useragent.enable_overrides", true);
// See ua-update.json.in for the packaged UA override list
pref("general.useragent.updates.enabled", true);
pref("general.useragent.updates.url", "");
pref("general.useragent.updates.url", "https://dynamicua.cdn.mozilla.net/0/%APP_ID%");
pref("general.useragent.updates.interval", 604800); // 1 week
pref("general.useragent.updates.retry", 86400); // 1 day

View File

@ -3,12 +3,8 @@
// Send these sites a custom user-agent. Bugs to remove each override after
// evangelism are included.
{
// bug 802981, maps.google.com
"maps.google.com": "\\(Mobile#(Android; Mobile",
// bug 826330, uol.com.br
"uol.com.br": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
// bug 826332, live.com
"live.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
// bug 826335, globo.com
"globo.com": "\\(Mobile#(Android; Mobile",
// bug 826338, yahoo.com
@ -41,8 +37,6 @@
"noticias.uol.com.br": "\\(Mobile#(Android; Mobile",
// bug 826720, olx.com.br
"olx.com.br": "\\(Mobile#(Android; Mobile",
// bug 826736, bancobrasil.com.br
"bancobrasil.com.br": "\\(Mobile#(Android; Mobile",
// bug 826845, techtudo.com.br
"techtudo.com.br": "\\(Mobile#(Android; Mobile",
// bug 826958, ebay.com
@ -95,8 +89,6 @@
"money.pl": "\\(Mobile#(Android; Mobile",
// bug 828371, ingbank.pl
"ingbank.pl": "\\(Mobile#(Android; Mobile",
// bug 828376, plotek.pl
"plotek.pl": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
// bug 828378, wyborcza.pl
"wyborcza.pl": "\\(Mobile#(Android; Mobile",
// bug 828380, deser.pl
@ -131,10 +123,6 @@
"bumeran.com.ve": "\\(Mobile#(Android; Mobile",
// bug 828448, petardas.com
"petardas.com": "\\(Mobile#(Android; Mobile",
// bug 827869, mail.google.com
"mail.google.com": "\\(Mobile#(Android; Mobile",
// bug 843109, enfemenino.com
"enfemenino.com": "\\(Mobile#(Android; Mobile",
// bug 843112, movil.bankinter.es
"movil.bankinter.es": "\\(Mobile#(Android; Mobile",
// bug 843114, einforma.com
@ -155,18 +143,12 @@
"iphonejuegosgratis.com": "\\(Mobile#(Android; Mobile",
// bug 843132, comunio.es
"comunio.es": "\\(Mobile#(Android; Mobile",
// bug 843134, news.google.com
"news.google.com": "\\(Mobile#(Android; Mobile",
// bug 843136, deviantart.com
"deviantart.com": "\\(Mobile#(Android; Mobile",
// bug 843137, nytimes.com
"nytimes.com": "\\(Mobile#(Android; Mobile",
// bug 843139, consumersearch.com
"consumersearch.com": "\\(Mobile#(Android; Mobile",
// bug 843141, foodily.com
"foodily.com": "\\(Mobile#(Android; Mobile",
// bug 843197, icanhas.cheezburger.com
"icanhas.cheezburger.com": "\\(Mobile#(Android; Mobile",
// bug 843151, citibank.com
"citibank.com": "\\(Mobile#(Android; Mobile",
// bug 843153, games.com
@ -225,8 +207,6 @@
"vatera.hu": "\\(Mobile#(Android; Mobile",
// bug 878255, 24sata.hr
"24sata.hr": "\\(Mobile#(Android; Mobile",
// bug 878256, bet365.com
"bet365.com": "\\(Mobile#(Android; Mobile",
// bug 878258, blackhatteam.com
"blackhatteam.com": "\\(Mobile#(Android; Mobile",
// bug 878260, cdm.me
@ -255,8 +235,6 @@
"banorte.com": "\\(Mobile#(Android; Mobile",
// bug 878634, buenastareas.com
"buenastareas.com": "\\(Mobile#(Android; Mobile",
// bug 878635, cnn.com
"cnn.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
// bug 878637, eluniversal.com.mx
"eluniversal.com.mx": "\\(Mobile#(Android; Mobile",
// bug 878640, hootsuite.com

View File

@ -1,4 +1,4 @@
{
"revision": "175b7a89aa5f39aa2b2263029ab086ac1833a636",
"revision": "ef355aa8244d698a5b226ac4ef2408a2eb0812bb",
"repo_path": "/integration/gaia-central"
}

View File

@ -499,20 +499,6 @@ HistoryMenu.prototype = {
undoMenu.removeAttribute("disabled");
},
/**
* Re-open a closed tab and put it to the end of the tab strip.
* Used for a middle click.
* @param aEvent
* The event when the user clicks the menu item
*/
_undoCloseMiddleClick: function PHM__undoCloseMiddleClick(aEvent) {
if (aEvent.button != 1)
return;
undoCloseTab(aEvent.originalTarget.value);
gBrowser.moveTabToEnd();
},
/**
* Populate when the history menu is opened
*/

View File

@ -65,10 +65,8 @@ this.RecentlyClosedTabsAndWindowsMenuUtils = {
fragment.appendChild(doc.createElementNS(kNSXUL, "menuseparator"));
let restoreAllTabs = fragment.appendChild(doc.createElementNS(kNSXUL, aTagName));
restoreAllTabs.setAttribute("label", navigatorBundle.GetStringFromName("menuRestoreAllTabs.label"));
restoreAllTabs.addEventListener("command", function() {
for (var i = 0; i < closedTabs.length; i++)
undoCloseTab(0);
}, false);
restoreAllTabs.setAttribute("oncommand",
"for (var i = 0; i < " + closedTabs.length + "; i++) undoCloseTab(0);");
}
return fragment;
},
@ -128,6 +126,21 @@ this.RecentlyClosedTabsAndWindowsMenuUtils = {
}
return fragment;
},
/**
* Re-open a closed tab and put it to the end of the tab strip.
* Used for a middle click.
* @param aEvent
* The event when the user clicks the menu item
*/
_undoCloseMiddleClick: function(aEvent) {
if (aEvent.button != 1)
return;
aEvent.view.undoCloseTab(aEvent.originalTarget.value);
aEvent.view.gBrowser.moveTabToEnd();
},
};
function setImage(aItem, aElement) {

View File

@ -581,9 +581,6 @@ let SessionStoreInternal = {
case "nsPref:changed": // catch pref changes
this.onPrefChange(aData);
break;
case "timer-callback": // timer call back for delayed saving
this.onTimerCallback();
break;
}
},
@ -695,9 +692,8 @@ let SessionStoreInternal = {
if (aWindow && aWindow.__SSi && this._windows[aWindow.__SSi])
return;
// ignore non-browser windows and windows opened while shutting down
if (aWindow.document.documentElement.getAttribute("windowtype") != "navigator:browser" ||
this._loadState == STATE_QUITTING)
// ignore windows opened while shutting down
if (this._loadState == STATE_QUITTING)
return;
// Assign the window a unique identifier we can use to reference
@ -862,6 +858,13 @@ let SessionStoreInternal = {
let onload = () => {
aWindow.removeEventListener("load", onload);
let windowType = aWindow.document.documentElement.getAttribute("windowtype");
// Ignore non-browser windows.
if (windowType != "navigator:browser") {
return;
}
if (this._sessionInitialized) {
this.onLoad(aWindow);
return;

View File

@ -96,13 +96,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "devtools",
XPCOMUtils.defineLazyModuleGetter(this, "DevToolsUtils",
"resource://gre/modules/devtools/DevToolsUtils.jsm");
Object.defineProperty(this, "DevtoolsHelpers", {
get: function() {
return devtools.require("devtools/shared/helpers");
},
configurable: true,
enumerable: true
});
XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
"resource://gre/modules/ShortcutUtils.jsm");
Object.defineProperty(this, "NetworkHelper", {
get: function() {
@ -515,6 +510,7 @@ function StackFrames() {
this._onFrames = this._onFrames.bind(this);
this._onFramesCleared = this._onFramesCleared.bind(this);
this._onBlackBoxChange = this._onBlackBoxChange.bind(this);
this._onPrettyPrintChange = this._onPrettyPrintChange.bind(this);
this._afterFramesCleared = this._afterFramesCleared.bind(this);
this.evaluate = this.evaluate.bind(this);
}
@ -541,6 +537,7 @@ StackFrames.prototype = {
this.activeThread.addListener("framesadded", this._onFrames);
this.activeThread.addListener("framescleared", this._onFramesCleared);
this.activeThread.addListener("blackboxchange", this._onBlackBoxChange);
this.activeThread.addListener("prettyprintchange", this._onPrettyPrintChange);
this.handleTabNavigation();
},
@ -557,6 +554,7 @@ StackFrames.prototype = {
this.activeThread.removeListener("framesadded", this._onFrames);
this.activeThread.removeListener("framescleared", this._onFramesCleared);
this.activeThread.removeListener("blackboxchange", this._onBlackBoxChange);
this.activeThread.removeListener("prettyprintchange", this._onPrettyPrintChange);
},
/**
@ -743,11 +741,19 @@ StackFrames.prototype = {
*/
_onBlackBoxChange: function() {
if (this.activeThread.state == "paused") {
this.currentFrame = null;
this._refillFrames();
}
},
/**
* Handler for the debugger's prettyprintchange notification.
*/
_onPrettyPrintChange: function() {
if (this.activeThread.state == "paused") {
this.activeThread.fillFrames(CALL_STACK_PAGE_SIZE);
}
},
/**
* Called soon after the thread client's framescleared notification.
*/
@ -995,6 +1001,7 @@ function SourceScripts() {
this._onNewSource = this._onNewSource.bind(this);
this._onSourcesAdded = this._onSourcesAdded.bind(this);
this._onBlackBoxChange = this._onBlackBoxChange.bind(this);
this._onPrettyPrintChange = this._onPrettyPrintChange.bind(this);
}
SourceScripts.prototype = {
@ -1010,6 +1017,7 @@ SourceScripts.prototype = {
this.debuggerClient.addListener("newGlobal", this._onNewGlobal);
this.debuggerClient.addListener("newSource", this._onNewSource);
this.activeThread.addListener("blackboxchange", this._onBlackBoxChange);
this.activeThread.addListener("prettyprintchange", this._onPrettyPrintChange);
this.handleTabNavigation();
},
@ -1024,6 +1032,7 @@ SourceScripts.prototype = {
this.debuggerClient.removeListener("newGlobal", this._onNewGlobal);
this.debuggerClient.removeListener("newSource", this._onNewSource);
this.activeThread.removeListener("blackboxchange", this._onBlackBoxChange);
this.activeThread.addListener("prettyprintchange", this._onPrettyPrintChange);
},
/**
@ -1180,8 +1189,9 @@ SourceScripts.prototype = {
},
/**
* Pretty print a source's text. All subsequent calls to |getText| will return
* the pretty text. Nothing will happen for non-javascript files.
* Toggle the pretty printing of a source's text. All subsequent calls to
* |getText| will return the pretty-toggled text. Nothing will happen for
* non-javascript files.
*
* @param Object aSource
* The source form from the RDP.
@ -1189,48 +1199,56 @@ SourceScripts.prototype = {
* A promise that resolves to [aSource, prettyText] or rejects to
* [aSource, error].
*/
prettyPrint: function(aSource) {
togglePrettyPrint: function(aSource) {
// Only attempt to pretty print JavaScript sources.
if (!SourceUtils.isJavaScript(aSource.url, aSource.contentType)) {
return promise.reject([aSource, "Can't prettify non-javascript files."]);
}
const sourceClient = this.activeThread.source(aSource);
const wantPretty = !sourceClient.isPrettyPrinted;
// Only use the existing promise if it is pretty printed.
let textPromise = this._cache.get(aSource.url);
if (textPromise && textPromise.pretty) {
if (textPromise && textPromise.pretty === wantPretty) {
return textPromise;
}
const deferred = promise.defer();
deferred.promise.pretty = wantPretty;
this._cache.set(aSource.url, deferred.promise);
this.activeThread.source(aSource)
.prettyPrint(Prefs.editorTabSize, ({ error, message, source: text }) => {
if (error) {
// Revert the rejected promise from the cache, so that the original
// source's text may be shown when the source is selected.
this._cache.set(aSource.url, textPromise);
deferred.reject([aSource, message || error]);
return;
}
const afterToggle = ({ error, message, source: text }) => {
if (error) {
// Revert the rejected promise from the cache, so that the original
// source's text may be shown when the source is selected.
this._cache.set(aSource.url, textPromise);
// Remove the cached source AST from the Parser, to avoid getting
// wrong locations when searching for functions.
DebuggerController.Parser.clearSource(aSource.url);
deferred.reject([aSource, message || error]);
return;
}
if (this.activeThread.paused) {
// Update the stack frame list.
this.activeThread._clearFrames();
this.activeThread.fillFrames(CALL_STACK_PAGE_SIZE);
}
deferred.resolve([aSource, text]);
};
deferred.resolve([aSource, text]);
});
if (wantPretty) {
sourceClient.prettyPrint(Prefs.editorTabSize, afterToggle);
} else {
sourceClient.disablePrettyPrint(afterToggle);
}
deferred.promise.pretty = true;
return deferred.promise;
},
/**
* Handler for the debugger's prettyprintchange notification.
*/
_onPrettyPrintChange: function(aEvent, { url }) {
// Remove the cached source AST from the Parser, to avoid getting
// wrong locations when searching for functions.
DebuggerController.Parser.clearSource(url);
},
/**
* Gets a specified source's text.
*

View File

@ -11,7 +11,7 @@
function SourcesView() {
dumpn("SourcesView was instantiated");
this.prettyPrint = this.prettyPrint.bind(this);
this.togglePrettyPrint = this.togglePrettyPrint.bind(this);
this._onEditorLoad = this._onEditorLoad.bind(this);
this._onEditorUnload = this._onEditorUnload.bind(this);
this._onEditorSelection = this._onEditorSelection.bind(this);
@ -28,6 +28,7 @@ function SourcesView() {
this._onConditionalPopupHiding = this._onConditionalPopupHiding.bind(this);
this._onConditionalTextboxInput = this._onConditionalTextboxInput.bind(this);
this._onConditionalTextboxKeyPress = this._onConditionalTextboxKeyPress.bind(this);
this._updatePrettyPrintButtonState = this._updatePrettyPrintButtonState.bind(this);
}
SourcesView.prototype = Heritage.extend(WidgetMethods, {
@ -63,7 +64,6 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
this.widget.addEventListener("click", this._onSourceClick, false);
this.widget.addEventListener("check", this._onSourceCheck, false);
this._stopBlackBoxButton.addEventListener("click", this._onStopBlackBoxing, false);
this._prettyPrintButton.addEventListener("click", this.prettyPrint, false);
this._cbPanel.addEventListener("popupshowing", this._onConditionalPopupShowing, false);
this._cbPanel.addEventListener("popupshown", this._onConditionalPopupShown, false);
this._cbPanel.addEventListener("popuphiding", this._onConditionalPopupHiding, false);
@ -88,7 +88,6 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
this.widget.removeEventListener("click", this._onSourceClick, false);
this.widget.removeEventListener("check", this._onSourceCheck, false);
this._stopBlackBoxButton.removeEventListener("click", this._onStopBlackBoxing, false);
this._prettyPrintButton.removeEventListener("click", this.prettyPrint, false);
this._cbPanel.removeEventListener("popupshowing", this._onConditionalPopupShowing, false);
this._cbPanel.removeEventListener("popupshowing", this._onConditionalPopupShown, false);
this._cbPanel.removeEventListener("popuphiding", this._onConditionalPopupHiding, false);
@ -379,9 +378,9 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
},
/**
* Pretty print the selected source.
* Toggle the pretty printing of the selected source.
*/
prettyPrint: function() {
togglePrettyPrint: function() {
if (this._prettyPrintButton.hasAttribute("disabled")) {
return;
}
@ -392,17 +391,21 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
DebuggerView.setEditorLocation(url, 0, { force: true });
}
};
const printError = ([{ url }, error]) => {
let err = DevToolsUtils.safeErrorString(error);
let msg = "Couldn't prettify source: " + url + "\n" + err;
Cu.reportError(msg);
dumpn(msg);
return;
}
DevToolsUtils.reportException("togglePrettyPrint", error);
};
DebuggerView.showProgressBar();
const { source } = this.selectedItem.attachment;
DebuggerController.SourceScripts.prettyPrint(source)
if (gThreadClient.source(source).isPrettyPrinted) {
this._prettyPrintButton.removeAttribute("checked");
} else {
this._prettyPrintButton.setAttribute("checked", true);
}
DebuggerController.SourceScripts.togglePrettyPrint(source)
.then(resetEditor, printError)
.then(DebuggerView.showEditor);
},
@ -701,15 +704,24 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
/**
* Enable or disable the pretty print button depending on whether the selected
* source is black boxed or not.
* source is black boxed or not and check or uncheck it depending on if the
* selected source is already pretty printed or not.
*/
_updatePrettyPrintButtonState: function() {
const { source } = this.selectedItem.attachment;
if (gThreadClient.source(source).isBlackBoxed) {
const sourceClient = gThreadClient.source(source);
if (sourceClient.isBlackBoxed) {
this._prettyPrintButton.setAttribute("disabled", true);
} else {
this._prettyPrintButton.removeAttribute("disabled");
}
if (sourceClient.isPrettyPrinted) {
this._prettyPrintButton.setAttribute("checked", true);
} else {
this._prettyPrintButton.removeAttribute("checked");
}
},
/**

View File

@ -38,10 +38,10 @@ ToolbarView.prototype = {
this._stepOutButton = document.getElementById("step-out");
this._chromeGlobals = document.getElementById("chrome-globals");
let resumeKey = DevtoolsHelpers.prettyKey(document.getElementById("resumeKey"), true);
let stepOverKey = DevtoolsHelpers.prettyKey(document.getElementById("stepOverKey"), true);
let stepInKey = DevtoolsHelpers.prettyKey(document.getElementById("stepInKey"), true);
let stepOutKey = DevtoolsHelpers.prettyKey(document.getElementById("stepOutKey"), true);
let resumeKey = ShortcutUtils.prettifyShortcut(document.getElementById("resumeKey"));
let stepOverKey = ShortcutUtils.prettifyShortcut(document.getElementById("stepOverKey"));
let stepInKey = ShortcutUtils.prettifyShortcut(document.getElementById("stepInKey"));
let stepOutKey = ShortcutUtils.prettifyShortcut(document.getElementById("stepOutKey"));
this._resumeTooltip = L10N.getFormatStr("resumeButtonTooltip", resumeKey);
this._pauseTooltip = L10N.getFormatStr("pauseButtonTooltip", resumeKey);
this._stepOverTooltip = L10N.getFormatStr("stepOverTooltip", stepOverKey);
@ -696,12 +696,12 @@ FilterView.prototype = {
this._variableOperatorButton = document.getElementById("variable-operator-button");
this._variableOperatorLabel = document.getElementById("variable-operator-label");
this._fileSearchKey = DevtoolsHelpers.prettyKey(document.getElementById("fileSearchKey"), true);
this._globalSearchKey = DevtoolsHelpers.prettyKey(document.getElementById("globalSearchKey"), true);
this._filteredFunctionsKey = DevtoolsHelpers.prettyKey(document.getElementById("functionSearchKey"), true);
this._tokenSearchKey = DevtoolsHelpers.prettyKey(document.getElementById("tokenSearchKey"), true);
this._lineSearchKey = DevtoolsHelpers.prettyKey(document.getElementById("lineSearchKey"), true);
this._variableSearchKey = DevtoolsHelpers.prettyKey(document.getElementById("variableSearchKey"), true);
this._fileSearchKey = ShortcutUtils.prettifyShortcut(document.getElementById("fileSearchKey"));
this._globalSearchKey = ShortcutUtils.prettifyShortcut(document.getElementById("globalSearchKey"));
this._filteredFunctionsKey = ShortcutUtils.prettifyShortcut(document.getElementById("functionSearchKey"));
this._tokenSearchKey = ShortcutUtils.prettifyShortcut(document.getElementById("tokenSearchKey"));
this._lineSearchKey = ShortcutUtils.prettifyShortcut(document.getElementById("lineSearchKey"));
this._variableSearchKey = ShortcutUtils.prettifyShortcut(document.getElementById("variableSearchKey"));
this._searchbox.addEventListener("click", this._onClick, false);
this._searchbox.addEventListener("select", this._onInput, false);

View File

@ -68,6 +68,7 @@ let DebuggerView = {
this.GlobalSearch.initialize();
this._initializeVariablesView();
this._initializeEditor(deferred.resolve);
document.title = L10N.getStr("DebuggerWindowTitle");
return deferred.promise;

View File

@ -33,7 +33,7 @@
<commandset id="debuggerCommands">
<command id="prettyPrintCommand"
oncommand="DebuggerView.Sources.prettyPrint()"/>
oncommand="DebuggerView.Sources.togglePrettyPrint()"/>
<command id="unBlackBoxButton"
oncommand="DebuggerView.Sources._onStopBlackBoxing()"/>
<command id="nextSourceCommand"

View File

@ -124,6 +124,7 @@ support-files =
[browser_dbg_pretty-print-08.js]
[browser_dbg_pretty-print-09.js]
[browser_dbg_pretty-print-10.js]
[browser_dbg_pretty-print-11.js]
[browser_dbg_progress-listener-bug.js]
[browser_dbg_reload-preferred-script-01.js]
[browser_dbg_reload-preferred-script-02.js]

View File

@ -30,7 +30,7 @@ function testPause() {
is(gResumeButton.getAttribute("tooltiptext"),
gDebugger.L10N.getFormatStr("pauseButtonTooltip",
gDebugger.DevtoolsHelpers.prettyKey(gResumeKey)),
gDebugger.ShortcutUtils.prettifyShortcut(gResumeKey)),
"Button tooltip should be 'pause' when running.");
gDebugger.gThreadClient.addOneTimeListener("paused", () => {
@ -39,7 +39,7 @@ function testPause() {
is(gResumeButton.getAttribute("tooltiptext"),
gDebugger.L10N.getFormatStr("resumeButtonTooltip",
gDebugger.DevtoolsHelpers.prettyKey(gResumeKey)),
gDebugger.ShortcutUtils.prettifyShortcut(gResumeKey)),
"Button tooltip should be 'resume' when paused.");
is(gFrames.itemCount, 0,
@ -58,7 +58,7 @@ function testResume() {
is(gResumeButton.getAttribute("tooltiptext"),
gDebugger.L10N.getFormatStr("pauseButtonTooltip",
gDebugger.DevtoolsHelpers.prettyKey(gResumeKey)),
gDebugger.ShortcutUtils.prettifyShortcut(gResumeKey)),
"Button tooltip should be pause when running.");
closeDebuggerAndFinish(gPanel);

View File

@ -43,9 +43,7 @@ function testSourceIsUgly() {
}
function clickPrettyPrintButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.getElementById("pretty-print"),
gDebugger);
gDebugger.document.getElementById("pretty-print").click();
}
function testProgressBarShown() {

View File

@ -41,9 +41,7 @@ function runCodeAndPause() {
}
function clickPrettyPrintButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.getElementById("pretty-print"),
gDebugger);
gDebugger.document.getElementById("pretty-print").click();
}
registerCleanupFunction(function() {

View File

@ -47,9 +47,7 @@ function testUglySearch() {
}
function clickPrettyPrintButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.getElementById("pretty-print"),
gDebugger);
gDebugger.document.getElementById("pretty-print").click();
}
function testPrettyPrintedSearch() {

View File

@ -37,7 +37,7 @@ function test() {
let { source } = gSources.selectedItem.attachment;
try {
yield gControllerSources.prettyPrint(source);
yield gControllerSources.togglePrettyPrint(source);
ok(false, "The promise for a prettified source should be rejected!");
} catch ([source, error]) {
is(error, "Can't prettify non-javascript files.",
@ -58,9 +58,7 @@ function test() {
}
function clickPrettyPrintButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.getElementById("pretty-print"),
gDebugger);
gDebugger.document.getElementById("pretty-print").click();
}
function prepareDebugger(aPanel) {

View File

@ -53,7 +53,7 @@ function test() {
let { source } = gSources.selectedItem.attachment;
try {
yield gControllerSources.prettyPrint(source);
yield gControllerSources.togglePrettyPrint(source);
ok(false, "The promise for a prettified source should be rejected!");
} catch ([source, error]) {
ok(error.contains("prettyPrintError"),
@ -77,9 +77,7 @@ function test() {
}
function clickPrettyPrintButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.getElementById("pretty-print"),
gDebugger);
gDebugger.document.getElementById("pretty-print").click();
}
registerCleanupFunction(function() {

View File

@ -5,7 +5,7 @@
// Test basic pretty printing functionality. Would be an xpcshell test, except
// for bug 921252.
let gTab, gDebuggee, gPanel, gClient, gThreadClient;
let gTab, gDebuggee, gPanel, gClient, gThreadClient, gSource;
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
@ -26,21 +26,31 @@ function findSource() {
ok(!error);
sources = sources.filter(s => s.url.contains('code_ugly-2.js'));
is(sources.length, 1);
prettyPrintSource(sources[0]);
gSource = sources[0];
prettyPrintSource();
});
}
function prettyPrintSource(source) {
gThreadClient.source(source).prettyPrint(4, testPrettyPrinted);
function prettyPrintSource() {
gThreadClient.source(gSource).prettyPrint(4, testPrettyPrinted);
}
function testPrettyPrinted({ error, source}) {
function testPrettyPrinted({ error, source }) {
ok(!error);
ok(source.contains("\n "));
disablePrettyPrint();
}
function disablePrettyPrint() {
gThreadClient.source(gSource).disablePrettyPrint(testUgly);
}
function testUgly({ error, source }) {
ok(!error);
ok(!source.contains("\n "));
closeDebuggerAndFinish(gPanel);
}
registerCleanupFunction(function() {
gTab = gDebuggee = gPanel = gClient = gThreadClient = null;
gTab = gDebuggee = gPanel = gClient = gThreadClient = gSource = null;
});

View File

@ -9,7 +9,7 @@ var gClient;
var gThreadClient;
var gSource;
let gTab, gDebuggee, gPanel, gClient, gThreadClient;
let gTab, gDebuggee, gPanel, gClient, gThreadClient, gSource;
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
@ -38,12 +38,13 @@ function findSource() {
ok(!error);
sources = sources.filter(s => s.url === B_URL);
is(sources.length, 1);
prettyPrint(sources[0]);
gSource = sources[0];
prettyPrint();
});
}
function prettyPrint(source) {
gThreadClient.source(source).prettyPrint(2, runCode);
function prettyPrint() {
gThreadClient.source(gSource).prettyPrint(2, runCode);
}
function runCode({ error }) {
@ -53,19 +54,35 @@ function runCode({ error }) {
}
function testDbgStatement(event, { frame, why }) {
dump("FITZGEN: inside testDbgStatement\n");
is(why.type, "debuggerStatement");
const { url, line, column } = frame.where;
is(url, B_URL);
is(line, 2);
is(column, 2);
try {
is(why.type, "debuggerStatement");
const { url, line, column } = frame.where;
is(url, B_URL);
is(line, 2);
is(column, 2);
disablePrettyPrint();
}
resumeDebuggerThenCloseAndFinish(gPanel);
} catch (e) {
dump("FITZGEN: got an error! " + DevToolsUtils.safeErrorString(e) + "\n");
}
function disablePrettyPrint() {
gThreadClient.source(gSource).disablePrettyPrint(testUgly);
}
function testUgly({ error, source }) {
ok(!error);
ok(!source.contains("\n "));
getFrame();
}
function getFrame() {
gThreadClient.getFrames(0, 1, testFrame);
}
function testFrame({ frames: [frame] }) {
const { url, line } = frame.where;
is(url, B_URL);
is(line, 1);
resumeDebuggerThenCloseAndFinish(gPanel);
}
registerCleanupFunction(function() {

View File

@ -45,9 +45,7 @@ function blackBoxSource() {
}
function clickPrettyPrintButton() {
EventUtils.sendMouseEvent({ type: "click" },
gDebugger.document.getElementById("pretty-print"),
gDebugger);
gDebugger.document.getElementById("pretty-print").click();
}
function testSourceIsStillUgly() {

View File

@ -0,0 +1,60 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure that pretty printing is maintained across refreshes.
*/
const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gEditor, gSources;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
gSources = gDebugger.DebuggerView.Sources;
waitForSourceShown(gPanel, "code_ugly.js")
.then(testSourceIsUgly)
.then(() => {
const finished = waitForSourceShown(gPanel, "code_ugly.js");
clickPrettyPrintButton();
return finished;
})
.then(testSourceIsPretty)
.then(reloadActiveTab.bind(null, gPanel, gDebugger.EVENTS.SOURCE_SHOWN))
.then(testSourceIsPretty)
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError));
});
});
}
function testSourceIsUgly() {
ok(!gEditor.getText().contains("\n "),
"The source shouldn't be pretty printed yet.");
}
function clickPrettyPrintButton() {
gDebugger.document.getElementById("pretty-print").click();
}
function testSourceIsPretty() {
ok(gEditor.getText().contains("\n "),
"The source should be pretty printed.")
}
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;
gSources = null;
});

View File

@ -20,5 +20,5 @@ function a(){b()}function b(){debugger}
// file: "abc.js"
// });
//
// result.code + "\n//# sourceMappingURL=data:application/json;base64," + btoa(JSON.stringify(result.map));
// result.code + "\n//# " + "sourceMappingURL=data:application/json;base64," + btoa(JSON.stringify(result.map));

View File

@ -3,17 +3,29 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const kDebuggerPrefs = [
"devtools.debugger.remote-enabled",
"devtools.debugger.chrome-enabled",
"devtools.chrome.enabled"
];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
function devtoolsCommandlineHandler() {
}
devtoolsCommandlineHandler.prototype = {
handle: function(cmdLine) {
if (!cmdLine.handleFlag("jsconsole", false)) {
return;
let consoleFlag = cmdLine.handleFlag("jsconsole", false);
let debuggerFlag = cmdLine.handleFlag("jsdebugger", false);
if (consoleFlag) {
this.handleConsoleFlag(cmdLine);
}
if (debuggerFlag) {
this.handleDebuggerFlag(cmdLine);
}
},
Cu.import("resource://gre/modules/Services.jsm");
handleConsoleFlag: function(cmdLine) {
let window = Services.wm.getMostRecentWindow("devtools:webconsole");
if (!window) {
let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
@ -31,7 +43,32 @@ devtoolsCommandlineHandler.prototype = {
}
},
helpInfo : " -jsconsole Open the Browser Console.\n",
handleDebuggerFlag: function(cmdLine) {
let remoteDebuggingEnabled = false;
try {
remoteDebuggingEnabled = kDebuggerPrefs.every((pref) => Services.prefs.getBoolPref(pref));
} catch (ex) {
Cu.reportError(ex);
return;
}
if (remoteDebuggingEnabled) {
Cu.import("resource:///modules/devtools/DebuggerProcess.jsm");
BrowserDebuggerProcess.init();
} else {
let errorMsg = "Could not run chrome debugger! You need the following prefs " +
"to be set to true: " + kDebuggerPrefs.join(", ");
Cu.reportError(errorMsg);
// Dump as well, as we're doing this from a commandline, make sure people don't miss it:
dump(errorMsg + "\n");
}
if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) {
cmdLine.preventDefault = true;
}
},
helpInfo : " -jsconsole Open the Browser Console.\n" +
" -jsdebugger Open the Browser Debugger.\n",
classID: Components.ID("{9e9a9283-0ce9-4e4a-8f1c-ba129a032c32}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),

View File

@ -37,7 +37,6 @@ const Telemetry = require("devtools/shared/telemetry");
const escodegen = require("escodegen/escodegen");
const Editor = require("devtools/sourceeditor/editor");
const TargetFactory = require("devtools/framework/target").TargetFactory;
const DevtoolsHelpers = require("devtools/shared/helpers");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -74,6 +73,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "DebuggerClient",
XPCOMUtils.defineLazyGetter(this, "REMOTE_TIMEOUT", () =>
Services.prefs.getIntPref("devtools.debugger.remote-timeout"));
XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
"resource://gre/modules/ShortcutUtils.jsm");
// Because we have no constructor / destructor where we can log metrics we need
// to do so here.
let telemetry = new Telemetry();
@ -1248,9 +1250,9 @@ var Scratchpad = {
let initialText = this.strings.formatStringFromName(
"scratchpadIntro1",
[DevtoolsHelpers.prettyKey(document.getElementById("sp-key-run")),
DevtoolsHelpers.prettyKey(document.getElementById("sp-key-inspect")),
DevtoolsHelpers.prettyKey(document.getElementById("sp-key-display"))],
[ShortcutUtils.prettifyShortcut(document.getElementById("sp-key-run"), true),
ShortcutUtils.prettifyShortcut(document.getElementById("sp-key-inspect"), true),
ShortcutUtils.prettifyShortcut(document.getElementById("sp-key-display"), true)],
3);
let args = window.arguments;

View File

@ -1,72 +0,0 @@
/* 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/. */
const {Cu} = require("chrome");
Cu.import("resource://gre/modules/Services.jsm");
let { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
XPCOMUtils.defineLazyGetter(this, "PlatformKeys", function() {
return Services.strings.createBundle(
"chrome://global-platform/locale/platformKeys.properties");
});
/**
* Prettifies the modifier keys for an element.
*
* @param Node aElemKey
* The key element to get the modifiers from.
* @param boolean aAllowCloverleaf
* Pass true to use the cloverleaf symbol instead of a descriptive string.
* @return string
* A prettified and properly separated modifier keys string.
*/
exports.prettyKey = function Helpers_prettyKey(aElemKey, aAllowCloverleaf) {
let elemString = "";
let elemMod = aElemKey.getAttribute("modifiers");
if (elemMod.match("accel")) {
if (Services.appinfo.OS == "Darwin") {
// XXX bug 779642 Use "Cmd-" literal vs. cloverleaf meta-key until
// Orion adds variable height lines.
if (!aAllowCloverleaf) {
elemString += "Cmd-";
} else {
elemString += PlatformKeys.GetStringFromName("VK_META") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
} else {
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
}
if (elemMod.match("access")) {
if (Services.appinfo.OS == "Darwin") {
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
} else {
elemString += PlatformKeys.GetStringFromName("VK_ALT") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
}
if (elemMod.match("shift")) {
elemString += PlatformKeys.GetStringFromName("VK_SHIFT") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
if (elemMod.match("alt")) {
elemString += PlatformKeys.GetStringFromName("VK_ALT") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
if (elemMod.match("ctrl") || elemMod.match("control")) {
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
if (elemMod.match("meta")) {
elemString += PlatformKeys.GetStringFromName("VK_META") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
return elemString +
(aElemKey.getAttribute("keycode").replace(/^.*VK_/, "") ||
aElemKey.getAttribute("key")).toUpperCase();
}

View File

@ -175,13 +175,6 @@
@BINPATH@/components/dom_apps.xpt
@BINPATH@/components/dom_base.xpt
@BINPATH@/components/dom_system.xpt
#ifdef MOZ_B2G_RIL
@BINPATH@/components/dom_voicemail.xpt
@BINPATH@/components/dom_wifi.xpt
@BINPATH@/components/dom_system_gonk.xpt
@BINPATH@/components/dom_icc.xpt
@BINPATH@/components/dom_wappush.xpt
#endif
#ifdef MOZ_B2G_BT
@BINPATH@/components/dom_bluetooth.xpt
#endif
@ -446,19 +439,6 @@
@BINPATH@/components/contentSecurityPolicy.js
@BINPATH@/components/contentAreaDropListener.manifest
@BINPATH@/components/contentAreaDropListener.js
#ifdef MOZ_B2G_RIL
@BINPATH@/components/RadioInterfaceLayer.manifest
@BINPATH@/components/RadioInterfaceLayer.js
@BINPATH@/components/MmsService.manifest
@BINPATH@/components/MmsService.js
@BINPATH@/components/RILContentHelper.js
@BINPATH@/components/MobileMessageDatabaseService.manifest
@BINPATH@/components/MobileMessageDatabaseService.js
@BINPATH@/components/WifiWorker.js
@BINPATH@/components/WifiWorker.manifest
@BINPATH@/components/DOMWifiManager.js
@BINPATH@/components/DOMWifiManager.manifest
#endif
@BINPATH@/browser/components/BrowserProfileMigrators.manifest
@BINPATH@/browser/components/ProfileMigrator.js
@BINPATH@/browser/components/ChromeProfileMigrator.js

View File

@ -142,7 +142,6 @@ BookmarksView.prototype = Util.extend(Object.create(View.prototype), {
this._set.removeItemAt(this._set.itemCount - 1, true);
}
this._set.arrangeItems();
this._set.removeAttribute("fade");
this._inBatch = false;
rootNode.containerOpen = false;
},
@ -308,6 +307,7 @@ let BookmarksStartView = {
init: function init() {
this._view = new BookmarksView(this._grid, StartUI.maxResultsPerSection, Bookmarks.metroRoot, true);
this._view.getBookmarks();
this._grid.removeAttribute("fade");
},
uninit: function uninit() {

View File

@ -95,7 +95,6 @@ HistoryView.prototype = Util.extend(Object.create(View.prototype), {
rootNode.containerOpen = false;
this._set.arrangeItems();
this._set.removeAttribute("fade");
if (this._inBatch > 0)
this._inBatch--;
},
@ -300,6 +299,7 @@ let HistoryStartView = {
init: function init() {
this._view = new HistoryView(this._grid, StartUI.maxResultsPerSection, true);
this._view.populateGrid();
this._grid.removeAttribute("fade");
},
uninit: function uninit() {

View File

@ -93,7 +93,6 @@ RemoteTabsView.prototype = Util.extend(Object.create(View.prototype), {
}
this.setUIAccessVisible(show);
this._set.arrangeItems();
this._set.removeAttribute("fade");
},
destruct: function destruct() {
@ -116,6 +115,7 @@ let RemoteTabsStartView = {
let vbox = document.getElementById("start-remotetabs");
let uiList = [vbox];
this._view = new RemoteTabsView(this._grid, uiList);
this._grid.removeAttribute("fade");
},
uninit: function uninit() {

View File

@ -202,7 +202,6 @@ TopSitesView.prototype = Util.extend(Object.create(View.prototype), {
this.updateTile(slot, site);
}
tileset.arrangeItems();
tileset.removeAttribute("fade");
this.isUpdating = false;
},
@ -302,6 +301,7 @@ let TopSitesStartView = {
let topsitesVbox = document.getElementById("start-topsites");
topsitesVbox.setAttribute("hidden", "true");
}
this._grid.removeAttribute("fade");
},
uninit: function uninit() {

View File

@ -7,6 +7,7 @@
const snappedSize = 330;
const portraitSize = 900;
const maxPortraitHeight = 900;
function setSnappedViewstate() {
ok(isLandscapeMode(), "setSnappedViewstate expects landscape mode to work.");
@ -32,10 +33,15 @@ function setPortraitViewstate() {
let browser = Browser.selectedBrowser;
let fullWidth = browser.clientWidth;
let fullHeight = browser.clientHeight;
let padding = fullWidth - portraitSize;
browser.style.borderRight = padding + "px solid gray";
// cap the height to create more even surface for testing on
if (fullHeight > maxPortraitHeight)
browser.style.borderBottom = (fullHeight - maxPortraitHeight) + "px solid gray";
ContentAreaObserver._updateViewState("portrait");
// Make sure it renders the new mode properly
@ -47,6 +53,7 @@ function restoreViewstate() {
ok(isLandscapeMode(), "restoreViewstate should restore landscape mode.");
Browser.selectedBrowser.style.removeProperty("border-right");
Browser.selectedBrowser.style.removeProperty("border-bottom");
yield waitForMs(0);
}

View File

@ -689,6 +689,34 @@ arrowbox {
padding: 0;
}
.meta-section > richgrid {
opacity: 1;
transform: translateX(0) scale(1);
transition-duration: 367ms;
transition-delay: 500ms;
transition-timing-function: @metro_animation_easing@;
}
.meta-section:nth-child(2) > richgrid {
transition-delay: 600ms;
}
.meta-section:nth-child(3) > richgrid {
transition-delay: 700ms;
}
.meta-section:nth-child(4) > richgrid {
transition-delay: 800ms;
}
.meta-section > richgrid[fade] {
opacity: 0;
transform: translateX(150px) scale(.9);
}
#start-container[viewstate="snapped"] .meta-section > richgrid {
transition-property: none;
}
/* App bars ----------------------------------------------------------------- */
appbar {

View File

@ -32,6 +32,7 @@ richgrid {
display: -moz-box;
overflow: hidden;
}
richgrid > .richgrid-grid {
-moz-column-width: @grid_double_column_width@; /* tile width (2x unit + gutter) */
min-width: @grid_double_column_width@; /* min 1 column */
@ -54,9 +55,6 @@ richgriditem {
-moz-column-gap: 0;
overflow:hidden;
cursor: default;
transition: 300ms height ease-out,
150ms opacity ease-out,
100ms transform ease-out;
}
.tile-content {

View File

@ -37,9 +37,10 @@
#include "nsDOMEvent.h"
#include "nsGlobalWindow.h"
#ifdef MOZ_B2G_RIL
#include "IccManager.h"
#include "mozilla/dom/IccManager.h"
#include "MobileConnection.h"
#include "mozilla/dom/CellBroadcast.h"
#include "mozilla/dom/Telephony.h"
#include "mozilla/dom/Voicemail.h"
#endif
#include "nsIIdleObserver.h"
@ -53,9 +54,6 @@
#ifdef MOZ_MEDIA_NAVIGATOR
#include "MediaManager.h"
#endif
#ifdef MOZ_B2G_RIL
#include "mozilla/dom/Telephony.h"
#endif
#ifdef MOZ_B2G_BT
#include "BluetoothManager.h"
#endif
@ -140,15 +138,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPowerManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileMessageManager)
#ifdef MOZ_B2G_RIL
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTelephony)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVoicemail)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection)
#ifdef MOZ_B2G_RIL
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileConnection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCellBroadcast)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIccManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTelephony)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVoicemail)
#endif
#ifdef MOZ_B2G_BT
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBluetooth)
@ -213,16 +209,6 @@ Navigator::Invalidate()
mMobileMessageManager = nullptr;
}
#ifdef MOZ_B2G_RIL
if (mTelephony) {
mTelephony = nullptr;
}
if (mVoicemail) {
mVoicemail = nullptr;
}
#endif
if (mConnection) {
mConnection->Shutdown();
mConnection = nullptr;
@ -242,6 +228,14 @@ Navigator::Invalidate()
mIccManager->Shutdown();
mIccManager = nullptr;
}
if (mTelephony) {
mTelephony = nullptr;
}
if (mVoicemail) {
mVoicemail = nullptr;
}
#endif
#ifdef MOZ_B2G_BT
@ -1229,7 +1223,7 @@ Navigator::GetMozIccManager(ErrorResult& aRv)
}
NS_ENSURE_TRUE(mWindow->GetDocShell(), nullptr);
mIccManager = new icc::IccManager();
mIccManager = new IccManager();
mIccManager->Init(mWindow);
}

View File

@ -70,12 +70,6 @@ class NavigatorUserMediaErrorCallback;
class MozGetUserMediaDevicesSuccessCallback;
#endif // MOZ_MEDIA_NAVIGATOR
namespace icc {
#ifdef MOZ_B2G_RIL
class IccManager;
#endif
}
namespace network {
class Connection;
#ifdef MOZ_B2G_RIL
@ -91,6 +85,7 @@ class BluetoothManager;
#ifdef MOZ_B2G_RIL
class CellBroadcast;
class IccManager;
class Telephony;
class Voicemail;
#endif
@ -331,15 +326,13 @@ private:
#endif
nsRefPtr<PowerManager> mPowerManager;
nsRefPtr<MobileMessageManager> mMobileMessageManager;
#ifdef MOZ_B2G_RIL
nsRefPtr<Telephony> mTelephony;
nsRefPtr<Voicemail> mVoicemail;
#endif
nsRefPtr<network::Connection> mConnection;
#ifdef MOZ_B2G_RIL
nsRefPtr<network::MobileConnection> mMobileConnection;
nsRefPtr<CellBroadcast> mCellBroadcast;
nsRefPtr<icc::IccManager> mIccManager;
nsRefPtr<IccManager> mIccManager;
nsRefPtr<Telephony> mTelephony;
nsRefPtr<Voicemail> mVoicemail;
#endif
#ifdef MOZ_B2G_BT
nsCOMPtr<bluetooth::BluetoothManager> mBluetooth;

View File

@ -783,8 +783,7 @@ DOMInterfaces = {
},
'MozStkCommandEvent' : {
'nativeType': 'mozilla::dom::icc::StkCommandEvent',
'headerFile': 'StkCommandEvent.h',
'nativeType': 'mozilla::dom::StkCommandEvent',
},
'MozTimeManager': {
@ -1872,4 +1871,4 @@ addExternalIface('CameraReleaseCallback', nativeType='nsICameraReleaseCallback',
addExternalIface('CameraStartRecordingCallback', nativeType='nsICameraStartRecordingCallback', headerFile='nsIDOMCameraManager.h')
addExternalIface('CameraPreviewStateChange', nativeType='nsICameraPreviewStateChange', headerFile='nsIDOMCameraManager.h')
addExternalIface('CameraPreviewStreamCallback', nativeType='nsICameraPreviewStreamCallback', headerFile='nsIDOMCameraManager.h')
addExternalIface('CameraRecorderStateChange', nativeType='nsICameraRecorderStateChange', headerFile='nsIDOMCameraManager.h')
addExternalIface('CameraRecorderStateChange', nativeType='nsICameraRecorderStateChange', headerFile='nsIDOMCameraManager.h')

View File

@ -95,12 +95,6 @@ LOCAL_INCLUDES += \
$(NULL)
endif
ifdef MOZ_B2G_RIL
LOCAL_INCLUDES += \
-I$(topsrcdir)/dom/icc/src \
$(NULL)
endif
ABS_DIST := $(abspath $(DIST))
EXTRA_EXPORT_MDDEPEND_FILES := $(addsuffix .pp,$(binding_dependency_trackers))

View File

@ -41,7 +41,6 @@ ifdef MOZ_B2G_RIL
DOM_SRCDIRS += \
dom/system/gonk \
dom/wifi \
dom/icc/src \
$(NULL)
endif

View File

@ -623,6 +623,23 @@ dictionary MozStkLanguageSelectionEvent
DOMString language;
};
dictionary MozStkBrowserTerminationEvent
{
/**
* The type of this event.
* It shall be nsIDOMMozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION
*/
unsigned short eventType;
/**
* This object shall contain the browser termination cause.
* See TZ 102 223 8.51. It shall be one of following:
* - nsIDOMMozIccManager.STK_BROWSER_TERMINATION_CAUSE_USER
* - nsIDOMMozIccManager.STK_BROWSER_TERMINATION_CAUSE_ERROR
*/
unsigned short terminationCause;
};
dictionary MozStkGeneralEvent
{
/**

View File

@ -9,7 +9,7 @@ interface nsIDOMDOMRequest;
interface nsIDOMEventListener;
interface nsIDOMMozIccInfo;
[scriptable, builtinclass, uuid(6b5875dc-de44-4681-84a1-9ea12d60fbe2)]
[scriptable, builtinclass, uuid(b403e307-e4ff-47a0-ac1e-c97b042b4595)]
interface nsIDOMMozIccManager : nsIDOMEventTarget
{
/**
@ -215,6 +215,12 @@ interface nsIDOMMozIccManager : nsIDOMEventTarget
const unsigned short STK_TIMER_DEACTIVATE = 0x01;
const unsigned short STK_TIMER_GET_CURRENT_VALUE = 0x02;
/**
* Browser Termination Cause
*/
const unsigned short STK_BROWSER_TERMINATION_CAUSE_USER = 0x00;
const unsigned short STK_BROWSER_TERMINATION_CAUSE_ERROR = 0x01;
/**
* Send the response back to ICC after an attempt to execute STK Proactive
* Command.
@ -260,6 +266,7 @@ interface nsIDOMMozIccManager : nsIDOMEventTarget
* - MozStkCallEvent
* - MozStkLanguageSelectionEvent
* - MozStkGeneralEvent
* - MozStkBrowserTerminationEvent
*/
void sendStkEventDownload(in jsval event);

View File

@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/IccManager.h"
#include "GeneratedEvents.h"
#include "mozilla/dom/StkCommandEvent.h"
#include "mozilla/Services.h"
#include "nsIDOMClassInfo.h"
#include "nsIDOMIccInfo.h"
#include "GeneratedEvents.h"
#include "IccManager.h"
#include "SimToolKit.h"
#include "StkCommandEvent.h"
#define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
using namespace mozilla::dom::icc;
using namespace mozilla::dom;
class IccManager::Listener : public nsIIccListener
{
@ -38,7 +39,7 @@ public:
NS_IMPL_ISUPPORTS1(IccManager::Listener, nsIIccListener)
DOMCI_DATA(MozIccManager, mozilla::dom::icc::IccManager)
DOMCI_DATA(MozIccManager, IccManager)
NS_INTERFACE_MAP_BEGIN(IccManager)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozIccManager)
@ -277,4 +278,4 @@ NS_IMETHODIMP
IccManager::NotifyIccInfoChanged()
{
return DispatchTrustedEvent(NS_LITERAL_STRING("iccinfochange"));
}
}

View File

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_icc_IccManager_h
#define mozilla_dom_icc_IccManager_h
#ifndef mozilla_dom_IccManager_h
#define mozilla_dom_IccManager_h
#include "nsCycleCollectionParticipant.h"
#include "nsDOMEventTargetHelper.h"
@ -12,7 +12,6 @@
namespace mozilla {
namespace dom {
namespace icc {
class IccManager : public nsDOMEventTargetHelper
, public nsIDOMMozIccManager
@ -42,8 +41,7 @@ private:
nsRefPtr<Listener> mListener;
};
} // namespace icc
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_icc_IccManager_h
#endif // mozilla_dom_IccManager_h

View File

@ -2,19 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "SimToolKit.h"
#include "StkCommandEvent.h"
#include "mozilla/dom/StkCommandEvent.h"
#include "nsJSON.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "nsJSON.h"
#include "SimToolKit.h"
namespace mozilla {
namespace dom {
namespace icc {
already_AddRefed<StkCommandEvent>
StkCommandEvent::Create(mozilla::dom::EventTarget* aOwner,
StkCommandEvent::Create(EventTarget* aOwner,
const nsAString& aMessage)
{
nsRefPtr<StkCommandEvent> event = new StkCommandEvent(aOwner);
@ -45,6 +44,5 @@ StkCommandEvent::GetCommand(JSContext* aCx, JS::Value* aCommand)
return NS_OK;
}
}
}
}
} // namespace dom
} // namespace mozilla

View File

@ -2,16 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_icc_stkcommandevent_h
#define mozilla_dom_icc_stkcommandevent_h
#ifndef mozilla_dom_StkCommandEvent_h
#define mozilla_dom_StkCommandEvent_h
#include "mozilla/dom/MozStkCommandEventBinding.h"
#include "nsDOMEvent.h"
#include "SimToolKit.h"
#include "mozilla/dom/MozStkCommandEventBinding.h"
namespace mozilla {
namespace dom {
namespace icc {
class StkCommandEvent : public nsDOMEvent,
public nsIDOMMozStkCommandEvent
@ -49,10 +48,10 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::MozStkCommandEventBinding::Wrap(aCx, aScope, this);
return MozStkCommandEventBinding::Wrap(aCx, aScope, this);
}
JS::Value GetCommand(JSContext* aCx, mozilla::ErrorResult& aRv)
JS::Value GetCommand(JSContext* aCx, ErrorResult& aRv)
{
JS::Rooted<JS::Value> retVal(aCx);
aRv = GetCommand(aCx, retVal.address());
@ -60,7 +59,7 @@ public:
}
private:
StkCommandEvent(mozilla::dom::EventTarget* aOwner)
StkCommandEvent(EventTarget* aOwner)
: nsDOMEvent(aOwner, nullptr, nullptr)
{
SetIsDOMBinding();
@ -70,8 +69,7 @@ private:
{ }
};
}
}
}
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_icc_stkcommandevent_h
#endif // mozilla_dom_StkCommandEvent_h

View File

@ -4,7 +4,8 @@
# 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/.
EXPORTS.mozilla.dom.icc += [
EXPORTS.mozilla.dom += [
'IccManager.h',
'StkCommandEvent.h',
]

View File

@ -4,20 +4,11 @@
VPATH = $(srcdir)
ifdef MOZ_B2G_RIL
endif
include $(topsrcdir)/dom/dom-config.mk
LOCAL_INCLUDES = \
-I$(topsrcdir)/content/events/src \
$(NULL)
ifdef MOZ_B2G_RIL
LOCAL_INCLUDES += \
-I$(topsrcdir)/dom/icc/src \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk

View File

@ -712,6 +712,7 @@ this.COMPREHENSIONTLV_TAG_DATE_TIME_ZONE = 0x26;
this.COMPREHENSIONTLV_TAG_IMMEDIATE_RESPONSE = 0x2b;
this.COMPREHENSIONTLV_TAG_LANGUAGE = 0x2d;
this.COMPREHENSIONTLV_TAG_URL = 0x31;
this.COMPREHENSIONTLV_TAG_BROWSER_TERMINATION_CAUSE = 0x34;
this.COMPREHENSIONTLV_TAG_ACCESS_TECH = 0x3f;
this.COMPREHENSIONTLV_TAG_SERVICE_RECORD = 0x41;
this.COMPREHENSIONTLV_TAG_IMEISV = 0x62;
@ -964,6 +965,10 @@ this.STK_TIMER_START = 0x00;
this.STK_TIMER_DEACTIVATE = 0x01;
this.STK_TMIER_GET_CURRENT_VALUE = 0x02;
// Browser Termination Cause.
this.STK_BROWSER_TERMINATION_CAUSE_USER = 0x00;
this.STK_BROWSER_TERMINATION_CAUSE_ERROR = 0x01;
/**
* Supported Terminal Facilities.
*
@ -1016,7 +1021,7 @@ this.STK_TERMINAL_SUPPORT_EVENT_IDLE_SCREEN_AVAILABLE = 1;
this.STK_TERMINAL_SUPPORT_EVENT_CARD_READER_STATUS = 0;
this.STK_TERMINAL_SUPPORT_EVENT_LANGUAGE_SELECTION = 1;
this.STK_TERMINAL_SUPPORT_EVENT_BROWSER_TERMINATION = 0;
this.STK_TERMINAL_SUPPORT_EVENT_BROWSER_TERMINATION = 1;
this.STK_TERMINAL_SUPPORT_EVENT_DATA_AVAILABLE = 0;
this.STK_TERMINAL_SUPPORT_EVENT_CHANNEL_STATUS = 0;

View File

@ -2727,6 +2727,13 @@ let RIL = {
};
command.language = command.event.language;
break;
case STK_EVENT_TYPE_BROWSER_TERMINATION:
command.deviceId = {
sourceId: STK_DEVICE_ID_ME,
destinationId: STK_DEVICE_ID_SIM
};
command.terminationCause = command.event.terminationCause;
break;
}
this.sendICCEnvelopeCommand(command);
},
@ -2746,6 +2753,7 @@ let RIL = {
* @param [optional] cause
* @param [optional] timerId
* @param [optional] timerValue
* @param [optional] terminationCause
*/
sendICCEnvelopeCommand: function sendICCEnvelopeCommand(options) {
if (DEBUG) {
@ -2853,6 +2861,14 @@ let RIL = {
ComprehensionTlvHelper.writeLanguageTlv(options.language);
}
// Browser Termination
if (options.terminationCause != null) {
GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_BROWSER_TERMINATION_CAUSE |
COMPREHENSIONTLV_FLAG_CR);
GsmPDUHelper.writeHexOctet(1);
GsmPDUHelper.writeHexOctet(options.terminationCause);
}
// Calculate and write BER length to 2nd mark
Buf.stopCalOutgoingSize();

View File

@ -973,3 +973,60 @@ add_test(function test_stk_event_download_idle_screen_available() {
event: event
});
});
/**
* Verify Event Downloaded Command :Browser Termination
*/
add_test(function test_stk_event_download_browser_termination() {
let worker = newUint8SupportOutgoingIndexWorker();
let buf = worker.Buf;
let pduHelper = worker.GsmPDUHelper;
buf.sendParcel = function () {
// Type
do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND);
// Token : we don't care
this.readInt32();
// Data Size, 24 = 2 * ( 2+TLV_DEVICE_ID(4)+TLV_EVENT_LIST_SIZE(3)
// +TLV_BROWSER_TERMINATION_CAUSE(3) )
do_check_eq(this.readInt32(), 24);
// BER tag
do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG);
// BER length, 10 = TLV_DEVICE_ID(4)+TLV_EVENT_LIST_SIZE(3)
// ++TLV_BROWSER_TERMINATION_CAUSE(3)
do_check_eq(pduHelper.readHexOctet(), 10);
// Device Identities, Type-Length-Value(Source ID-Destination ID)
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 2);
do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME);
do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM);
// Event List, Type-Length-Value
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 1);
do_check_eq(pduHelper.readHexOctet(), STK_EVENT_TYPE_BROWSER_TERMINATION);
// Browser Termination Case, Type-Length-Value
do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_BROWSER_TERMINATION_CAUSE |
COMPREHENSIONTLV_FLAG_CR);
do_check_eq(pduHelper.readHexOctet(), 1);
do_check_eq(pduHelper.readHexOctet(), STK_BROWSER_TERMINATION_CAUSE_USER);
run_next_test();
};
let event = {
eventType: STK_EVENT_TYPE_BROWSER_TERMINATION,
terminationCause: STK_BROWSER_TERMINATION_CAUSE_USER
};
worker.RIL.sendStkEventDownload({
event: event
});
});

View File

@ -3675,16 +3675,6 @@ nsDisplayScrollLayer::GetScrollLayerCount()
#endif
}
intptr_t
nsDisplayScrollLayer::RemoveScrollLayerCount()
{
intptr_t result = GetScrollLayerCount();
FrameProperties props = mScrolledFrame->Properties();
props.Remove(nsIFrame::ScrollLayerCount());
return result;
}
nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer(
nsDisplayListBuilder* aBuilder,
nsIFrame* aScrolledFrame,
@ -3696,12 +3686,12 @@ nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer(
#endif
}
#ifdef NS_BUILD_REFCNT_LOGGING
nsDisplayScrollInfoLayer::~nsDisplayScrollInfoLayer()
{
FrameProperties props = mScrolledFrame->Properties();
props.Remove(nsIFrame::ScrollLayerCount());
MOZ_COUNT_DTOR(nsDisplayScrollInfoLayer);
}
#endif
LayerState
nsDisplayScrollInfoLayer::GetLayerState(nsDisplayListBuilder* aBuilder,
@ -3725,7 +3715,7 @@ nsDisplayScrollInfoLayer::ShouldFlattenAway(nsDisplayListBuilder* aBuilder)
// one nsDisplayScrollLayer (with rendered content) or one
// nsDisplayScrollInfoLayer (with only the metadata) should survive the
// visibility computation.
return RemoveScrollLayerCount() == 1;
return GetScrollLayerCount() == 1;
}
nsDisplayZoom::nsDisplayZoom(nsDisplayListBuilder* aBuilder,

View File

@ -2728,11 +2728,10 @@ public:
// number does not include nsDisplayScrollInfoLayers. If this number is not 1
// after merging, all the nsDisplayScrollLayers should flatten away.
intptr_t GetScrollLayerCount();
intptr_t RemoveScrollLayerCount();
virtual nsIFrame* GetScrolledFrame() { return mScrolledFrame; }
private:
protected:
nsIFrame* mScrollFrame;
nsIFrame* mScrolledFrame;
};
@ -2755,9 +2754,7 @@ public:
nsIFrame* aScrolledFrame, nsIFrame* aScrollFrame);
NS_DISPLAY_DECL_NAME("ScrollInfoLayer", TYPE_SCROLL_INFO_LAYER)
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayScrollInfoLayer();
#endif
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,

View File

@ -645,7 +645,7 @@ DebuggerClient.prototype = {
? aPacket
: this.compat.onPacket(aPacket);
resolve(packet).then((aPacket) => {
resolve(packet).then(aPacket => {
if (!aPacket.from) {
let msg = "Server did not specify an actor, dropping packet: " +
JSON.stringify(aPacket);
@ -1977,6 +1977,7 @@ LongStringClient.prototype = {
function SourceClient(aClient, aForm) {
this._form = aForm;
this._isBlackBoxed = aForm.isBlackBoxed;
this._isPrettyPrinted = aForm.isPrettyPrinted;
this._client = aClient;
}
@ -1984,6 +1985,7 @@ SourceClient.prototype = {
get _transport() this._client._transport,
get _activeThread() this._client.activeThread,
get isBlackBoxed() this._isBlackBoxed,
get isPrettyPrinted() this._isPrettyPrinted,
get actor() this._form.actor,
get request() this._client.request,
get url() this._form.url,
@ -2053,6 +2055,29 @@ SourceClient.prototype = {
indent: aIndent
};
this._client.request(packet, aResponse => {
if (!aResponse.error) {
this._isPrettyPrinted = true;
this._activeThread._clearFrames();
this._activeThread.notify("prettyprintchange", this);
}
this._onSourceResponse(aResponse, aCallback);
});
},
/**
* Stop pretty printing this source's text.
*/
disablePrettyPrint: function SC_disablePrettyPrint(aCallback) {
const packet = {
to: this._form.actor,
type: "disablePrettyPrint"
};
this._client.request(packet, aResponse => {
if (!aResponse.error) {
this._isPrettyPrinted = false;
this._activeThread._clearFrames();
this._activeThread.notify("prettyprintchange", this);
}
this._onSourceResponse(aResponse, aCallback);
});
},

View File

@ -2365,12 +2365,26 @@ function SourceActor({ url, thread, sourceMap, generatedSource, text,
this.onSource = this.onSource.bind(this);
this._invertSourceMap = this._invertSourceMap.bind(this);
this._saveMap = this._saveMap.bind(this);
this._getSourceText = this._getSourceText.bind(this);
if (this.threadActor.sources.isPrettyPrinted(this.url)) {
this._init = this.onPrettyPrint({
indent: this.threadActor.sources.prettyPrintIndent(this.url)
}).then(null, error => {
DevToolsUtils.reportException("SourceActor", error);
});
} else {
this._init = null;
}
}
SourceActor.prototype = {
constructor: SourceActor,
actorPrefix: "source",
_oldSourceMap: null,
_init: null,
get threadActor() this._threadActor,
get url() this._url,
@ -2382,7 +2396,8 @@ SourceActor.prototype = {
return {
actor: this.actorID,
url: this._url,
isBlackBoxed: this.threadActor.sources.isBlackBoxed(this.url)
isBlackBoxed: this.threadActor.sources.isBlackBoxed(this.url),
isPrettyPrinted: this.threadActor.sources.isPrettyPrinted(this.url)
// TODO bug 637572: introductionScript
};
},
@ -2417,8 +2432,9 @@ SourceActor.prototype = {
/**
* Handler for the "source" packet.
*/
onSource: function SA_onSource(aRequest) {
return this._getSourceText()
onSource: function SA_onSource() {
return resolve(this._init)
.then(this._getSourceText)
.then(({ content, contentType }) => {
return {
from: this.actorID,
@ -2427,7 +2443,7 @@ SourceActor.prototype = {
contentType: contentType
};
})
.then(null, (aError) => {
.then(null, aError => {
reportError(aError, "Got an exception during SA_onSource: ");
return {
"from": this.actorID,
@ -2442,17 +2458,27 @@ SourceActor.prototype = {
* Handler for the "prettyPrint" packet.
*/
onPrettyPrint: function ({ indent }) {
this.threadActor.sources.prettyPrint(this._url, indent);
return this._getSourceText()
.then(this._parseAST)
.then(this._sendToPrettyPrintWorker(indent))
.then(this._invertSourceMap)
.then(this._saveMap)
.then(() => {
// We need to reset `_init` now because we have already done the work of
// pretty printing, and don't want onSource to wait forever for
// initialization to complete.
this._init = null;
})
.then(this.onSource)
.then(null, error => ({
from: this.actorID,
error: "prettyPrintError",
message: DevToolsUtils.safeErrorString(error)
}));
.then(null, error => {
this.onDisablePrettyPrint();
return {
from: this.actorID,
error: "prettyPrintError",
message: DevToolsUtils.safeErrorString(error)
};
});
},
/**
@ -2572,6 +2598,7 @@ SourceActor.prototype = {
_saveMap: function SA__saveMap({ map }) {
if (this._sourceMap) {
// Compose the source maps
this._oldSourceMap = this._sourceMap;
this._sourceMap = SourceMapGenerator.fromSourceMap(this._sourceMap);
this._sourceMap.applySourceMap(map, this._url);
this._sourceMap = SourceMapConsumer.fromSourceMap(this._sourceMap);
@ -2583,6 +2610,17 @@ SourceActor.prototype = {
}
},
/**
* Handler for the "disablePrettyPrint" packet.
*/
onDisablePrettyPrint: function SA_onDisablePrettyPrint() {
this._sourceMap = this._oldSourceMap;
this.threadActor.sources.saveSourceMap(this._sourceMap,
this._generatedSource || this._url);
this.threadActor.sources.disablePrettyPrint(this._url);
return this.onSource();
},
/**
* Handler for the "blackbox" packet.
*/
@ -2614,7 +2652,8 @@ SourceActor.prototype.requestTypes = {
"source": SourceActor.prototype.onSource,
"blackbox": SourceActor.prototype.onBlackBox,
"unblackbox": SourceActor.prototype.onUnblackBox,
"prettyPrint": SourceActor.prototype.onPrettyPrint
"prettyPrint": SourceActor.prototype.onPrettyPrint,
"disablePrettyPrint": SourceActor.prototype.onDisablePrettyPrint
};
@ -3718,6 +3757,7 @@ function ThreadSources(aThreadActor, aUseSourceMaps, aAllowPredicate,
* the breakpoint store.
*/
ThreadSources._blackBoxedSources = new Set();
ThreadSources._prettyPrintedSources = new Map();
ThreadSources.prototype = {
/**
@ -3847,6 +3887,10 @@ ThreadSources.prototype = {
* down the line.
*/
saveSourceMap: function TS_saveSourceMap(aSourceMap, aGeneratedSource) {
if (!aSourceMap) {
delete this._sourceMapsByGeneratedSource[aGeneratedSource];
return null;
}
this._sourceMapsByGeneratedSource[aGeneratedSource] = resolve(aSourceMap);
for (let s of aSourceMap.sources) {
this._generatedUrlsByOriginalUrl[s] = aGeneratedSource;
@ -3969,9 +4013,7 @@ ThreadSources.prototype = {
},
/**
* Add the given source URL to the set of sources that are black boxed. If the
* thread is currently paused and we are black boxing the yougest frame's
* source, this will force a step.
* Add the given source URL to the set of sources that are black boxed.
*
* @param aURL String
* The URL of the source which we are black boxing.
@ -3990,6 +4032,43 @@ ThreadSources.prototype = {
ThreadSources._blackBoxedSources.delete(aURL);
},
/**
* Returns true if the given URL is pretty printed.
*
* @param aURL String
* The URL of the source that might be pretty printed.
*/
isPrettyPrinted: function TS_isPrettyPrinted(aURL) {
return ThreadSources._prettyPrintedSources.has(aURL);
},
/**
* Add the given URL to the set of sources that are pretty printed.
*
* @param aURL String
* The URL of the source to be pretty printed.
*/
prettyPrint: function TS_prettyPrint(aURL, aIndent) {
ThreadSources._prettyPrintedSources.set(aURL, aIndent);
},
/**
* Return the indent the given URL was pretty printed by.
*/
prettyPrintIndent: function TS_prettyPrintIndent(aURL) {
return ThreadSources._prettyPrintedSources.get(aURL);
},
/**
* Remove the given URL from the set of sources that are pretty printed.
*
* @param aURL String
* The URL of the source that is no longer pretty printed.
*/
disablePrettyPrint: function TS_disablePrettyPrint(aURL) {
ThreadSources._prettyPrintedSources.delete(aURL);
},
/**
* Normalize multiple relative paths towards the base paths on the right.
*/

View File

@ -0,0 +1,100 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = ["ShortcutUtils"];
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "PlatformKeys", function() {
return Services.strings.createBundle(
"chrome://global-platform/locale/platformKeys.properties");
});
XPCOMUtils.defineLazyGetter(this, "Keys", function() {
return Services.strings.createBundle(
"chrome://global/locale/keys.properties");
});
let ShortcutUtils = {
/**
* Prettifies the modifier keys for an element.
*
* @param Node aElemKey
* The key element to get the modifiers from.
* @param boolean aNoCloverLeaf
* Pass true to use a descriptive string instead of the cloverleaf symbol. (OS X only)
* @return string
* A prettified and properly separated modifier keys string.
*/
prettifyShortcut: function(aElemKey, aNoCloverLeaf) {
let elemString = "";
let elemMod = aElemKey.getAttribute("modifiers");
if (elemMod.match("accel")) {
if (Services.appinfo.OS == "Darwin") {
// XXX bug 779642 Use "Cmd-" literal vs. cloverleaf meta-key until
// Orion adds variable height lines.
if (aNoCloverLeaf) {
elemString += "Cmd-";
} else {
elemString += PlatformKeys.GetStringFromName("VK_META") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
} else {
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
}
if (elemMod.match("access")) {
if (Services.appinfo.OS == "Darwin") {
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
} else {
elemString += PlatformKeys.GetStringFromName("VK_ALT") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
}
if (elemMod.match("os")) {
elemString += PlatformKeys.GetStringFromName("VK_WIN") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
if (elemMod.match("shift")) {
elemString += PlatformKeys.GetStringFromName("VK_SHIFT") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
if (elemMod.match("alt")) {
elemString += PlatformKeys.GetStringFromName("VK_ALT") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
if (elemMod.match("ctrl") || elemMod.match("control")) {
elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
if (elemMod.match("meta")) {
elemString += PlatformKeys.GetStringFromName("VK_META") +
PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
}
let key;
let keyCode = aElemKey.getAttribute("keycode");
if (keyCode) {
try {
// Some keys might not exist in the locale file, which will throw:
key = Keys.GetStringFromName(keyCode.toUpperCase());
} catch (ex) {
Cu.reportError("Error finding " + keyCode + ": " + ex);
key = keyCode.replace(/^VK_/, '');
}
} else {
key = aElemKey.getAttribute("key");
}
return elemString + key;
}
};
Object.freeze(ShortcutUtils);

View File

@ -35,6 +35,7 @@ EXTRA_JS_MODULES += [
'RemoteWebProgress.jsm',
'SelectContentHelper.jsm',
'SelectParentHelper.jsm',
'ShortcutUtils.jsm',
'Sntp.jsm',
'SpatialNavigation.jsm',
'Sqlite.jsm',

View File

@ -24,6 +24,7 @@
#include "mozilla/Services.h"
#include "nsThreadUtils.h"
#include "ProfilerMarkers.h"
#include "nsXULAppAPI.h"
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
#include "AndroidBridge.h"
@ -65,6 +66,13 @@ TableTicker* Sampler::sActiveSampler;
static mozilla::StaticAutoPtr<mozilla::ProfilerIOInterposeObserver>
sInterposeObserver;
// The name that identifies the gecko thread for calls to
// profiler_register_thread. For all platform except metro
// the thread that calls mozilla_sampler_init is considered
// the gecko thread. With metro the gecko thread is
// registered later based on this thread name.
static const char * gGeckoThreadName = "GeckoMain";
void Sampler::Startup() {
sRegisteredThreads = new std::vector<ThreadInfo*>();
sRegisteredThreadsMutex = new mozilla::Mutex("sRegisteredThreads mutex");
@ -367,6 +375,13 @@ void set_tls_stack_top(void* stackTop)
tlsStackTop.set((void*)stackTopR);
}
bool is_main_thread_name(const char* aName) {
if (aName) {
return false;
}
return strcmp(aName, gGeckoThreadName) == 0;
}
////////////////////////////////////////////////////////////////////////
// BEGIN externally visible functions
@ -389,7 +404,14 @@ void mozilla_sampler_init(void* stackTop)
PseudoStack *stack = new PseudoStack();
tlsPseudoStack.set(stack);
Sampler::RegisterCurrentThread("GeckoMain", stack, true, stackTop);
bool isMainThread = true;
#ifdef XP_WIN
// For metrofx, we'll register the main thread once it's created.
isMainThread = !(XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro);
#endif
Sampler::RegisterCurrentThread(isMainThread ?
gGeckoThreadName : "Application Thread",
stack, isMainThread, stackTop);
// Read mode settings from MOZ_PROFILER_MODE and interval
// settings from MOZ_PROFILER_INTERVAL and stack-scan threshhold
@ -730,8 +752,8 @@ bool mozilla_sampler_register_thread(const char* aName, void* stackTop)
PseudoStack* stack = new PseudoStack();
tlsPseudoStack.set(stack);
return Sampler::RegisterCurrentThread(aName, stack, false, stackTop);
bool isMainThread = is_main_thread_name(aName);
return Sampler::RegisterCurrentThread(aName, stack, isMainThread, stackTop);
}
void mozilla_sampler_unregister_thread()

View File

@ -12,6 +12,7 @@
#include "nsICommandLineRunner.h"
#include "FrameworkView.h"
#include "nsAppDirectoryServiceDefs.h"
#include "GeckoProfiler.h"
#include <shellapi.h>
using namespace ABI::Windows::ApplicationModel;
@ -27,6 +28,8 @@ using namespace Microsoft::WRL::Wrappers;
extern nsresult XRE_metroStartup(bool runXREMain);
extern void XRE_metroShutdown();
static const char* gGeckoThreadName = "GeckoMain";
#ifdef PR_LOGGING
extern PRLogModuleInfo* gWindowsLog;
#endif
@ -65,6 +68,12 @@ MetroApp::Run()
{
LogThread();
// Name this thread for debugging and register it with the profiler
// as the main gecko thread.
char aLocal;
PR_SetCurrentThreadName(gGeckoThreadName);
profiler_register_thread(gGeckoThreadName, &aLocal);
HRESULT hr;
hr = sCoreApp->add_Suspending(Callback<__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs_t>(
this, &MetroApp::OnSuspending).Get(), &mSuspendEvent);
@ -101,6 +110,9 @@ MetroApp::ShutdownXPCOM()
// Shut down xpcom
XRE_metroShutdown();
// Unhook this thread from the profiler
profiler_unregister_thread();
}
// Request a shutdown of the application