import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,86 @@
/* 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";
const {
ADD_DEVICE,
ADD_DEVICE_TYPE,
LOAD_DEVICE_LIST_START,
LOAD_DEVICE_LIST_ERROR,
LOAD_DEVICE_LIST_END,
UPDATE_DEVICE_DISPLAYED,
UPDATE_DEVICE_MODAL_OPEN,
} = require("../actions/index");
const Types = require("../types");
const INITIAL_DEVICES = {
types: [],
isModalOpen: false,
listState: Types.deviceListState.INITIALIZED,
};
let reducers = {
[ADD_DEVICE](devices, { device, deviceType }) {
return Object.assign({}, devices, {
[deviceType]: [...devices[deviceType], device],
});
},
[ADD_DEVICE_TYPE](devices, { deviceType }) {
return Object.assign({}, devices, {
types: [...devices.types, deviceType],
[deviceType]: [],
});
},
[UPDATE_DEVICE_DISPLAYED](devices, { device, deviceType, displayed }) {
let newDevices = devices[deviceType].map(d => {
if (d == device) {
d.displayed = displayed;
}
return d;
});
return Object.assign({}, devices, {
[deviceType]: newDevices,
});
},
[LOAD_DEVICE_LIST_START](devices, action) {
return Object.assign({}, devices, {
listState: Types.deviceListState.LOADING,
});
},
[LOAD_DEVICE_LIST_ERROR](devices, action) {
return Object.assign({}, devices, {
listState: Types.deviceListState.ERROR,
});
},
[LOAD_DEVICE_LIST_END](devices, action) {
return Object.assign({}, devices, {
listState: Types.deviceListState.LOADED,
});
},
[UPDATE_DEVICE_MODAL_OPEN](devices, { isOpen }) {
return Object.assign({}, devices, {
isModalOpen: isOpen,
});
},
};
module.exports = function (devices = INITIAL_DEVICES, action) {
let reducer = reducers[action.type];
if (!reducer) {
return devices;
}
return reducer(devices, action);
};

View file

@ -0,0 +1,26 @@
/* 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/. */
/* eslint-env browser */
"use strict";
const { CHANGE_DISPLAY_PIXEL_RATIO } = require("../actions/index");
const INITIAL_DISPLAY_PIXEL_RATIO = 0;
let reducers = {
[CHANGE_DISPLAY_PIXEL_RATIO](_, action) {
return action.displayPixelRatio;
},
};
module.exports = function (displayPixelRatio = INITIAL_DISPLAY_PIXEL_RATIO, action) {
let reducer = reducers[action.type];
if (!reducer) {
return displayPixelRatio;
}
return reducer(displayPixelRatio, action);
};

View file

@ -0,0 +1,25 @@
/* 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";
const { CHANGE_LOCATION } = require("../actions/index");
const INITIAL_LOCATION = "about:blank";
let reducers = {
[CHANGE_LOCATION](_, action) {
return action.location;
},
};
module.exports = function (location = INITIAL_LOCATION, action) {
let reducer = reducers[action.type];
if (!reducer) {
return location;
}
return reducer(location, action);
};

View file

@ -0,0 +1,15 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DevToolsModules(
'devices.js',
'display-pixel-ratio.js',
'location.js',
'network-throttling.js',
'screenshot.js',
'touch-simulation.js',
'viewports.js',
)

View file

@ -0,0 +1,33 @@
/* 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";
const {
CHANGE_NETWORK_THROTTLING,
} = require("../actions/index");
const INITIAL_NETWORK_THROTTLING = {
enabled: false,
profile: "",
};
let reducers = {
[CHANGE_NETWORK_THROTTLING](throttling, { enabled, profile }) {
return {
enabled,
profile,
};
},
};
module.exports = function (throttling = INITIAL_NETWORK_THROTTLING, action) {
let reducer = reducers[action.type];
if (!reducer) {
return throttling;
}
return reducer(throttling, action);
};

View file

@ -0,0 +1,31 @@
/* 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";
const {
TAKE_SCREENSHOT_END,
TAKE_SCREENSHOT_START,
} = require("../actions/index");
const INITIAL_SCREENSHOT = { isCapturing: false };
let reducers = {
[TAKE_SCREENSHOT_END](screenshot, action) {
return Object.assign({}, screenshot, { isCapturing: false });
},
[TAKE_SCREENSHOT_START](screenshot, action) {
return Object.assign({}, screenshot, { isCapturing: true });
},
};
module.exports = function (screenshot = INITIAL_SCREENSHOT, action) {
let reducer = reducers[action.type];
if (!reducer) {
return screenshot;
}
return reducer(screenshot, action);
};

View file

@ -0,0 +1,31 @@
/* 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";
const {
CHANGE_TOUCH_SIMULATION,
} = require("../actions/index");
const INITIAL_TOUCH_SIMULATION = {
enabled: false,
};
let reducers = {
[CHANGE_TOUCH_SIMULATION](touchSimulation, { enabled }) {
return Object.assign({}, touchSimulation, {
enabled,
});
},
};
module.exports = function (touchSimulation = INITIAL_TOUCH_SIMULATION, action) {
let reducer = reducers[action.type];
if (!reducer) {
return touchSimulation;
}
return reducer(touchSimulation, action);
};

View file

@ -0,0 +1,118 @@
/* 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";
const {
ADD_VIEWPORT,
CHANGE_DEVICE,
CHANGE_PIXEL_RATIO,
REMOVE_DEVICE,
RESIZE_VIEWPORT,
ROTATE_VIEWPORT,
} = require("../actions/index");
let nextViewportId = 0;
const INITIAL_VIEWPORTS = [];
const INITIAL_VIEWPORT = {
id: nextViewportId++,
device: "",
width: 320,
height: 480,
pixelRatio: {
value: 0,
},
};
let reducers = {
[ADD_VIEWPORT](viewports) {
// For the moment, there can be at most one viewport.
if (viewports.length === 1) {
return viewports;
}
return [...viewports, Object.assign({}, INITIAL_VIEWPORT)];
},
[CHANGE_DEVICE](viewports, { id, device }) {
return viewports.map(viewport => {
if (viewport.id !== id) {
return viewport;
}
return Object.assign({}, viewport, {
device,
});
});
},
[CHANGE_PIXEL_RATIO](viewports, { id, pixelRatio }) {
return viewports.map(viewport => {
if (viewport.id !== id) {
return viewport;
}
return Object.assign({}, viewport, {
pixelRatio: {
value: pixelRatio
},
});
});
},
[REMOVE_DEVICE](viewports, { id }) {
return viewports.map(viewport => {
if (viewport.id !== id) {
return viewport;
}
return Object.assign({}, viewport, {
device: "",
});
});
},
[RESIZE_VIEWPORT](viewports, { id, width, height }) {
return viewports.map(viewport => {
if (viewport.id !== id) {
return viewport;
}
if (!width) {
width = viewport.width;
}
if (!height) {
height = viewport.height;
}
return Object.assign({}, viewport, {
width,
height,
});
});
},
[ROTATE_VIEWPORT](viewports, { id }) {
return viewports.map(viewport => {
if (viewport.id !== id) {
return viewport;
}
return Object.assign({}, viewport, {
width: viewport.height,
height: viewport.width,
});
});
},
};
module.exports = function (viewports = INITIAL_VIEWPORTS, action) {
let reducer = reducers[action.type];
if (!reducer) {
return viewports;
}
return reducer(viewports, action);
};