mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 08:48:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
31
devtools/client/debugger/content/reducers/async-requests.js
Normal file
31
devtools/client/debugger/content/reducers/async-requests.js
Normal 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 constants = require("../constants");
|
||||
const initialState = [];
|
||||
|
||||
function update(state = initialState, action, emitChange) {
|
||||
const { seqId } = action;
|
||||
|
||||
if (action.type === constants.UNLOAD) {
|
||||
return initialState;
|
||||
}
|
||||
else if (seqId) {
|
||||
let newState;
|
||||
if (action.status === "start") {
|
||||
newState = [...state, seqId];
|
||||
}
|
||||
else if (action.status === "error" || action.status === "done") {
|
||||
newState = state.filter(id => id !== seqId);
|
||||
}
|
||||
|
||||
emitChange("open-requests", newState);
|
||||
return newState;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
module.exports = update;
|
||||
153
devtools/client/debugger/content/reducers/breakpoints.js
Normal file
153
devtools/client/debugger/content/reducers/breakpoints.js
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/* 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 constants = require("../constants");
|
||||
const Immutable = require("devtools/client/shared/vendor/seamless-immutable");
|
||||
const { mergeIn, setIn, deleteIn } = require("../utils");
|
||||
const { makeLocationId } = require("../queries");
|
||||
|
||||
const initialState = Immutable({
|
||||
breakpoints: {}
|
||||
});
|
||||
|
||||
// Return the first argument that is a string, or null if nothing is a
|
||||
// string.
|
||||
function firstString(...args) {
|
||||
for (var arg of args) {
|
||||
if (typeof arg === "string") {
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function update(state = initialState, action, emitChange) {
|
||||
switch (action.type) {
|
||||
case constants.ADD_BREAKPOINT: {
|
||||
const id = makeLocationId(action.breakpoint.location);
|
||||
|
||||
if (action.status === "start") {
|
||||
const existingBp = state.breakpoints[id];
|
||||
const bp = existingBp || Immutable(action.breakpoint);
|
||||
|
||||
state = setIn(state, ["breakpoints", id], bp.merge({
|
||||
disabled: false,
|
||||
loading: true,
|
||||
// We want to do an OR here, but we can't because we need
|
||||
// empty strings to be truthy, i.e. an empty string is a valid
|
||||
// condition.
|
||||
condition: firstString(action.condition, bp.condition)
|
||||
}));
|
||||
|
||||
emitChange(existingBp ? "breakpoint-enabled" : "breakpoint-added",
|
||||
state.breakpoints[id]);
|
||||
return state;
|
||||
}
|
||||
else if (action.status === "done") {
|
||||
const { actor, text } = action.value;
|
||||
let { actualLocation } = action.value;
|
||||
|
||||
// If the breakpoint moved, update the map
|
||||
if (actualLocation) {
|
||||
// XXX Bug 1227417: The `setBreakpoint` RDP request rdp
|
||||
// request returns an `actualLocation` field that doesn't
|
||||
// conform to the regular { actor, line } location shape, but
|
||||
// it has a `source` field. We should fix that.
|
||||
actualLocation = { actor: actualLocation.source.actor,
|
||||
line: actualLocation.line };
|
||||
|
||||
state = deleteIn(state, ["breakpoints", id]);
|
||||
|
||||
const movedId = makeLocationId(actualLocation);
|
||||
const currentBp = state.breakpoints[movedId] || Immutable(action.breakpoint);
|
||||
const prevLocation = action.breakpoint.location;
|
||||
const newBp = currentBp.merge({ location: actualLocation });
|
||||
state = setIn(state, ["breakpoints", movedId], newBp);
|
||||
|
||||
emitChange("breakpoint-moved", {
|
||||
breakpoint: newBp,
|
||||
prevLocation: prevLocation
|
||||
});
|
||||
}
|
||||
|
||||
const finalLocation = (
|
||||
actualLocation ? actualLocation : action.breakpoint.location
|
||||
);
|
||||
const finalLocationId = makeLocationId(finalLocation);
|
||||
state = mergeIn(state, ["breakpoints", finalLocationId], {
|
||||
disabled: false,
|
||||
loading: false,
|
||||
actor: actor,
|
||||
text: text
|
||||
});
|
||||
emitChange("breakpoint-updated", state.breakpoints[finalLocationId]);
|
||||
return state;
|
||||
}
|
||||
else if (action.status === "error") {
|
||||
// Remove the optimistic update
|
||||
emitChange("breakpoint-removed", state.breakpoints[id]);
|
||||
return deleteIn(state, ["breakpoints", id]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case constants.REMOVE_BREAKPOINT: {
|
||||
if (action.status === "done") {
|
||||
const id = makeLocationId(action.breakpoint.location);
|
||||
const bp = state.breakpoints[id];
|
||||
|
||||
if (action.disabled) {
|
||||
state = mergeIn(state, ["breakpoints", id],
|
||||
{ loading: false, disabled: true });
|
||||
emitChange("breakpoint-disabled", state.breakpoints[id]);
|
||||
return state;
|
||||
}
|
||||
|
||||
state = deleteIn(state, ["breakpoints", id]);
|
||||
emitChange("breakpoint-removed", bp);
|
||||
return state;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case constants.SET_BREAKPOINT_CONDITION: {
|
||||
const id = makeLocationId(action.breakpoint.location);
|
||||
const bp = state.breakpoints[id];
|
||||
emitChange("breakpoint-condition-updated", bp);
|
||||
|
||||
if (!action.status) {
|
||||
// No status means that it wasn't a remote request. Just update
|
||||
// the condition locally.
|
||||
return mergeIn(state, ["breakpoints", id], {
|
||||
condition: action.condition
|
||||
});
|
||||
}
|
||||
else if (action.status === "start") {
|
||||
return mergeIn(state, ["breakpoints", id], {
|
||||
loading: true,
|
||||
condition: action.condition
|
||||
});
|
||||
}
|
||||
else if (action.status === "done") {
|
||||
return mergeIn(state, ["breakpoints", id], {
|
||||
loading: false,
|
||||
condition: action.condition,
|
||||
// Setting a condition creates a new breakpoint client as of
|
||||
// now, so we need to update the actor
|
||||
actor: action.value.actor
|
||||
});
|
||||
}
|
||||
else if (action.status === "error") {
|
||||
emitChange("breakpoint-removed", bp);
|
||||
return deleteIn(state, ["breakpoints", id]);
|
||||
}
|
||||
|
||||
break;
|
||||
}}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
module.exports = update;
|
||||
37
devtools/client/debugger/content/reducers/event-listeners.js
Normal file
37
devtools/client/debugger/content/reducers/event-listeners.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* 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 constants = require("../constants");
|
||||
|
||||
const FETCH_EVENT_LISTENERS_DELAY = 200; // ms
|
||||
|
||||
const initialState = {
|
||||
activeEventNames: [],
|
||||
listeners: [],
|
||||
fetchingListeners: false,
|
||||
};
|
||||
|
||||
function update(state = initialState, action, emit) {
|
||||
switch (action.type) {
|
||||
case constants.UPDATE_EVENT_BREAKPOINTS:
|
||||
state.activeEventNames = action.eventNames;
|
||||
emit("activeEventNames", state.activeEventNames);
|
||||
break;
|
||||
case constants.FETCH_EVENT_LISTENERS:
|
||||
if (action.status === "begin") {
|
||||
state.fetchingListeners = true;
|
||||
}
|
||||
else if (action.status === "done") {
|
||||
state.fetchingListeners = false;
|
||||
state.listeners = action.listeners;
|
||||
emit("event-listeners", state.listeners);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
module.exports = update;
|
||||
16
devtools/client/debugger/content/reducers/index.js
Normal file
16
devtools/client/debugger/content/reducers/index.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* 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 eventListeners = require("./event-listeners");
|
||||
const sources = require("./sources");
|
||||
const breakpoints = require("./breakpoints");
|
||||
const asyncRequests = require("./async-requests");
|
||||
|
||||
module.exports = {
|
||||
eventListeners,
|
||||
sources,
|
||||
breakpoints,
|
||||
asyncRequests
|
||||
};
|
||||
12
devtools/client/debugger/content/reducers/moz.build
Normal file
12
devtools/client/debugger/content/reducers/moz.build
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# 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(
|
||||
'async-requests.js',
|
||||
'breakpoints.js',
|
||||
'event-listeners.js',
|
||||
'index.js',
|
||||
'sources.js'
|
||||
)
|
||||
128
devtools/client/debugger/content/reducers/sources.js
Normal file
128
devtools/client/debugger/content/reducers/sources.js
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/* 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 constants = require("../constants");
|
||||
const Immutable = require("devtools/client/shared/vendor/seamless-immutable");
|
||||
const { mergeIn, setIn } = require("../utils");
|
||||
|
||||
const initialState = Immutable({
|
||||
sources: {},
|
||||
selectedSource: null,
|
||||
selectedSourceOpts: null,
|
||||
sourcesText: {}
|
||||
});
|
||||
|
||||
function update(state = initialState, action, emitChange) {
|
||||
switch (action.type) {
|
||||
case constants.ADD_SOURCE:
|
||||
emitChange("source", action.source);
|
||||
return mergeIn(state, ["sources", action.source.actor], action.source);
|
||||
|
||||
case constants.LOAD_SOURCES:
|
||||
if (action.status === "done") {
|
||||
const sources = action.value;
|
||||
if (!sources) {
|
||||
return state;
|
||||
}
|
||||
const sourcesByActor = {};
|
||||
sources.forEach(source => {
|
||||
if (!state.sources[source.actor]) {
|
||||
emitChange("source", source);
|
||||
}
|
||||
sourcesByActor[source.actor] = source;
|
||||
});
|
||||
return mergeIn(state, ["sources"], state.sources.merge(sourcesByActor));
|
||||
}
|
||||
break;
|
||||
|
||||
case constants.SELECT_SOURCE:
|
||||
emitChange("source-selected", action.source);
|
||||
return state.merge({
|
||||
selectedSource: action.source.actor,
|
||||
selectedSourceOpts: action.opts
|
||||
});
|
||||
|
||||
case constants.LOAD_SOURCE_TEXT: {
|
||||
const s = _updateText(state, action);
|
||||
emitChange("source-text-loaded", s.sources[action.source.actor]);
|
||||
return s;
|
||||
}
|
||||
|
||||
case constants.BLACKBOX:
|
||||
if (action.status === "done") {
|
||||
const s = mergeIn(state,
|
||||
["sources", action.source.actor, "isBlackBoxed"],
|
||||
action.value.isBlackBoxed);
|
||||
emitChange("blackboxed", s.sources[action.source.actor]);
|
||||
return s;
|
||||
}
|
||||
break;
|
||||
|
||||
case constants.TOGGLE_PRETTY_PRINT:
|
||||
let s = state;
|
||||
if (action.status === "error") {
|
||||
s = mergeIn(state, ["sourcesText", action.source.actor], {
|
||||
loading: false
|
||||
});
|
||||
|
||||
// If it errored, just display the source as it was before, but
|
||||
// only if there is existing text already. If auto-prettifying
|
||||
// is on, the original text may still be coming in and we don't
|
||||
// have it yet. If we try to set empty text we confuse the
|
||||
// editor because it thinks it's already displaying the source's
|
||||
// text and won't load the text when it actually comes in.
|
||||
if (s.sourcesText[action.source.actor].text != null) {
|
||||
emitChange("prettyprinted", s.sources[action.source.actor]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
s = _updateText(state, action);
|
||||
// Don't do this yet, the progress bar is still imperatively shown
|
||||
// from the source view. We will fix in the next iteration.
|
||||
// emitChange('source-text-loaded', s.sources[action.source.actor]);
|
||||
|
||||
if (action.status === "done") {
|
||||
s = mergeIn(s,
|
||||
["sources", action.source.actor, "isPrettyPrinted"],
|
||||
action.value.isPrettyPrinted);
|
||||
emitChange("prettyprinted", s.sources[action.source.actor]);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
|
||||
case constants.UNLOAD:
|
||||
// Reset the entire state to just the initial state, a blank state
|
||||
// if you will.
|
||||
return initialState;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
function _updateText(state, action) {
|
||||
const { source } = action;
|
||||
|
||||
if (action.status === "start") {
|
||||
// Merge this in, don't set it. That way the previous value is
|
||||
// still stored here, and we can retrieve it if whatever we're
|
||||
// doing fails.
|
||||
return mergeIn(state, ["sourcesText", source.actor], {
|
||||
loading: true
|
||||
});
|
||||
}
|
||||
else if (action.status === "error") {
|
||||
return setIn(state, ["sourcesText", source.actor], {
|
||||
error: action.error
|
||||
});
|
||||
}
|
||||
else {
|
||||
return setIn(state, ["sourcesText", source.actor], {
|
||||
text: action.value.text,
|
||||
contentType: action.value.contentType
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = update;
|
||||
Loading…
Add table
Add a link
Reference in a new issue