mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Backed out changeset 3c2a368a4c8b (bug 1552464) for xpcshell failures on test_rotate_viewport.js on a CLOSED TREE
--HG-- extra : amend_source : 15c8845b921292468c076b10b0b68c523a835e98
This commit is contained in:
parent
ecf5714fea
commit
d71e3be10c
@ -40,7 +40,7 @@ const bootstrap = {
|
||||
// toolbox session id.
|
||||
this.telemetry.toolOpened("responsive", -1, this);
|
||||
|
||||
const store = this.store = Store({ telemetry: this.telemetry });
|
||||
const store = this.store = Store();
|
||||
const provider = createElement(Provider, { store }, App());
|
||||
ReactDOM.render(provider, document.querySelector("#root"));
|
||||
message.post(window, "init:done");
|
||||
|
@ -1,8 +0,0 @@
|
||||
# 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(
|
||||
'telemetry.js',
|
||||
)
|
@ -1,62 +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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { debounce } = require("devtools/shared/debounce");
|
||||
const {
|
||||
RESIZE_VIEWPORT,
|
||||
ROTATE_VIEWPORT,
|
||||
} = require("../actions/index");
|
||||
const TELEMETRY_SCALAR_VIEWPORT_CHANGE_COUNT =
|
||||
"devtools.responsive.viewport_change_count";
|
||||
|
||||
/**
|
||||
* Redux middleware to observe actions dispatched to the Redux store and log to Telemetry.
|
||||
*
|
||||
* `telemetryMiddleware()` is a wrapper function which receives the Telemetry
|
||||
* instance as its only argument and is used to create a closure to make that instance
|
||||
* available to the returned Redux middleware and functions nested within.
|
||||
*
|
||||
* To be used with `applyMiddleware()` helper when creating the Redux store.
|
||||
* @see https://redux.js.org/api/applymiddleware
|
||||
*
|
||||
* The wrapper returns the function that acts as the Redux middleware. This function
|
||||
* receives a single `store` argument (the Redux Middleware API, an object containing
|
||||
* `getState()` and `dispatch()`) and returns a function which receives a single `next`
|
||||
* argument (the next middleware in the chain) which itself returns a function that
|
||||
* receives a single `action` argument (the dispatched action).
|
||||
*
|
||||
* @param {Object} telemetry
|
||||
* Instance of the Telemetry API
|
||||
* @return {Function}
|
||||
*/
|
||||
function telemetryMiddleware(telemetry) {
|
||||
function logViewportChange() {
|
||||
telemetry.scalarAdd(TELEMETRY_SCALAR_VIEWPORT_CHANGE_COUNT, 1);
|
||||
}
|
||||
|
||||
// Debounced logging to use in response to high frequency actions like RESIZE_VIEWPORT.
|
||||
// Set debounce()'s `immediate` parameter to `true` to ensure the very first
|
||||
// call is executed immediately. This helps the tests to check that logging is working
|
||||
// without adding needless complexity to wait for the debounced call.
|
||||
const logViewportChangeDebounced = debounce(logViewportChange, 300, null, true);
|
||||
|
||||
// This cascade of functions is the Redux middleware signature.
|
||||
// @see https://redux.js.org/api/applymiddleware#arguments
|
||||
return store => next => action => {
|
||||
switch (action.type) {
|
||||
case ROTATE_VIEWPORT:
|
||||
logViewportChange();
|
||||
break;
|
||||
case RESIZE_VIEWPORT:
|
||||
logViewportChangeDebounced();
|
||||
break;
|
||||
}
|
||||
|
||||
return next(action);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = telemetryMiddleware;
|
@ -9,7 +9,6 @@ DIRS += [
|
||||
'browser',
|
||||
'components',
|
||||
'images',
|
||||
'middleware',
|
||||
'reducers',
|
||||
'utils',
|
||||
]
|
||||
|
@ -8,12 +8,10 @@ const { combineReducers } = require("devtools/client/shared/vendor/redux");
|
||||
const createStore = require("devtools/client/shared/redux/create-store");
|
||||
const reducers = require("./reducers");
|
||||
const flags = require("devtools/shared/flags");
|
||||
const telemetryMiddleware = require("./middleware/telemetry");
|
||||
|
||||
module.exports = function(options = {}) {
|
||||
module.exports = function() {
|
||||
let shouldLog = false;
|
||||
let history;
|
||||
const { telemetry } = options;
|
||||
|
||||
// If testing, store the action history in an array
|
||||
// we'll later attach to the store
|
||||
@ -25,7 +23,6 @@ module.exports = function(options = {}) {
|
||||
const store = createStore({
|
||||
log: shouldLog,
|
||||
history,
|
||||
middleware: [telemetryMiddleware(telemetry)],
|
||||
})(combineReducers(reducers), {});
|
||||
|
||||
if (history) {
|
||||
|
@ -64,7 +64,6 @@ skip-if = true # Bug 1413765
|
||||
[browser_tab_remoteness_change.js]
|
||||
[browser_target_blank.js]
|
||||
[browser_telemetry_activate_rdm.js]
|
||||
[browser_telemetry_viewport_change.js]
|
||||
[browser_toggle_zoom.js]
|
||||
[browser_toolbox_computed_view.js]
|
||||
[browser_toolbox_rule_view.js]
|
||||
|
@ -1,29 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Test that actions to change the RDM viewport size and rotation are logged to telemetry.
|
||||
*/
|
||||
|
||||
const TEST_URL = "data:text/html;charset=utf-8,browser_telemetry_viewport_change.js";
|
||||
const TELEMETRY_SCALAR_VIEWPORT_CHANGE_COUNT =
|
||||
"devtools.responsive.viewport_change_count";
|
||||
|
||||
addRDMTask(TEST_URL, async function({ ui, manager }) {
|
||||
info("Clear any existing Telemetry scalars");
|
||||
Services.telemetry.clearScalars();
|
||||
|
||||
info("Resize the viewport");
|
||||
await setViewportSize(ui, manager, 100, 300);
|
||||
|
||||
info("Rotate the viewport");
|
||||
rotateViewport(ui);
|
||||
|
||||
const scalars = Services.telemetry.getSnapshotForScalars("main", false);
|
||||
ok(scalars.parent, "Telemetry scalars present");
|
||||
|
||||
const count = scalars.parent[TELEMETRY_SCALAR_VIEWPORT_CHANGE_COUNT];
|
||||
is(count, 2, "Scalar has correct number of viewport changes logged");
|
||||
});
|
@ -14,12 +14,9 @@
|
||||
* The wait period
|
||||
* @param {Object} scope
|
||||
* The scope to use for func
|
||||
* @param {Boolean} immediate
|
||||
* Whether to execute the method immediately on the first call.
|
||||
* Optional. Default `false`.
|
||||
* @return {Function} The debounced function
|
||||
*/
|
||||
exports.debounce = function(func, wait, scope, immediate = false) {
|
||||
exports.debounce = function(func, wait, scope) {
|
||||
let timer = null;
|
||||
|
||||
return function() {
|
||||
@ -32,10 +29,5 @@ exports.debounce = function(func, wait, scope, immediate = false) {
|
||||
timer = null;
|
||||
func.apply(scope, args);
|
||||
}, wait);
|
||||
|
||||
if (immediate) {
|
||||
immediate = false;
|
||||
func.apply(scope, args);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1570,7 +1570,7 @@ devtools.responsive:
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- dev-developer-tools@lists.mozilla.org
|
||||
- mbalfanz@mozilla.com
|
||||
- jryans@mozilla.com
|
||||
record_in_processes:
|
||||
- main
|
||||
release_channel_collection: opt-out
|
||||
@ -1584,20 +1584,7 @@ devtools.responsive:
|
||||
keyed: true
|
||||
notification_emails:
|
||||
- dev-developer-tools@lists.mozilla.org
|
||||
- mbalfanz@mozilla.com
|
||||
record_in_processes:
|
||||
- main
|
||||
release_channel_collection: opt-out
|
||||
viewport_change_count:
|
||||
bug_numbers:
|
||||
- 1552464
|
||||
description: >
|
||||
Number of times the viewport attributes changed while in Responsive Design Mode.
|
||||
expires: never
|
||||
kind: uint
|
||||
notification_emails:
|
||||
- dev-developer-tools@lists.mozilla.org
|
||||
- mbalfanz@mozilla.com
|
||||
- jryans@mozilla.com
|
||||
record_in_processes:
|
||||
- main
|
||||
release_channel_collection: opt-out
|
||||
|
Loading…
x
Reference in New Issue
Block a user