Commit fa375662 authored by Gurzau Raul's avatar Gurzau Raul
Browse files

Merge inbound to mozilla-central. a=merge

parents 5c218126 59490ec8
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
/**
* A test that checks whether any preference getter from the given list
* of stats was called more often than the max parameter.
......@@ -120,7 +122,10 @@ add_task(async function startup() {
// This opens 10 tabs and checks pref getters.
add_task(async function open_10_tabs() {
let max = 15;
// This is somewhat arbitrary. When we had a default of 4 content processes
// the value was 15. We need to scale it as we increase the number of
// content processes so we approximate with 4 * process_count.
const max = 4 * DEFAULT_PROCESS_COUNT;
let whitelist = {
"layout.css.dpi": {
......@@ -146,10 +151,6 @@ add_task(async function open_10_tabs() {
min: 10,
max: 18,
},
"dom.ipc.processCount": {
min: 10,
max: 15,
},
"browser.startup.record": {
max: 20,
},
......
......@@ -6,7 +6,7 @@ support-files =
[browser_autoSubmitRequest.js]
[browser_clearEmail.js]
[browser_noPermanentKey.js]
skip-if = (os == "linux") || verify # Bug 1383315
skip-if = true # Bug 1383315
[browser_showForm.js]
[browser_shown.js]
skip-if = (verify && !debug && (os == 'win'))
......
......@@ -2,6 +2,8 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
add_task(async function test_slow_content_script() {
// Make sure we get a new process for our tab, or our reportProcessHangs
// preferences value won't apply to it.
......@@ -15,7 +17,7 @@ add_task(async function test_slow_content_script() {
await SpecialPowers.pushPrefEnv({
set: [
["dom.ipc.processCount", 8],
["dom.ipc.processCount", DEFAULT_PROCESS_COUNT * 2],
["dom.ipc.processPrelaunch.enabled", false],
["dom.ipc.reportProcessHangs", true],
],
......
......@@ -613,6 +613,7 @@
<menuitem label="5" value="5"/>
<menuitem label="6" value="6"/>
<menuitem label="7" value="7"/>
<menuitem label="8" value="8"/>
</menupopup>
</menulist>
</hbox>
......
......@@ -44,7 +44,9 @@ add_task(async function testPrefsAreDefault() {
});
add_task(async function testPrefsSetByUser() {
Services.prefs.setIntPref("dom.ipc.processCount", DEFAULT_PROCESS_COUNT + 2);
const kNewCount = DEFAULT_PROCESS_COUNT - 2;
Services.prefs.setIntPref("dom.ipc.processCount", kNewCount);
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false);
let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
......@@ -56,8 +58,8 @@ add_task(async function testPrefsSetByUser() {
let contentProcessCount = doc.querySelector("#contentProcessCount");
is(contentProcessCount.disabled, false, "process count control should be enabled");
is(Services.prefs.getIntPref("dom.ipc.processCount"), DEFAULT_PROCESS_COUNT + 2, "process count should be the set value");
is(contentProcessCount.selectedItem.value, DEFAULT_PROCESS_COUNT + 2, "selected item should be the set one");
is(Services.prefs.getIntPref("dom.ipc.processCount"), kNewCount, "process count should be the set value");
is(contentProcessCount.selectedItem.value, kNewCount, "selected item should be the set one");
let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings");
useRecommendedPerformanceSettings.click();
......
......@@ -624,6 +624,7 @@ support-files =
examples/doc-pause-points.html
examples/doc-return-values.html
examples/doc-wasm-sourcemaps.html
examples/doc_global-method-override.html
examples/asm.js
examples/async.js
examples/bogus-map.js
......@@ -686,6 +687,8 @@ skip-if = (os == "win" && ccov) # Bug 1424154
[browser_dbg-ember-quickstart.js]
[browser_dbg-expressions.js]
[browser_dbg-expressions-error.js]
[browser_dbg_global-method-override.js]
skip-if = e10s && debug
[browser_dbg-iframes.js]
[browser_dbg-inline-cache.js]
[browser_dbg-keyboard-navigation.js]
......
......@@ -5,22 +5,14 @@
/**
* Tests that scripts that override properties of the global object, like
* toString don't break the debugger. The test page used to cause the debugger
* toString, don't break the debugger. The test page used to cause the debugger
* to throw when trying to attach to the thread actor.
*/
const TAB_URL = EXAMPLE_URL + "doc_global-method-override.html";
"use strict";
function test() {
let options = {
source: TAB_URL,
line: 1
};
initDebugger(TAB_URL, options).then(([aTab, aPanel]) => {
let gDebugger = aPanel.panelWin;
ok(gDebugger, "Should have a debugger available.");
is(gDebugger.gThreadClient.state, "attached", "Debugger should be attached.");
closeDebuggerAndFinish(aPanel);
});
}
add_task(async function() {
const dbg = await initDebugger("doc_global-method-override.html");
ok(dbg, "Should have a debugger available.");
is(dbg.toolbox.threadClient.state, "attached", "Debugger should be attached.");
});
......@@ -6,8 +6,6 @@ tags = devtools
subsuite = devtools
skip-if = (os == 'linux' && debug && bits == 32)
support-files =
addon1.xpi
addon2.xpi
addon4.xpi
addon5.xpi
addon-webext-contentscript.xpi
......@@ -70,7 +68,6 @@ support-files =
doc_function-display-name.html
doc_function-jump.html
doc_function-search.html
doc_global-method-override.html
doc_iframes.html
doc_included-script.html
doc_inline-debugger-statement.html
......@@ -147,10 +144,6 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_bug-896139.js]
skip-if = e10s && debug
[browser_dbg_chrome-create.js]
skip-if = (e10s && debug) || (verify && os == "linux") # Exit code mismatch with verify
[browser_dbg_chrome-debugging.js]
skip-if = e10s && debug
[browser_dbg_clean-exit.js]
skip-if = true # Bug 1044985 (racy test)
[browser_dbg_closure-inspection.js]
......@@ -193,10 +186,6 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_file-reload.js]
skip-if = e10s && debug
[browser_dbg_global-method-override.js]
skip-if = e10s && debug
[browser_dbg_globalactor.js]
skip-if = e10s
[browser_dbg_host-layout.js]
skip-if = e10s && debug
[browser_dbg_jump-to-function-definition.js]
......@@ -205,15 +194,4 @@ skip-if = e10s && debug
skip-if = e10s # TODO
[browser_dbg_interrupts.js]
skip-if = e10s && debug
[browser_dbg_listaddons.js]
skip-if = e10s && debug
tags = addons
[browser_dbg_listtabs-01.js]
[browser_dbg_listtabs-02.js]
skip-if = true # Never worked for remote frames, needs a mock DebuggerServerConnection
[browser_dbg_listtabs-03.js]
skip-if = e10s && debug
[browser_dbg_listworkers.js]
[browser_dbg_multiple-windows.js]
[browser_dbg_navigation.js]
skip-if = e10s && debug
......@@ -6,8 +6,6 @@ tags = devtools
subsuite = devtools
skip-if = (os == 'linux' && debug && bits == 32)
support-files =
addon1.xpi
addon2.xpi
addon4.xpi
addon5.xpi
addon-webext-contentscript.xpi
......@@ -70,7 +68,6 @@ support-files =
doc_function-display-name.html
doc_function-jump.html
doc_function-search.html
doc_global-method-override.html
doc_iframes.html
doc_included-script.html
doc_inline-debugger-statement.html
......@@ -159,8 +156,6 @@ uses-unsafe-cpows = true
skip-if = e10s && debug
[browser_dbg_split-console-paused-reload.js]
skip-if = true # Bug 1288348 - previously e10s && debug
[browser_dbg_target-scoped-actor-01.js]
[browser_dbg_target-scoped-actor-02.js]
[browser_dbg_terminate-on-tab-close.js]
uses-unsafe-cpows = true
skip-if = e10s && debug
......
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that a chrome debugger can be created in a new process.
*/
// There are shutdown issues for which multiple rejections are left uncaught.
// See bug 1018184 for resolving these issues.
const { PromiseTestUtils } = scopedCuImport("resource://testing-common/PromiseTestUtils.jsm");
PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
PromiseTestUtils.whitelistRejectionsGlobally(/NS_ERROR_FAILURE/);
var gProcess;
function test() {
// Windows XP and 8.1 test slaves are terribly slow at this test.
requestLongerTimeout(5);
Services.prefs.setBoolPref("devtools.chrome.enabled", true);
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
initChromeDebugger(aOnClose).then(aProcess => {
gProcess = aProcess;
info("Starting test...");
performTest();
});
}
function performTest() {
ok(gProcess._dbgProcess,
"The remote debugger process wasn't created properly!");
ok(gProcess._dbgProcess.exitCode == null,
"The remote debugger process isn't running!");
is(typeof gProcess._dbgProcess.pid, "number",
"The remote debugger process doesn't have a pid (?!)");
info("process location: " + gProcess._dbgProcess.location);
info("process pid: " + gProcess._dbgProcess.pid);
info("process name: " + gProcess._dbgProcess.processName);
info("process sig: " + gProcess._dbgProcess.processSignature);
ok(gProcess._dbgProfilePath,
"The remote debugger profile wasn't created properly!");
is(gProcess._dbgProfilePath, OS.Path.join(OS.Constants.Path.profileDir, "chrome_debugger_profile"),
"The remote debugger profile isn't where we expect it!");
info("profile path: " + gProcess._dbgProfilePath);
gProcess.close();
}
function aOnClose() {
is(gProcess._dbgProcess.exitCode, (Services.appinfo.OS == "WINNT" ? -9 : -15),
"The remote debugger process didn't die cleanly.");
info("process exit value: " + gProcess._dbgProcess.exitValue);
info("profile path: " + gProcess._dbgProfilePath);
finish();
}
registerCleanupFunction(function () {
Services.prefs.clearUserPref("devtools.chrome.enabled");
Services.prefs.clearUserPref("devtools.debugger.remote-enabled");
gProcess = null;
});
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that chrome debugging works.
*/
const TAB_URL = EXAMPLE_URL + "doc_inline-debugger-statement.html";
var gClient, gThreadClient;
var gAttached = promise.defer();
var gNewChromeSource = promise.defer();
var { DevToolsLoader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
var customLoader = new DevToolsLoader();
customLoader.invisibleToDebugger = true;
var { DebuggerServer } = customLoader.require("devtools/server/main");
function test() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect().then(([aType, aTraits]) => {
is(aType, "browser",
"Root actor should identify itself as a browser.");
promise.all([gAttached.promise, gNewChromeSource.promise])
.then(resumeAndCloseConnection)
.then(finish)
.catch(aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
testParentProcessTargetActor();
});
}
function testParentProcessTargetActor() {
gClient.getProcess().then(aResponse => {
let actor = aResponse.form.actor;
gClient.attachTarget(actor).then(([response, tabClient]) => {
tabClient.attachThread(null).then(([aResponse, aThreadClient]) => {
gThreadClient = aThreadClient;
gThreadClient.addListener("newSource", onNewSource);
if (aResponse.error) {
ok(false, "Couldn't attach to the chrome debugger.");
gAttached.reject();
} else {
ok(true, "Attached to the chrome debugger.");
gAttached.resolve();
// Ensure that a new chrome global will be created.
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
}
});
});
});
}
function onNewSource(aEvent, aPacket) {
if (aPacket.source.url.startsWith("chrome:")) {
ok(true, "Received a new chrome source: " + aPacket.source.url);
gThreadClient.removeListener("newSource", onNewSource);
gNewChromeSource.resolve();
}
}
function resumeAndCloseConnection() {
let deferred = promise.defer();
gThreadClient.resume(() => deferred.resolve(gClient.close()));
return deferred.promise;
}
registerCleanupFunction(function () {
gClient = null;
gThreadClient = null;
gAttached = null;
gNewChromeSource = null;
customLoader = null;
DebuggerServer = null;
});
......@@ -307,6 +307,12 @@ pref("devtools.editor.detectindentation", true);
pref("devtools.editor.enableCodeFolding", true);
pref("devtools.editor.autocomplete", true);
// The width of the viewport.
pref("devtools.responsive.viewport.width", 320);
// The height of the viewport.
pref("devtools.responsive.viewport.height", 480);
// The pixel ratio of the viewport.
pref("devtools.responsive.viewport.pixelRatio", 0);
// Whether or not the viewports are left aligned.
pref("devtools.responsive.leftAlignViewport.enabled", false);
// Whether to reload when touch simulation is toggled
......@@ -315,6 +321,11 @@ pref("devtools.responsive.reloadConditions.touchSimulation", false);
pref("devtools.responsive.reloadConditions.userAgent", false);
// Whether to show the notification about reloading to apply emulation
pref("devtools.responsive.reloadNotification.enabled", true);
// Whether or not touch simulation is enabled.
pref("devtools.responsive.touchSimulation.enabled", false);
// The user agent of the viewport.
pref("devtools.responsive.userAgent", "");
// Whether to show the settings onboarding tooltip only in release or beta builds.
#if defined(RELEASE_OR_BETA)
pref("devtools.responsive.show-setting-tooltip", true);
......
......@@ -5,6 +5,7 @@
"use strict";
const Services = require("Services");
const asyncStorage = require("devtools/shared/async-storage");
const {
ADD_DEVICE,
......@@ -16,8 +17,11 @@ const {
UPDATE_DEVICE_DISPLAYED,
UPDATE_DEVICE_MODAL,
} = require("./index");
const { post } = require("../utils/message");
const { addDevice, getDevices, removeDevice } = require("devtools/client/shared/devices");
const { changeUserAgent, toggleTouchSimulation } = require("./ui");
const { changeDevice, changePixelRatio, resizeViewport } = require("./viewports");
const DISPLAYED_DEVICES_PREF = "devtools.responsive.html.displayedDeviceList";
......@@ -160,6 +164,45 @@ module.exports = {
};
},
restoreDeviceState() {
return async function(dispatch, getState) {
const deviceState = await asyncStorage.getItem("devtools.responsive.deviceState");
if (!deviceState) {
return;
}
const { id, device: deviceName, deviceType } = deviceState;
const devices = getState().devices;
if (!devices.types.includes(deviceType)) {
// Can't find matching device type.
return;
}
const device = devices[deviceType].find(d => d.name === deviceName);
if (!device) {
// Can't find device with the same device name.
return;
}
post(window, {
type: "viewport-resize",
width: device.width,
height: device.height,
});
post(window, {
type: "change-device",
device,
});
dispatch(resizeViewport(id, device.width, device.height));
dispatch(changeDevice(id, device.name, deviceType));
dispatch(changePixelRatio(id, device.pixelRatio));
dispatch(changeUserAgent(device.userAgent));
dispatch(toggleTouchSimulation(device.touch));
};
},
updateDeviceModal(isOpen, modalOpenedFromViewport = null) {
return {
type: UPDATE_DEVICE_MODAL,
......
......@@ -6,6 +6,8 @@
"use strict";
const asyncStorage = require("devtools/shared/async-storage");
const {
ADD_VIEWPORT,
CHANGE_DEVICE,
......@@ -33,11 +35,20 @@ module.exports = {
* Change the viewport device.
*/
changeDevice(id, device, deviceType) {
return {
type: CHANGE_DEVICE,
id,
device,
deviceType,
return async function(dispatch) {
dispatch({
type: CHANGE_DEVICE,
id,
device,
deviceType,
});
try {
await asyncStorage.setItem("devtools.responsive.deviceState",
{ id, device, deviceType });
} catch (e) {
console.error(e);
}
};
},
......@@ -56,10 +67,15 @@ module.exports = {
* Remove the viewport's device assocation.
*/
removeDeviceAssociation(id) {
post(window, "remove-device-association");
return {
type: REMOVE_DEVICE_ASSOCIATION,
id,
return async function(dispatch) {
post(window, "remove-device-association");
dispatch({
type: REMOVE_DEVICE_ASSOCIATION,
id,
});
await asyncStorage.removeItem("devtools.responsive.deviceState");
};
},
......
......@@ -22,7 +22,7 @@ const { Provider } = require("devtools/client/shared/vendor/react-redux");
const message = require("./utils/message");
const App = createFactory(require("./components/App"));
const Store = require("./store");
const { loadDevices } = require("./actions/devices");
const { loadDevices, restoreDeviceState } = require("./actions/devices");
const { addViewport, resizeViewport } = require("./actions/viewports");
const { changeDisplayPixelRatio } = require("./actions/ui");
......@@ -78,7 +78,9 @@ message.wait(window, "init").then(() => bootstrap.init());
// manager.js sends a message to signal init is done, which can be used for delayed
// startup work that shouldn't block initial load
message.wait(window, "post-init").then(() => {
bootstrap.dispatch(loadDevices());
bootstrap.store.dispatch(loadDevices()).then(() => {
bootstrap.dispatch(restoreDeviceState());
});
});
window.addEventListener("unload", function() {
......
......@@ -7,10 +7,9 @@
const { Ci } = require("chrome");
const promise = require("promise");
const Services = require("Services");
const asyncStorage = require("devtools/shared/async-storage");
const EventEmitter = require("devtools/shared/event-emitter");
const TOOL_URL = "chrome://devtools/content/responsive.html/index.xhtml";
loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/debugger-client", true);
loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
loader.lazyRequireGetter(this, "throttlingProfiles", "devtools/client/shared/components/throttling/profiles");
......@@ -26,6 +25,8 @@ loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/targe
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
loader.lazyRequireGetter(this, "Telemetry", "devtools/client/shared/telemetry");
const TOOL_URL = "chrome://devtools/content/responsive.html/index.xhtml";
const RELOAD_CONDITION_PREF_PREFIX = "devtools.responsive.reloadConditions.";
const RELOAD_NOTIFICATION_PREF = "devtools.responsive.reloadNotification.enabled";
const SHOW_SETTING_TOOLTIP_PREF = "devtools.responsive.show-setting-tooltip";
......@@ -361,6 +362,9 @@ ResponsiveUI.prototype = {
debug("Wait until RDP server connect");
await this.connectToServer();
// Restore the previous state of RDM.
await this.restoreState();
// Show the settings onboarding tooltip
if (Services.prefs.getBoolPref(SHOW_SETTING_TOOLTIP_PREF)) {
this.settingOnboardingTooltip =
......@@ -535,7 +539,7 @@ ResponsiveUI.prototype = {
this.onExit();
break;
case "remove-device-association":
this.onRemoveDeviceAssociation(event);
this.onRemoveDeviceAssociation();
break;
case "viewport-resize":
this.onViewportResize(event);
......@@ -604,7 +608,7 @@ ResponsiveUI.prototype = {
ResponsiveUIManager.closeIfNeeded(browserWindow, tab);
},