Backed out changesets e059e455e5b3, 307682f73f2d, and 2429f203ecc7 (bug 1132203) for test_bug667533.html timeouts.

--HG--
extra : histedit_source : e478589b55633b1dc6125f3f6b8178ea659d20b3%2C5cb99bef2d07d2a2f1886e0439f2f366247a431f
This commit is contained in:
Ryan VanderMeulen 2015-08-24 18:42:29 -04:00
Родитель 30c8d187b7
Коммит ba06d15458
66 изменённых файлов: 0 добавлений и 6469 удалений

Просмотреть файл

@ -1636,13 +1636,6 @@ pref("devtools.fontinspector.enabled", true);
// version for each user.
pref("devtools.telemetry.tools.opened.version", "{}");
// Enable the JSON View tool (an inspector for application/json documents)
#ifdef MOZ_DEV_EDITION
pref("devtools.jsonview.enabled", true);
#else
pref("devtools.jsonview.enabled", false);
#endif
// Whether the character encoding menu is under the main Firefox button. This
// preference is a string so that localizers can alter it.
pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");

Просмотреть файл

@ -27,7 +27,6 @@ loader.lazyRequireGetter(this, "DebuggerClient", "devtools/toolkit/client/main",
const DefaultTools = require("definitions").defaultTools;
const EventEmitter = require("devtools/toolkit/event-emitter");
const Telemetry = require("devtools/shared/telemetry");
const {JsonView} = require("devtools/jsonview/main");
const TABS_OPEN_PEAK_HISTOGRAM = "DEVTOOLS_TABS_OPEN_PEAK_LINEAR";
const TABS_OPEN_AVG_HISTOGRAM = "DEVTOOLS_TABS_OPEN_AVERAGE_LINEAR";
@ -53,9 +52,6 @@ this.DevTools = function DevTools() {
this.destroy = this.destroy.bind(this);
this._teardown = this._teardown.bind(this);
// JSON Viewer for 'application/json' documents.
JsonView.initialize();
EventEmitter.decorate(this);
Services.obs.addObserver(this._teardown, "devtools-unloaded", false);
@ -492,8 +488,6 @@ DevTools.prototype = {
this.unregisterTool(key, true);
}
JsonView.destroy();
this._pingTelemetry();
this._telemetry = null;

Просмотреть файл

@ -1,69 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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/. */
define(function(require, exports, module) {
const React = require("react");
const { createFactories } = require("./reps/rep-utils");
const { Headers } = createFactories(require("./headers"));
const { Toolbar, ToolbarButton } = createFactories(require("./reps/toolbar"));
const DOM = React.DOM;
/**
* This template represents the 'Headers' panel
* s responsible for rendering its content.
*/
var HeadersPanel = React.createClass({
displayName: "HeadersPanel",
getInitialState: function() {
return {
data: {}
};
},
render: function() {
var data = this.props.data;
return (
DOM.div({className: "headersPanelBox"},
HeadersToolbar({actions: this.props.actions}),
DOM.div({className: "panelContent"},
Headers({data: data})
)
)
);
}
});
/**
* This template is responsible for rendering a toolbar
* within the 'Headers' panel.
*/
var HeadersToolbar = React.createFactory(React.createClass({
displayName: "HeadersToolbar",
render: function() {
return (
Toolbar({},
ToolbarButton({className: "copy", onClick: this.onCopy},
Locale.$STR("jsonViewer.Copy")
)
)
)
},
// Commands
onCopy: function(event) {
this.props.actions.onCopyHeaders();
},
}));
// Exports from this module
exports.HeadersPanel = HeadersPanel;
});

Просмотреть файл

@ -1,100 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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/. */
define(function(require, exports, module) {
const React = require("react");
// Constants
const DOM = React.DOM;
/**
* This template is responsible for rendering basic layout
* of the 'Headers' panel. It displays HTTP headers groups such as
* received or response headers.
*/
var Headers = React.createClass({
displayName: "Headers",
getInitialState: function() {
return {};
},
render: function() {
var data = this.props.data;
return (
DOM.div({className: "netInfoHeadersTable"},
DOM.div({className: "netHeadersGroup"},
DOM.div({className: "netInfoHeadersGroup"},
DOM.span({className: "netHeader twisty"},
Locale.$STR("jsonViewer.responseHeaders")
)
),
DOM.table({cellPadding: 0, cellSpacing: 0},
HeaderList({headers: data.response})
)
),
DOM.div({className: "netHeadersGroup"},
DOM.div({className: "netInfoHeadersGroup"},
DOM.span({className: "netHeader twisty"},
Locale.$STR("jsonViewer.requestHeaders")
)
),
DOM.table({cellPadding: 0, cellSpacing: 0},
HeaderList({headers: data.request})
)
)
)
);
}
});
/**
* This template renders headers list,
* name + value pairs.
*/
var HeaderList = React.createFactory(React.createClass({
displayName: "HeaderList",
getInitialState: function() {
return {
headers: []
};
},
render: function() {
var headers = this.props.headers;
headers.sort(function(a, b) {
return a.name > b.name ? 1 : -1;
});
var rows = [];
headers.forEach(header => {
rows.push(
DOM.tr({key: header.name},
DOM.td({className: "netInfoParamName"},
DOM.span({title: header.name}, header.name)
),
DOM.td({className: "netInfoParamValue"},
DOM.code({}, header.value)
)
)
)
});
return (
DOM.tbody({},
rows
)
)
}
}));
// Exports from this module
exports.Headers = Headers;
});

Просмотреть файл

@ -1,108 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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/. */
define(function(require, exports, module) {
const React = require("react");
const { createFactories } = require("./reps/rep-utils");
const { TreeView } = createFactories(require("./reps/tree-view"));
const { SearchBox } = createFactories(require("./search-box"));
const { Toolbar, ToolbarButton } = createFactories(require("./reps/toolbar"));
const DOM = React.DOM;
/**
* This template represents the 'JSON' panel. The panel is
* responsible for rendering an expandable tree that allows simple
* inspection of JSON structure.
*/
var JsonPanel = React.createClass({
displayName: "JsonPanel",
getInitialState: function() {
return {};
},
componentDidMount: function() {
document.addEventListener("keypress", this.onKeyPress, true);
},
componentWillUnmount: function() {
document.removeEventListener("keypress", this.onKeyPress, true);
},
onKeyPress: function(e) {
// XXX shortcut for focusing the Filter field (see Bug 1178771).
},
render: function() {
var content;
var data = this.props.data;
try {
if (typeof data == "object") {
content = TreeView({
data: this.props.data,
mode: "tiny",
searchFilter: this.props.searchFilter
});
} else {
content = DOM.div({className: "jsonParseError"},
data + ""
);
}
} catch (err) {
content = DOM.div({className: "jsonParseError"},
err + ""
);
}
return (
DOM.div({className: "jsonPanelBox"},
JsonToolbar({actions: this.props.actions}),
DOM.div({className: "panelContent"},
content
)
)
);
}
});
/**
* This template represents a toolbar within the 'JSON' panel.
*/
var JsonToolbar = React.createFactory(React.createClass({
displayName: "JsonToolbar",
render: function() {
return (
Toolbar({},
ToolbarButton({className: "save", onClick: this.onSave},
Locale.$STR("jsonViewer.Save")
),
ToolbarButton({className: "copy", onClick: this.onCopy},
Locale.$STR("jsonViewer.Copy")
),
SearchBox({
actions: this.props.actions
})
)
)
},
// Commands
onSave: function(event) {
this.props.actions.onSaveJson();
},
onCopy: function(event) {
this.props.actions.onCopyJson();
},
}));
// Exports from this module
exports.JsonPanel = JsonPanel;
});

Просмотреть файл

@ -1,68 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
const React = require("react");
const { createFactories } = require("./reps/rep-utils");
const { JsonPanel } = createFactories(require("./json-panel"));
const { TextPanel } = createFactories(require("./text-panel"));
const { HeadersPanel } = createFactories(require("./headers-panel"));
const { Tabs, TabPanel } = createFactories(require("./reps/tabs"));
/**
* This object represents the root application template
* responsible for rendering the basic tab layout.
*/
var MainTabbedArea = React.createClass({
displayName: "MainTabbedArea",
getInitialState: function() {
return {
json: {},
headers: {},
jsonText: this.props.jsonText,
tabActive: this.props.tabActive
};
},
onTabChanged: function(index) {
this.setState({tabActive: index});
},
render: function() {
return (
Tabs({tabActive: this.state.tabActive, onAfterChange: this.onTabChanged},
TabPanel({className: "json", title: Locale.$STR("jsonViewer.tab.JSON")},
JsonPanel({
data: this.props.json,
actions: this.props.actions,
searchFilter: this.state.searchFilter
})
),
TabPanel({className: "rawdata", title: Locale.$STR("jsonViewer.tab.RawData")},
TextPanel({
data: this.state.jsonText,
actions: this.props.actions
})
),
TabPanel({className: "headers", title: Locale.$STR("jsonViewer.tab.Headers")},
HeadersPanel({
data: this.props.headers,
actions: this.props.actions,
searchFilter: this.props.searchFilter
})
)
)
)
}
});
// Exports from this module
exports.MainTabbedArea = MainTabbedArea;
});

Просмотреть файл

@ -1,18 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; 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/.
DIRS += [
'reps'
]
EXTRA_JS_MODULES.devtools.jsonview.components += [
'headers-panel.js',
'headers.js',
'json-panel.js',
'main-tabbed-area.js',
'search-box.js',
'text-panel.js'
]

Просмотреть файл

@ -1,189 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const { createFactories } = require("./rep-utils");
const { Rep } = createFactories(require("./rep"));
const { ObjectBox } = createFactories(require("./object-box"));
const { Caption } = createFactories(require("./caption"));
// Shortcuts
const DOM = React.DOM;
/**
* Renders an array. The array is enclosed by left and right bracket
* and the max number of rendered items depends on the current mode.
*/
var ArrayRep = React.createClass({
displayName: "ArrayRep",
render: function() {
var mode = this.props.mode || "short";
var object = this.props.object;
var hasTwisty = this.hasSpecialProperties(object);
var items;
if (mode == "tiny") {
items = object.length;
} else {
var max = (mode == "short") ? 3 : 300;
items = this.arrayIterator(object, max);
}
return (
ObjectBox({className: "array", onClick: this.onToggleProperties},
DOM.a({className: "objectLink", onclick: this.onClickBracket},
DOM.span({className: "arrayLeftBracket", role: "presentation"}, "[")
),
items,
DOM.a({className: "objectLink", onclick: this.onClickBracket},
DOM.span({className: "arrayRightBracket", role: "presentation"}, "]")
),
DOM.span({className: "arrayProperties", role: "group"})
)
)
},
getTitle: function(object, context) {
return "[" + object.length + "]";
},
arrayIterator: function(array, max) {
var items = [];
for (var i=0; i<array.length && i<=max; i++) {
try {
var delim = (i == array.length-1 ? "" : ", ");
var value = array[i];
if (value === array) {
items.push(Reference({
key: i,
object: value,
delim: delim
}));
} else {
items.push(ItemRep({
key: i,
object: value,
delim: delim
}));
}
} catch (exc) {
items.push(ItemRep({object: exc, delim: delim, key: i}));
}
}
if (array.length > max + 1) {
items.pop();
items.push(Caption({
key: "more",
object: Locale.$STR("jsonViewer.reps.more"),
}));
}
return items;
},
/**
* Returns true if the passed object is an array with additional (custom)
* properties, otherwise returns false. Custom properties should be
* displayed in extra expandable section.
*
* Example array with a custom property.
* let arr = [0, 1];
* arr.myProp = "Hello";
*
* @param {Array} array The array object.
*/
hasSpecialProperties: function(array) {
function isInteger(x) {
var y = parseInt(x, 10);
if (isNaN(y)) {
return false;
}
return x === y.toString();
}
var n = 0;
var props = Object.getOwnPropertyNames(array);
for (var i=0; i<props.length; i++) {
var p = props[i];
// Valid indexes are skipped
if (isInteger(p)) {
continue;
}
// Ignore standard 'length' property, anything else is custom.
if (p != "length") {
return true;
}
}
return false;
},
// Event Handlers
onToggleProperties: function(event) {
},
onClickBracket: function(event) {
}
});
/**
* Renders array item. Individual values are separated by a comma.
*/
var ItemRep = React.createFactory(React.createClass({
displayName: "ItemRep",
render: function(){
var object = this.props.object;
var delim = this.props.delim;
return (
DOM.span({},
Rep({object: object}),
delim
)
)
}
}));
/**
* Renders cycle references in an array.
*/
var Reference = React.createFactory(React.createClass({
displayName: "Reference",
render: function(){
var tooltip = Locale.$STR("jsonView.reps.reference");
return (
span({title: tooltip},
"[...]")
)
}
}));
function supportsObject(object, type) {
return Array.isArray(object) ||
Object.prototype.toString.call(object) === "[object Arguments]";
}
// Exports from this module
exports.ArrayRep = {
rep: ArrayRep,
supportsObject: supportsObject
};
});

Просмотреть файл

@ -1,31 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const DOM = React.DOM;
/**
* Renders a caption. This template is used by other components
* that needs to distinguish between a simple text/value and a label.
*/
const Caption = React.createClass({
displayName: "Caption",
render: function() {
return (
DOM.span({"className": "caption"}, this.props.object)
);
},
});
// Exports from this module
exports.Caption = Caption;
});

Просмотреть файл

@ -1,22 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; 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/.
EXTRA_JS_MODULES.devtools.jsonview.components.reps += [
'array.js',
'caption.js',
'null.js',
'number.js',
'object-box.js',
'object-link.js',
'object.js',
'rep-utils.js',
'rep.js',
'string.js',
'tabs.js',
'toolbar.js',
'tree-view.js',
'undefined.js',
]

Просмотреть файл

@ -1,46 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const { createFactories } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
/**
* Renders null value
*/
const Null = React.createClass({
displayName: "NullRep",
render: function() {
return (
ObjectBox({className: "null"},
"null"
)
)
},
});
function supportsObject(object, type) {
if (object && object.type && object.type == "null") {
return true;
}
return (object == null);
}
// Exports from this module
exports.Null = {
rep: Null,
supportsObject: supportsObject
};
});

Просмотреть файл

@ -1,47 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const { createFactories } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
/**
* Renders a number
*/
const Number = React.createClass({
displayName: "Number",
render: function() {
var value = this.props.object;
return (
ObjectBox({className: "number"},
this.stringify(value)
)
)
},
stringify: function(object) {
return (Object.is(object, -0) ? "-0" : String(object));
},
});
function supportsObject(object, type) {
return type == "boolean" || type == "number";
}
// Exports from this module
exports.Number = {
rep: Number,
supportsObject: supportsObject
};
});

Просмотреть файл

@ -1,35 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const DOM = React.DOM;
/**
* Renders a box for given object.
*/
const ObjectBox = React.createClass({
displayName: "ObjectBox",
render: function() {
var className = this.props.className;
var boxClassName = className ? " objectBox-" + className : "";
return (
DOM.span({className: "objectBox" + boxClassName, role: "presentation"},
this.props.children
)
)
}
});
// Exports from this module
exports.ObjectBox = ObjectBox;
});

Просмотреть файл

@ -1,36 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const DOM = React.DOM;
/**
* Renders a link for given object.
*/
const ObjectLink = React.createClass({
displayName: "ObjectLink",
render: function() {
var className = this.props.className;
var objectClassName = className ? " objectLink-" + className : "";
var linkClassName = "objectLink" + objectClassName + " a11yFocus";
return (
DOM.a({className: linkClassName, _repObject: this.props.object},
this.props.children
)
)
}
});
// Exports from this module
exports.ObjectLink = ObjectLink;
});

Просмотреть файл

@ -1,178 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const { createFactories } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
const { Caption } = createFactories(require("./caption"));
// Shortcuts
const DOM = React.DOM;
/**
* Renders an object. An object is represented by a list of its
* properties enclosed in curly brackets.
*/
const Obj = React.createClass({
displayName: "Obj",
render: function() {
var object = this.props.object;
var props = this.shortPropIterator(object);
return (
ObjectBox({className: "object"},
DOM.span({className: "objectTitle"}, this.getTitle(object)),
DOM.span({className: "objectLeftBrace", role: "presentation"}, "{"),
props,
DOM.span({className: "objectRightBrace"}, "}")
)
)
},
getTitle: function() {
return ""; // Could also be "Object";
},
longPropIterator: function (object) {
try {
return this.propIterator(object, 100);
}
catch (err) {
console.error(err);
}
},
shortPropIterator: function (object) {
try {
return this.propIterator(object, /*could be a pref*/ 3);
}
catch (err) {
console.error(err);
}
},
propIterator: function(object, max) {
function isInterestingProp(t, value) {
return (t == "boolean" || t == "number" || (t == "string" && value) ||
(t == "object" && value && value.toString));
}
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=945377
if (Object.prototype.toString.call(object) === "[object Generator]") {
object = Object.getPrototypeOf(object);
}
// Object members with non-empty values are preferred since it gives the
// user a better overview of the object.
var props = [];
this.getProps(props, object, max, isInterestingProp);
if (props.length <= max) {
// There are not enough props yet (or at least, not enough props to
// be able to know whether we should print "more..." or not).
// Let's display also empty members and functions.
this.getProps(props, object, max, function(t, value) {
return !isInterestingProp(t, value);
});
}
if (props.length > max) {
props.pop();
props.push(Caption({
key: "more",
object: Locale.$STR("jsonViewer.reps.more"),
}));
}
else if (props.length > 0) {
// Remove the last comma.
props[props.length-1] = React.cloneElement(
props[props.length-1], { delim: "" });
}
return props;
},
getProps: function (props, object, max, filter) {
max = max || 3;
if (!object) {
return [];
}
var len = 0;
var mode = this.props.mode;
try {
for (var name in object) {
if (props.length > max) {
return;
}
var value;
try {
value = object[name];
}
catch (exc) {
continue;
}
var t = typeof(value);
if (filter(t, value)) {
props.push(PropRep({
key: name,
mode: "short",
name: name,
object: value,
equal: ": ",
delim: ", ",
mode: mode,
}));
}
}
}
catch (exc) {
}
},
});
/**
* Renders object property, name-value pair.
*/
var PropRep = React.createFactory(React.createClass({
displayName: "PropRep",
render: function(){
var { Rep } = createFactories(require("./rep"));
var object = this.props.object;
var mode = this.props.mode;
return (
DOM.span({},
DOM.span({"className": "nodeName"}, this.props.name),
DOM.span({"className": "objectEqual", role: "presentation"}, this.props.equal),
Rep({object: object, mode: mode}),
DOM.span({"className": "objectComma", role: "presentation"}, this.props.delim)
)
);
}
}));
function supportsObject(object, type) {
return true;
}
// Exports from this module
exports.Obj = {
rep: Obj,
supportsObject: supportsObject
};
});

Просмотреть файл

@ -1,29 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
/**
* Create React factories for given arguments.
* Example:
* const { Rep } = createFactories(require("./rep"));
*/
function createFactories(args) {
var result = {};
for (var p in args) {
result[p] = React.createFactory(args[p]);
}
return result;
}
// Exports from this module
exports.createFactories = createFactories;
});

Просмотреть файл

@ -1,87 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
// Load all existing rep templates
const { Undefined } = require("./undefined");
const { Null } = require("./null");
const { StringRep } = require("./string");
const { Number } = require("./number");
const { ArrayRep } = require("./array");
const { Obj } = require("./object");
// List of all registered template.
// XXX there should be a way for extensions to register a new
// or modify an existing rep.
var reps = [Undefined, Null, StringRep, Number, ArrayRep, Obj];
var defaultRep;
/**
* Generic rep that is using for rendering native JS types or an object.
* The right template used for rendering is picked automatically according
* to the current value type. The value must be passed is as 'object'
* property.
*/
const Rep = React.createClass({
displayName: "Rep",
render: function() {
var rep = getRep(this.props.object);
return rep(this.props);
},
});
// Helpers
/**
* Return a rep object that is responsible for rendering given
* object.
*
* @param object {Object} Object to be rendered in the UI. This
* can be generic JS object as well as a grip (handle to a remote
* debuggee object).
*/
function getRep(object) {
var type = typeof(object);
if (type == "object" && object instanceof String) {
type = "string";
}
if (isGrip(object)) {
type = object.class;
}
for (var i=0; i<reps.length; i++) {
var rep = reps[i];
try {
// supportsObject could return weight (not only true/false
// but a number), which would allow to priorities templates and
// support better extensibility.
if (rep.supportsObject(object, type)) {
return React.createFactory(rep.rep);
}
}
catch (err) {
console.error("reps.getRep; EXCEPTION ", err, err);
}
}
return React.createFactory(defaultRep.rep);
}
function isGrip(object) {
return object && object.actor;
}
// Exports from this module
exports.Rep = Rep;
});

Просмотреть файл

@ -1,102 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const { createFactories } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
/**
* Renders a string. String value is enclosed within quotes.
*/
const StringRep = React.createClass({
displayName: "StringRep",
render: function() {
var text = this.props.object;
var member = this.props.member;
if (member && member.open) {
return (
ObjectBox({className: "string"},
"\"" + text + "\""
)
)
} else {
return (
ObjectBox({className: "string"},
"\"" + cropMultipleLines(text) + "\""
)
)
}
},
});
// Helpers
function escapeNewLines(value) {
return value.replace(/\r/gm, "\\r").replace(/\n/gm, "\\n");
};
function cropMultipleLines(text, limit) {
return escapeNewLines(cropString(text, limit));
};
function cropString(text, limit, alternativeText) {
if (!alternativeText) {
alternativeText = "...";
}
// Make sure it's a string.
text = text + "";
// Use default limit if necessary.
if (!limit) {
limit = 50;
}
// Crop the string only if a limit is actually specified.
if (limit <= 0) {
return text;
}
// Set the limit at least to the length of the alternative text
// plus one character of the original text.
if (limit <= alternativeText.length) {
limit = alternativeText.length + 1;
}
var halfLimit = (limit - alternativeText.length) / 2;
if (text.length > limit) {
return text.substr(0, Math.ceil(halfLimit)) + alternativeText +
text.substr(text.length - Math.floor(halfLimit));
}
return text;
};
function isCropped(value) {
var cropLength = 50;
return typeof(value) == "string" && value.length > cropLength;
}
function supportsObject(object, type) {
return (type == "string");
}
// Exports from this module
exports.StringRep = {
rep: StringRep,
supportsObject: supportsObject,
isCropped: isCropped
};
});

Просмотреть файл

@ -1,192 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
const React = require("react");
const DOM = React.DOM;
/**
* Renders simple 'tab' widget.
*
* Based on ReactSimpleTabs component
* https://github.com/pedronauck/react-simpletabs
*
* Component markup (+CSS) example:
*
* <div class='tabs'>
* <nav class='tabs-navigation'>
* <ul class='tabs-menu'>
* <li class='tabs-menu-item is-active'>Tab #1</li>
* <li class='tabs-menu-item'>Tab #2</li>
* </ul>
* </nav>
* <article class='tab-panel'>
* The content of active panel here
* </article>
* <div>
*/
var Tabs = React.createClass({
displayName: "Tabs",
propTypes: {
className: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.string,
React.PropTypes.object
]),
tabActive: React.PropTypes.number,
onMount: React.PropTypes.func,
onBeforeChange: React.PropTypes.func,
onAfterChange: React.PropTypes.func,
children: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.element
]).isRequired
},
getDefaultProps: function () {
return {
tabActive: 1
};
},
getInitialState: function () {
return {
tabActive: this.props.tabActive
};
},
componentDidMount: function() {
var index = this.state.tabActive;
if (this.props.onMount) {
this.props.onMount(index);
}
},
componentWillReceiveProps: function(newProps){
if (newProps.tabActive) {
this.setState({tabActive: newProps.tabActive})
}
},
render: function () {
var classNames = ["tabs", this.props.className].join(" ");
return (
DOM.div({className: classNames},
this.getMenuItems(),
this.getSelectedPanel()
)
);
},
setActive: function(index, e) {
var onAfterChange = this.props.onAfterChange;
var onBeforeChange = this.props.onBeforeChange;
if (onBeforeChange) {
var cancel = onBeforeChange(index);
if (cancel) {
return;
}
}
var newState = {
tabActive: index
};
this.setState(newState, () => {
if (onAfterChange) {
onAfterChange(index);
}
});
e.preventDefault();
},
getMenuItems: function () {
if (!this.props.children) {
throw new Error("Tabs must contain at least one Panel");
}
if (!Array.isArray(this.props.children)) {
this.props.children = [this.props.children];
}
var menuItems = this.props.children
.map(function(panel) {
return typeof panel === "function" ? panel() : panel;
}).filter(function(panel) {
return panel;
}).map(function(panel, index) {
var ref = ("tab-menu-" + (index + 1));
var title = panel.props.title;
var tabClassName = panel.props.className;
var classes = [
"tabs-menu-item",
tabClassName,
this.state.tabActive === (index + 1) && "is-active"
].join(" ");
return (
DOM.li({ref: ref, key: index, className: classes},
DOM.a({href: "#", onClick: this.setActive.bind(this, index + 1)},
title
)
)
);
}.bind(this));
return (
DOM.nav({className: "tabs-navigation"},
DOM.ul({className: "tabs-menu"},
menuItems
)
)
);
},
getSelectedPanel: function () {
var index = this.state.tabActive - 1;
var panel = this.props.children[index];
return (
DOM.article({ref: "tab-panel", className: "tab-panel"},
panel
)
);
}
});
/**
* Renders simple tab 'panel'.
*/
var Panel = React.createClass({
displayName: "Panel",
propTypes: {
title: React.PropTypes.string.isRequired,
children: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.element
]).isRequired
},
render: function () {
return DOM.div({},
this.props.children
);
}
});
// Exports from this module
exports.TabPanel = Panel;
exports.Tabs = Tabs;
});

Просмотреть файл

@ -1,51 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
const React = require("react");
const DOM = React.DOM;
/**
* Renders a simple toolbar.
*/
var Toolbar = React.createClass({
displayName: "Toolbar",
render: function() {
return (
DOM.div({className: "toolbar"},
this.props.children
)
);
}
});
/**
* Renders a simple toolbar button.
*/
var ToolbarButton = React.createClass({
displayName: "ToolbarButton",
propTypes: {
active: React.PropTypes.bool,
disabled: React.PropTypes.bool,
},
render: function() {
var props = Object.assign({className: "btn"}, this.props);
return (
DOM.button(props, this.props.children)
);
},
});
// Exports from this module
exports.Toolbar = Toolbar;
exports.ToolbarButton = ToolbarButton;
});

Просмотреть файл

@ -1,261 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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/. */
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const { createFactories } = require("./rep-utils");
const { Rep } = createFactories(require("./rep"));
const { StringRep } = require("./string");
const DOM = React.DOM;
var uid = 0;
/**
* Renders a tree view with expandable/collapsible items.
*/
var TreeView = React.createClass({
displayName: "TreeView",
getInitialState: function() {
return {
data: {},
searchFilter: null
};
},
// Rendering
render: function() {
var mode = this.props.mode;
var root = this.state.data;
var children = [];
if (Array.isArray(root)) {
for (var i=0; i<root.length; i++) {
var child = root[i];
children.push(TreeNode({
key: child.key,
data: child,
mode: mode,
searchFilter: this.state.searchFilter || this.props.searchFilter
}));
}
} else {
children.push(React.addons.createFragment(root));
}
return (
DOM.div({className: "domTable", cellPadding: 0, cellSpacing: 0,
onClick: this.onClick},
children
)
);
},
// Data
componentDidMount: function() {
var members = initMembers(this.props.data, 0);
this.setState({data: members, searchFilter: this.props.searchFilter});
},
componentWillReceiveProps: function(nextProps) {
var updatedState = {
searchFilter: nextProps.searchFilter
};
if (this.props.data !== nextProps.data) {
updatedState.data = initMembers(nextProps.data, 0);
}
this.setState(updatedState);
}
});
/**
* Represents a node within the tree.
*/
var TreeNode = React.createFactory(React.createClass({
displayName: "TreeNode",
getInitialState: function() {
return { data: {}, searchFilter: null };
},
componentDidMount: function() {
this.setState({data: this.props.data});
},
render: function() {
var member = this.state.data;
var mode = this.props.mode;
var classNames = ["memberRow"];
classNames.push(member.type + "Row");
if (member.hasChildren) {
classNames.push("hasChildren");
}
if (member.open) {
classNames.push("opened");
}
if (!member.children) {
// Cropped strings are expandable, but they don't have children.
var isString = typeof(member.value) == "string";
if (member.hasChildren && !isString) {
member.children = initMembers(member.value);
} else {
member.children = [];
}
}
var children = [];
if (member.open && member.children.length) {
for (var i in member.children) {
var child = member.children[i];
children.push(TreeNode({
key: child.key,
data: child,
mode: mode,
searchFilter: this.state.searchFilter || this.props.searchFilter
}));
};
}
var filter = this.props.searchFilter || "";
var name = member.name || "";
var value = member.value || "";
// Filtering is case-insensitive
filter = filter.toLowerCase();
name = name.toLowerCase();
if (filter && (name.indexOf(filter) < 0)) {
// Cache the stringify result, so the filtering is fast
// the next time.
if (!member.valueString) {
member.valueString = JSON.stringify(value).toLowerCase();
}
if (member.valueString && member.valueString.indexOf(filter) < 0) {
classNames.push("hidden");
}
}
return (
DOM.div({className: classNames.join(" "), onClick: this.onClick},
DOM.span({className: "memberLabelCell"},
DOM.span({className: "memberLabel " + member.type + "Label"},
member.name)
),
DOM.span({className: "memberValueCell"},
DOM.span({},
Rep({
object: member.value,
mode: this.props.mode,
member: member
})
)
),
DOM.div({className: "memberChildren"},
children
)
)
)
},
onClick: function(e) {
var member = this.state.data;
member.open = !member.open;
this.setState({data: member});
e.stopPropagation();
},
}));
// Helpers
function initMembers(parent) {
var members = getMembers(parent);
return members;
}
function getMembers(object) {
var members = [];
getObjectProperties(object, function(prop, value) {
var valueType = typeof(value);
var hasChildren = (valueType === "object" && hasProperties(value));
// Cropped strings are expandable, so the user can see the
// entire original value.
if (StringRep.isCropped(value)) {
hasChildren = true;
}
var type = getType(value);
var member = createMember(type, prop, value, hasChildren);
members.push(member);
});
return members;
}
function createMember(type, name, value, hasChildren) {
var member = {
name: name,
type: type,
rowClass: "memberRow-" + type,
open: "",
hasChildren: hasChildren,
value: value,
open: false,
key: uid++
};
return member;
}
function getObjectProperties(obj, callback) {
for (var p in obj) {
try {
callback.call(this, p, obj[p]);
}
catch (e) {
console.error(e)
}
}
}
function hasProperties(obj) {
if (typeof(obj) == "string") {
return false;
}
try {
for (var name in obj) {
return true;
}
}
catch (exc) {
}
return false;
}
function getType(object) {
// A type provider (or a decorator) should be used here.
return "dom";
}
// Exports from this module
exports.TreeView = TreeView;
});

Просмотреть файл

@ -1,46 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
// Dependencies
const React = require("react");
const { createFactories } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
/**
* Renders undefined value
*/
const Undefined = React.createClass({
displayName: "UndefinedRep",
render: function() {
return (
ObjectBox({className: "undefined"},
"undefined"
)
)
},
});
function supportsObject(object, type) {
if (object && object.type && object.type == "undefined") {
return true;
}
return (type == "undefined");
}
// Exports from this module
exports.Undefined = {
rep: Undefined,
supportsObject: supportsObject
};
});

Просмотреть файл

@ -1,52 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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";
define(function(require, exports, module) {
const React = require("react");
const DOM = React.DOM;
// For smooth incremental searching (in case the user is typing quickly).
const searchDelay = 250;
/**
* This object represents a search box located at the
* top right corner of the application.
*/
var SearchBox = React.createClass({
displayName: "SearchBox",
render: function() {
return (
DOM.input({className: "searchBox",
placeholder: Locale.$STR("jsonViewer.filterJSON"),
onChange: this.onSearch})
)
},
onSearch: function(event) {
var searchBox = event.target;
var win = searchBox.ownerDocument.defaultView;
if (this.searchTimeout) {
win.clearTimeout(this.searchTimeout);
}
var callback = this.doSearch.bind(this, searchBox);
this.searchTimeout = win.setTimeout(callback, searchDelay);
},
doSearch: function(searchBox) {
this.props.actions.onSearch(searchBox.value);
}
});
// Exports from this module
exports.SearchBox = SearchBox;
});

Просмотреть файл

@ -1,79 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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/. */
define(function(require, exports, module) {
const React = require("react");
const { createFactories } = require("./reps/rep-utils");
const { Toolbar, ToolbarButton } = createFactories(require("./reps/toolbar"));
const DOM = React.DOM;
/**
* This template represents the 'Raw Data' panel displaying
* JSON as a text received from the server.
*/
var TextPanel = React.createClass({
displayName: "TextPanel",
getInitialState: function() {
return {};
},
render: function() {
return (
DOM.div({className: "textPanelBox"},
TextToolbar({actions: this.props.actions}),
DOM.div({className: "panelContent"},
DOM.pre({className: "data"},
this.props.data
)
)
)
);
}
});
/**
* This object represents a toolbar displayed within the
* 'Raw Data' panel.
*/
var TextToolbar = React.createFactory(React.createClass({
displayName: "TextToolbar",
render: function() {
return (
Toolbar({},
ToolbarButton({className: "prettyprint",onClick: this.onPrettify},
Locale.$STR("jsonViewer.PrettyPrint")
),
ToolbarButton({className: "save", onClick: this.onSave},
Locale.$STR("jsonViewer.Save")
),
ToolbarButton({className: "copy", onClick: this.onCopy},
Locale.$STR("jsonViewer.Copy")
)
)
)
},
// Commands
onPrettify: function(event) {
this.props.actions.onPrettify();
},
onSave: function(event) {
this.props.actions.onSaveJson();
},
onCopy: function(event) {
this.props.actions.onCopyJson();
},
}));
// Exports from this module
exports.TextPanel = TextPanel;
});

Просмотреть файл

@ -1,303 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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 Cu = Components.utils;
const Ci = Components.interfaces;
const Cc = Components.classes;
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
let require = devtools.require;
const {Class} = require("sdk/core/heritage");
const {Unknown} = require("sdk/platform/xpcom");
const xpcom = require("sdk/platform/xpcom");
const Events = require("sdk/dom/events");
const Clipboard = require("sdk/clipboard");
const NetworkHelper = require("devtools/toolkit/webconsole/network-helper");
const JsonViewUtils = require("devtools/jsonview/utils");
let childProcessMessageManager = Cc["@mozilla.org/childprocessmessagemanager;1"].
getService(Ci.nsISyncMessageSender);
// Amount of space that will be allocated for the stream's backing-store.
// Must be power of 2. Used to copy the data stream in onStopRequest.
const SEGMENT_SIZE = Math.pow(2, 17);
// Localization
var jsonViewStrings = Services.strings.createBundle(
"chrome://browser/locale/devtools/jsonview.properties");
/**
* This object detects application/json content type and converts it
* into a JSON Viewer application that allows simple JSON inspection.
*
* Based on JSON View: https://github.com/bhollis/jsonview/
*/
var Converter = Class({
extends: Unknown,
interfaces: [
"nsIStreamConverter",
"nsIStreamListener",
"nsIRequestObserver"
],
get wrappedJSObject() this,
/**
* This component works as such:
* 1. asyncConvertData captures the listener
* 2. onStartRequest fires, initializes stuff, modifies the listener to match our output type
* 3. onDataAvailable transcodes the data into a UTF-8 string
* 4. onStopRequest gets the collected data and converts it, spits it to the listener
* 5. convert does nothing, it's just the synchronous version of asyncConvertData
*/
convert: function(aFromStream, aFromType, aToType, aCtxt) {
return aFromStream;
},
asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
this.listener = aListener;
},
onDataAvailable: function(aRequest, aContext, aInputStream, aOffset, aCount) {
// From https://developer.mozilla.org/en/Reading_textual_data
var is = Cc["@mozilla.org/intl/converter-input-stream;1"].
createInstance(Ci.nsIConverterInputStream);
is.init(aInputStream, this.charset, -1,
Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
// Seed it with something positive
var bytesRead = 1;
while (aCount) {
var str = {};
var bytesRead = is.readString(aCount, str);
if (!bytesRead) {
throw new Error("Stream converter failed to read the input stream!");
}
aCount -= bytesRead;
this.data += str.value;
}
},
onStartRequest: function(aRequest, aContext) {
this.data = "";
this.uri = aRequest.QueryInterface(Ci.nsIChannel).URI.spec;
// Sets the charset if it is available. (For documents loaded from the
// filesystem, this is not set.)
this.charset = aRequest.QueryInterface(Ci.nsIChannel).contentCharset || 'UTF-8';
this.channel = aRequest;
this.channel.contentType = "text/html";
this.channel.contentCharset = "UTF-8";
this.listener.onStartRequest(this.channel, aContext);
},
/**
* This should go something like this:
* 1. Make sure we have a unicode string.
* 2. Convert it to a Javascript object.
* 2.1 Removes the callback
* 3. Convert that to HTML? Or XUL?
* 4. Spit it back out at the listener
*/
onStopRequest: function(aRequest, aContext, aStatusCode) {
let headers = {
response: [],
request: []
}
if (!(aRequest instanceof Ci.nsIHttpChannel)) {
return;
}
let win = NetworkHelper.getWindowForRequest(aRequest);
let Locale = {
$STR: key => {
try {
return jsonViewStrings.GetStringFromName(key);
} catch (err) {
Cu.reportError(err);
}
}
};
JsonViewUtils.exportIntoContentScope(win, Locale, "Locale");
Events.once(win, "DOMContentLoaded", event => {
Cu.exportFunction(this.postChromeMessage.bind(this), win, {
defineAs: "postChromeMessage"
});
})
aRequest.visitResponseHeaders({
visitHeader: function(name, value) {
headers.response.push({name: name, value: value});
}
});
aRequest.visitRequestHeaders({
visitHeader: function(name, value) {
headers.request.push({name: name, value: value});
}
});
let outputDoc = "";
try {
headers = JSON.stringify(headers);
outputDoc = this.toHTML(this.data, headers, this.uri);
} catch (e) {
Cu.reportError("JSON Viewer ERROR " + e);
outputDoc = this.toErrorPage(e, this.data, this.uri);
}
var storage = Cc["@mozilla.org/storagestream;1"].createInstance(Ci.nsIStorageStream);
storage.init(SEGMENT_SIZE, 0xffffffff, null);
var out = storage.getOutputStream(0);
var binout = Cc["@mozilla.org/binaryoutputstream;1"]
.createInstance(Ci.nsIBinaryOutputStream);
binout.setOutputStream(out);
binout.writeUtf8Z(outputDoc);
binout.close();
// We need to trim 4 bytes off the front (this could be underlying bug).
var trunc = 4;
var instream = storage.newInputStream(trunc);
// Pass the data to the main content listener
this.listener.onDataAvailable(this.channel, aContext, instream, 0,
instream.available());
this.listener.onStopRequest(this.channel, aContext, aStatusCode);
this.listener = null;
},
htmlEncode: function(t) {
return t !== null ? t.toString().replace(/&/g,"&amp;").
replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;") : '';
},
toHTML: function(json, headers, title) {
var themeClassName = "theme-" + JsonViewUtils.getCurrentTheme();
var baseUrl = "resource:///modules/devtools/jsonview/";
var theme = (themeClassName == "theme-light") ? "light" : "dark";
var themeUrl = '<link rel="stylesheet" type="text/css" ' +
'href="chrome://browser/skin/devtools/' + theme + '-theme.css">';
return '<!DOCTYPE html>\n' +
'<html><head><title>' + this.htmlEncode(title) + '</title>' +
'<base href="' + this.htmlEncode(baseUrl) + '">' +
'<link rel="stylesheet" type="text/css" href="css/main.css">' +
themeUrl +
'<script data-main="viewer-config" src="lib/require.js"></script>' +
'</head><body class="' + themeClassName + '">' +
'<div id="content"></div>' +
'<div id="json">' + this.htmlEncode(json) + '</div>' +
'<div id="headers">' + this.htmlEncode(headers) + '</div>' +
'</body></html>';
},
toErrorPage: function(error, data, uri) {
// Escape unicode nulls
data = data.replace("\u0000", "\uFFFD");
var errorInfo = error + "";
var output = '<div id="error">' + _('errorParsing')
if (errorInfo.message) {
output += '<div class="errormessage">' + errorInfo.message + '</div>';
}
output += '</div><div id="json">' + this.highlightError(data,
errorInfo.line, errorInfo.column) + '</div>';
return '<!DOCTYPE html>\n' +
'<html><head><title>' + this.htmlEncode(uri + ' - Error') + '</title>' +
'<base href="' + this.htmlEncode(self.data.url()) + '">' +
'</head><body>' +
output +
'</body></html>';
},
// Chrome <-> Content communication
postChromeMessage: function(type, args, objects) {
var value = args;
switch (type) {
case "copy":
Clipboard.set(value, "text");
break;
case "copy-headers":
this.copyHeaders(value);
break;
case "save":
childProcessMessageManager.sendAsyncMessage(
"devtools:jsonview:save", value);
}
},
copyHeaders: function(headers) {
var value = "";
var eol = (Services.appinfo.OS !== "WINNT") ? "\n" : "\r\n";
var responseHeaders = headers.response;
for (var i=0; i<responseHeaders.length; i++) {
var header = responseHeaders[i];
value += header.name + ": " + header.value + eol;
}
value += eol;
var requestHeaders = headers.request;
for (var i=0; i<requestHeaders.length; i++) {
var header = requestHeaders[i];
value += header.name + ": " + header.value + eol;
}
Clipboard.set(value, "text");
}
});
// Stream converter component registration
const JSON_TYPE = "application/json";
const CONTRACT_ID = "@mozilla.org/streamconv;1?from=" + JSON_TYPE + "&to=*/*";
const CLASS_ID = "{d8c9acee-dec5-11e4-8c75-1681e6b88ec1}";
const GECKO_VIEWER = "Gecko-Content-Viewers";
var service = xpcom.Service({
id: Components.ID(CLASS_ID),
contract: CONTRACT_ID,
Component: Converter,
register: false,
unregister: false
});
if (!xpcom.isRegistered(service)) {
xpcom.register(service);
}
// Remove native Gecko viewer
var categoryManager = Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager);
categoryManager.deleteCategoryEntry(GECKO_VIEWER, JSON_TYPE, false);
categoryManager.addCategoryEntry("ext-to-type-mapping", "json",
JSON_TYPE, false, true);

Просмотреть файл

@ -1,152 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
.domTable {
font-size: 11px;
font-family: Lucida Grande, Tahoma, sans-serif;
line-height: 15px;
width: 100%;
}
.domTable > tbody > tr > td {
border-bottom: 1px solid #EFEFEF;
}
.hidden {
display: none;
}
.memberLabelCell {
padding: 2px 0 2px 0px;
vertical-align: top;
}
.memberValueCell {
padding: 2px 0 2px 5px;
overflow: hidden;
}
.memberLabel {
cursor: default;
overflow: hidden;
padding-left: 18px;
white-space: nowrap;
}
.memberLabelPrefix {
color: gray;
margin-right: 3px;
font-weight: normal;
}
.memberValueIcon > div {
width: 15px;
}
/******************************************************************************/
/* Read Only Properties */
.memberValueCell.readOnly {
opacity: 0.5;
}
.memberValueIcon.readOnly {
background: url("read-only-prop.svg") no-repeat;
background-position: 4px 4px;
background-size: 10px 10px;
}
/******************************************************************************/
.memberRow.hasChildren > .memberLabelCell > .memberLabel:hover,
.memberRow.cropped > .memberLabelCell > .memberLabel:hover {
cursor: pointer;
color: blue;
text-decoration: underline;
}
.memberRow:hover {
background-color: #EFEFEF;
}
.panelNode-dom .memberRow td,
.panelNode-domSide .memberRow td {
border-bottom: 1px solid #EFEFEF;
}
/******************************************************************************/
.userLabel,
.userClassLabel,
.userFunctionLabel {
font-weight: bold;
}
.userLabel {
color: #000000;
}
.userClassLabel {
color: #E90000;
}
.userFunctionLabel {
color: #025E2A;
}
.domLabel {
color: #000000;
}
.domClassLabel {
color: #E90000;
}
.domFunctionLabel {
color: #025E2A;
}
.ordinalLabel {
color: SlateBlue;
font-weight: bold;
}
/******************************************************************************/
/* Twisties */
.memberRow.hasChildren > .memberLabelCell > .memberLabel,
.memberRow.cropped > .memberLabelCell > .memberLabel {
background-image: url(twisty-closed.svg);
background-repeat: no-repeat;
background-position: 2px calc(0.5em - 3px);
min-height: 12px;
}
.memberRow.hasChildren.opened > .memberLabelCell > .memberLabel,
.memberRow.cropped.opened > .memberLabelCell > .memberLabel {
background-image: url(twisty-open.svg);
background-repeat: no-repeat;
min-height: 12px;
}
/******************************************************************************/
/* Layout support */
.memberChildren {
padding-left: 16px;
}
.memberLabelCell,
.memberValueCell {
display: table-cell;
}
.memberLabelCell {
min-width: 30px;
}
.memberRow:hover {
background-color: transparent !important;
}

Просмотреть файл

@ -1,44 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
/******************************************************************************/
/* General */
body {
background-color: white;
padding: 0;
margin: 0;
overflow: hidden;
}
*:focus {
outline: none !important;
}
#content {
height: 100%;
}
pre {
background-color: white;
border: none;
}
#json,
#headers {
display: none;
}
/******************************************************************************/
/* Dark Theme */
body.theme-dark {
color: var(--theme-body-color);
background-color: var(--theme-body-background);
}
.theme-dark pre {
background-color: var(--theme-body-background);
}

Просмотреть файл

@ -1,79 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
/******************************************************************************/
/* Headers Panel */
.headersPanelBox {
height: 100%;
font-family: Lucida Grande, Tahoma, sans-serif;
font-size: 11px;
}
.headersPanelBox .netInfoHeadersTable {
overflow: auto;
height: 100%;
line-height: 12px;
}
.headersPanelBox .netHeadersGroup {
padding: 10px;
}
.headersPanelBox .netInfoHeadersGroup {
margin-bottom: 10px;
border-bottom: 1px solid #D7D7D7;
padding-top: 8px;
padding-bottom: 4px;
font-family: Lucida Grande, Tahoma, sans-serif;
font-weight: bold;
color: #565656;
}
.headersPanelBox .netHeader.twisty {
background-image: url(twisty-open.svg);
background-repeat: no-repeat;
min-height: 12px;
background-position: 2px 50%;
}
.headersPanelBox .netHeader {
cursor: pointer;
padding-left: 17px;
position: static;
-moz-user-select: none;
}
.headersPanelBox .netInfoParamValue code {
display: block;
color: #18191A;
font-size: 11px;
word-wrap: break-word;
}
.headersPanelBox .netInfoParamName {
padding: 2px 10px 0 0;
font-family: Lucida Grande, Tahoma, sans-serif;
font-weight: bold;
vertical-align: top;
text-align: right;
white-space: nowrap;
}
/******************************************************************************/
/* Dark Theme */
.theme-dark .headersPanelBox .netInfoParamName {
color: var(--theme-highlight-blue);
}
.theme-dark .headersPanelBox .netInfoParamValue code {
color: var(--theme-highlight-orange);
}
.theme-dark .headersPanelBox .netInfoHeadersGroup {
color: var(--theme-body-color-alt);
}

Просмотреть файл

@ -1,16 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
/******************************************************************************/
/* JSON Panel */
.jsonParseError {
font-size: 12px;
font-family: Lucida Grande, Tahoma, sans-serif;
line-height: 15px;
width: 100%;
padding: 10px;
color: red;
}

Просмотреть файл

@ -1,37 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
@import "general.css";
@import "reps.css";
@import "dom-tree.css";
@import "search-box.css";
@import "tabs.css";
@import "toolbar.css";
@import "json-panel.css";
@import "text-panel.css";
@import "headers-panel.css";
/******************************************************************************/
/* Panel Content */
.panelContent {
overflow-y: auto;
}
/******************************************************************************/
/* Theme Firebug */
.theme-firebug .panelContent {
height: calc(100% - 30px);
}
/******************************************************************************/
/* Theme Light & Theme Dark*/
.theme-dark .panelContent,
.theme-light .panelContent {
height: calc(100% - 27px);
}

Просмотреть файл

@ -1,23 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; 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/.
EXTRA_JS_MODULES.devtools.jsonview.css += [
'dom-tree.css',
'general.css',
'headers-panel.css',
'json-panel.css',
'main.css',
'read-only-prop.svg',
'reps.css',
'search-box.css',
'search.svg',
'tabs.css',
'text-panel.css',
'toolbar.css',
'twisty-closed.svg',
'twisty-open.svg'
]

Просмотреть файл

@ -1,256 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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/. -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="12"
height="12"
id="svg2">
<defs
id="defs4">
<linearGradient
id="linearGradient3892">
<stop
id="stop3894"
style="stop-color:#787878;stop-opacity:1"
offset="0" />
<stop
id="stop3896"
style="stop-color:#b4b4b4;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3765">
<stop
id="stop3767"
style="stop-color:#505050;stop-opacity:1"
offset="0" />
<stop
id="stop3769"
style="stop-color:#787878;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3757">
<stop
id="stop3759"
style="stop-color:#c8c8c8;stop-opacity:1"
offset="0" />
<stop
id="stop3761"
style="stop-color:#dcdcdc;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3765-6">
<stop
id="stop3767-0"
style="stop-color:#a0a0a0;stop-opacity:1"
offset="0" />
<stop
id="stop3769-4"
style="stop-color:#c8c8c8;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="11.376831"
y1="1052.0852"
x2="4.5592546"
y2="1040.6658"
id="linearGradient3830"
xlink:href="#linearGradient3757"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.87012989,0,0,0.82456145,1.0389611,183.57212)" />
<linearGradient
x1="8.8415442"
y1="1053.3849"
x2="1.9174434"
y2="1041.9227"
id="linearGradient3832"
xlink:href="#linearGradient3765-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.87012989,0,0,0.82456145,1.0389611,183.57212)" />
<linearGradient
x1="8.6370001"
y1="4.3111062"
x2="6.3403625"
y2="0.58274388"
id="linearGradient3861"
xlink:href="#linearGradient3757"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.89600004,0,0,0.97745455,0.83199985,0.9945)" />
<linearGradient
x1="7.1882658"
y1="5.0780835"
x2="4.9555426"
y2="1.392331"
id="linearGradient3866"
xlink:href="#linearGradient3765-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.89600004,0,0,0.97745455,0.83199985,0.9945)" />
<linearGradient
x1="9.3919191"
y1="12.115811"
x2="7.4015098"
y2="7.4140091"
id="linearGradient3909"
xlink:href="#linearGradient3892"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="8.5397177"
y1="12.497831"
x2="6.6080809"
y2="7.825417"
id="linearGradient3917"
xlink:href="#linearGradient3765"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="8.5397177"
y1="12.497831"
x2="6.6080809"
y2="7.825417"
id="linearGradient3039"
xlink:href="#linearGradient3765"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.71428573,0,0,0.71492245,0.28571425,0.27617311)" />
<linearGradient
x1="9.3919191"
y1="12.115811"
x2="7.4015098"
y2="7.4140091"
id="linearGradient3041"
xlink:href="#linearGradient3892"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.71428573,0,0,0.71492245,0.28571425,0.27617311)" />
<linearGradient
x1="11.376831"
y1="1052.0852"
x2="4.5592546"
y2="1040.6658"
id="linearGradient3044"
xlink:href="#linearGradient3757"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.62152136,0,0,0.58949749,1.0278293,-609.4026)" />
<linearGradient
x1="8.8415442"
y1="1053.3849"
x2="1.9174434"
y2="1041.9227"
id="linearGradient3046"
xlink:href="#linearGradient3765-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.62152136,0,0,0.58949749,1.0278293,-609.4026)" />
<linearGradient
x1="8.6370001"
y1="4.3111062"
x2="6.3403625"
y2="0.58274388"
id="linearGradient3049"
xlink:href="#linearGradient3757"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.64000004,0,0,0.6988042,0.87999987,0.98716349)" />
<linearGradient
x1="7.1882658"
y1="5.0780835"
x2="4.9555426"
y2="1.392331"
id="linearGradient3051"
xlink:href="#linearGradient3765-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.64000004,0,0,0.6988042,0.87999987,0.98716349)" />
<linearGradient
x1="8.6370001"
y1="4.3111062"
x2="6.3403625"
y2="0.58274388"
id="linearGradient3826"
xlink:href="#linearGradient3757"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.64000004,0,0,0.6988042,0.87999987,0.98716349)" />
<linearGradient
x1="7.1882658"
y1="5.0780835"
x2="4.9555426"
y2="1.392331"
id="linearGradient3828"
xlink:href="#linearGradient3765-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.64000004,0,0,0.6988042,0.87999987,0.98716349)" />
<linearGradient
x1="11.376831"
y1="1052.0852"
x2="4.5592546"
y2="1040.6658"
id="linearGradient3831"
xlink:href="#linearGradient3757"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.62152136,0,0,0.58949749,1.0278293,-609.4026)" />
<linearGradient
x1="8.8415442"
y1="1053.3849"
x2="1.9174434"
y2="1041.9227"
id="linearGradient3833"
xlink:href="#linearGradient3765-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.62152136,0,0,0.58949749,1.0278293,-609.4026)" />
<linearGradient
x1="8.5397177"
y1="12.497831"
x2="6.6080809"
y2="7.825417"
id="linearGradient3835"
xlink:href="#linearGradient3765"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.71428573,0,0,0.71492245,0.28571425,0.27617311)" />
<linearGradient
x1="9.3919191"
y1="12.115811"
x2="7.4015098"
y2="7.4140091"
id="linearGradient3837"
xlink:href="#linearGradient3892"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.71428573,0,0,0.71492245,0.28571425,0.27617311)" />
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="matrix(1.1910164,0,0,1.1910639,-1.146234,-1.1462857)"
id="g3821">
<path
d="m 6.0000001,1.2145088 c -1.6317576,0 -2.9446627,1.2860444 -2.9910715,2.9043725 0.1136269,-0.018496 0.2381347,-0.044683 0.3571429,-0.044683 l 0.9375,0 c 0.082361,-0.8799332 0.7978203,-1.6532581 1.6964286,-1.6532581 0.8986083,0 1.6140679,0.7733249 1.6964286,1.6532581 l 0.9375,0 c 0.1190079,0 0.2435157,0.026187 0.3571429,0.044683 C 8.944663,2.5005532 7.6317573,1.2145088 6.0000001,1.2145088 z"
id="path3773"
style="fill:url(#linearGradient3826);fill-opacity:1;stroke:url(#linearGradient3828);stroke-width:0.50376141;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
width="9.5714283"
height="6.7202706"
rx="1.679238"
ry="1.6791711"
x="1.2142856"
y="4.0652847"
id="rect2987-9"
style="fill:url(#linearGradient3831);fill-opacity:1;stroke:url(#linearGradient3833);stroke-width:0.50376141;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 6.0000001,5.5040435 c -0.6706315,0 -1.2053572,0.5352023 -1.2053572,1.2064317 0,0.5619236 0.3753047,1.0226472 0.8928572,1.1617489 l 0,1.4745276 0.625,0 0,-1.4745276 C 6.8300525,7.7331224 7.2053573,7.2723988 7.2053573,6.7104752 c 0,-0.6712294 -0.5347257,-1.2064317 -1.2053572,-1.2064317 z"
id="path3898"
style="fill:url(#linearGradient3835);fill-opacity:1;stroke:url(#linearGradient3837);stroke-width:0.33584094;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 8.8 KiB

Просмотреть файл

@ -1,211 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
.objectLink:hover {
cursor: pointer;
text-decoration: underline;
}
/******************************************************************************/
.inline {
display: inline;
white-space: normal;
}
.objectBox-object {
font-family: Lucida Grande, sans-serif;
font-weight: bold;
color: DarkGreen;
white-space: pre-wrap;
}
.objectBox-string,
.objectBox-text,
.objectBox-number,
.objectLink-element,
.objectLink-textNode,
.objectLink-function,
.objectBox-stackTrace,
.objectLink-profile,
.objectBox-table {
font-family: monospace;
}
.objectBox-string,
.objectBox-text,
.objectLink-textNode,
.objectBox-table {
white-space: pre-wrap;
}
.objectBox-number,
.objectLink-styleRule,
.objectLink-element,
.objectLink-textNode {
color: #000088;
}
.objectBox-string {
color: #FF0000;
}
.objectLink-function,
.objectBox-stackTrace,
.objectLink-profile {
color: DarkGreen;
}
.objectBox-null,
.objectBox-undefined,
.objectBox-hint,
.logRowHint {
font-style: italic;
color: #787878;
}
.objectBox-scope {
color: #707070;
}
.objectBox-optimizedAway {
color: #909090;
}
.objectLink-sourceLink {
position: absolute;
right: 4px;
top: 2px;
padding-left: 8px;
font-family: Lucida Grande, sans-serif;
font-weight: bold;
color: #0000FF;
}
.objectLink-sourceLink > .systemLink {
float: right;
color: #FF0000;
}
/******************************************************************************/
.objectLink-event,
.objectLink-eventLog,
.objectLink-regexp,
.objectLink-object,
.objectLink-Date {
font-family: Lucida Grande, sans-serif;
font-weight: bold;
color: DarkGreen;
white-space: pre-wrap;
}
/******************************************************************************/
.objectLink-object .nodeName,
.objectLink-NamedNodeMap .nodeName,
.objectLink-NamedNodeMap .objectEqual,
.objectLink-NamedNodeMap .arrayLeftBracket,
.objectLink-NamedNodeMap .arrayRightBracket,
.objectLink-Attr .attrEqual,
.objectLink-Attr .attrTitle {
color: rgb(0, 0, 136)
}
.objectLink-object .nodeName {
font-weight: normal;
}
/******************************************************************************/
.objectLeftBrace,
.objectRightBrace,
.objectEqual,
.objectComma,
.arrayLeftBracket,
.arrayRightBracket,
.arrayComma {
font-family: monospace;
}
.objectLeftBrace,
.objectRightBrace,
.arrayLeftBracket,
.arrayRightBracket {
cursor: pointer;
font-weight: bold;
}
.objectLeftBrace,
.arrayLeftBracket {
margin-right: 4px;
}
.objectRightBrace,
.arrayRightBracket {
margin-left: 4px;
}
/******************************************************************************/
/* Cycle reference*/
.objectLink-Reference {
font-family: monospace;
font-weight: bold;
color: rgb(102, 102, 255);
}
.objectBox-array > .objectTitle {
font-weight: bold;
color: DarkGreen;
}
/******************************************************************************/
.caption {
font-family: Lucida Grande, Tahoma, sans-serif;
font-weight: bold;
color: #444444;
}
/******************************************************************************/
/* Light Theme & Dark Theme */
.theme-dark .domLabel,
.theme-light .domLabel {
color: var(--theme-highlight-bluegrey);
}
.theme-dark .objectBox-number,
.theme-light .objectBox-number {
color: var(--theme-highlight-green);
}
.theme-dark .objectBox-string,
.theme-light .objectBox-string {
color: var(--theme-highlight-orange)
}
.theme-dark .objectBox-null,
.theme-dark .objectBox-undefined,
.theme-light .objectBox-null,
.theme-light .objectBox-undefined {
font-style: normal;
color: var(--theme-comment);
}
.theme-dark .objectBox-object,
.theme-light .objectBox-object {
font-family: Lucida Grande, sans-serif;
font-weight: normal;
color: var(--theme-highlight-bluegrey);
white-space: pre-wrap;
}
.theme-dark .caption,
.theme-light .caption {
font-family: Lucida Grande, Tahoma, sans-serif;
font-weight: normal;
color: var(--theme-highlight-bluegrey);
}

Просмотреть файл

@ -1,46 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
/******************************************************************************/
/* Search Box */
.searchBox {
height: 18px;
font-size: 12px;
margin-top: 0;
border: 1px solid rgb(170, 188, 207);
width: 200px;
position: fixed;
right: 5px;
background-image: url("search.svg");
background-repeat: no-repeat;
background-position: 2px center;
padding-left: 20px;
}
/******************************************************************************/
/* Light Theme & Dark Theme*/
.theme-dark .searchBox,
.theme-light .searchBox {
border: 1px solid rgb(170, 170, 170);
background-image: url("chrome://browser/skin/devtools/magnifying-glass-light.png");
background-position: 8px center;
border-radius: 2px;
padding-left: 25px;
margin-top: 1px;
height: 16px;
font-style: italic;
}
/******************************************************************************/
/* Dark Theme */
.theme-dark .searchBox {
background-color: rgba(24, 29, 32, 1);
color: rgba(184, 200, 217, 1);
border-color: var(--theme-splitter-color);
background-image: url("chrome://browser/skin/devtools/magnifying-glass.png");
}

Просмотреть файл

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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/. -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="16"
height="16"
id="svg2">
<defs
id="defs4">
<linearGradient
id="linearGradient3841">
<stop
id="stop3843"
style="stop-color:#427dc2;stop-opacity:1"
offset="0" />
<stop
id="stop3845"
style="stop-color:#5e9fce;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3795">
<stop
id="stop3797"
style="stop-color:#2f5d93;stop-opacity:1"
offset="0" />
<stop
id="stop3799"
style="stop-color:#3a87bd;stop-opacity:0.99215686"
offset="1" />
</linearGradient>
<filter
x="-0.1195599"
y="-0.12044335"
width="1.2391198"
height="1.2408867"
color-interpolation-filters="sRGB"
id="filter2984">
<feGaussianBlur
id="feGaussianBlur2986"
stdDeviation="0.63671875" />
</filter>
<linearGradient
x1="4.0935063"
y1="13.423457"
x2="4.0935063"
y2="2.742672"
id="linearGradient3800"
xlink:href="#linearGradient3841"
gradientUnits="userSpaceOnUse" />
<linearGradient
x1="8.7112017"
y1="13.579539"
x2="8.7112017"
y2="2.5663419"
id="linearGradient3808"
xlink:href="#linearGradient3795"
gradientUnits="userSpaceOnUse" />
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<path
d="m 10.140619,1.656256 c -2.3511382,0 -4.2500001,1.898862 -4.2500001,4.2500004 0,0.751994 0.189088,1.449383 0.53125,2.0625 l -4.8125,4.8124996 1.5625001,1.5625 4.7812499,-4.7812496 c 0.6402543,0.38528 1.3858221,0.5937496 2.1875001,0.5937496 2.351138,0 4.25,-1.8988616 4.25,-4.2499996 0,-2.3511384 -1.898862,-4.2500004 -4.25,-4.2500004 z m 0,1.53125 c 1.503797,0 2.71875,1.214953 2.71875,2.7187504 0,1.503798 -1.214953,2.71875 -2.71875,2.71875 -1.5037975,0 -2.7187501,-1.214952 -2.7187501,-2.71875 0,-1.5037974 1.2149526,-2.7187504 2.7187501,-2.7187504 z"
id="path3014-7"
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.5;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;filter:url(#filter2984)" />
<path
d="M 10,2 C 7.7908609,2 6,3.7908609 6,6 6,6.8284272 6.2562027,7.6115959 6.6875,8.25 L 1.8125,13.125 2.875,14.1875 7.75,9.3125 C 8.3884041,9.7437973 9.1715728,10 10,10 12.209139,10 14,8.2091391 14,6 14,3.7908609 12.209139,2 10,2 z m 0,1 c 1.656854,0 3,1.3431458 3,3 0,1.6568542 -1.343146,3 -3,3 C 8.3431458,9 7,7.6568542 7,6 7,4.3431458 8.3431458,3 10,3 z"
id="path2994"
style="fill:url(#linearGradient3800);fill-opacity:1;stroke:url(#linearGradient3808);stroke-width:0.60000002;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none" />
</svg>

До

Ширина:  |  Высота:  |  Размер: 3.5 KiB

Просмотреть файл

@ -1,205 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
/******************************************************************************/
/* Tabs General Styles */
.tabs {
height: 100%;
}
.tabs .tabs-navigation {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
border-bottom-color: rgb(170, 188, 207);
}
.tabs .tabs-menu {
display: table;
list-style: none;
padding: 0;
margin: 0;
}
.tabs .tabs-menu-item {
float: left;
}
.tabs .tabs-menu-item a {
display: block;
color: #A9A9A9;
padding: 4px 8px;
}
.tabs .tabs-menu-item a {
border: 1px solid transparent;
text-decoration: none;
}
.tabs .tab-panel {
background-color: white;
}
.tabs .tab-panel > DIV,
.tabs .tab-panel > DIV > DIV {
height: 100%;
}
/******************************************************************************/
/* Firebug Theme */
.theme-firebug .tabs {
background-color: rgb(219, 234, 249);
background-image: linear-gradient(rgba(253, 253, 253, 0.2), rgba(253, 253, 253, 0));
}
.theme-firebug .tabs .tabs-navigation {
padding-top: 3px;
padding-left: 3px;
height: 27px;
border-bottom: 1px solid rgb(170, 188, 207);
}
.theme-firebug .tabs .tab-panel {
height: calc(100% - 31px); /* minus the height of the tab bar */
}
.theme-firebug .tabs .tabs-menu-item {
position: relative;
}
.theme-firebug .tabs .tabs-menu-item a {
padding: 5px 8px 4px 8px;;
font-weight: bold;
color: #565656;
border-radius: 4px 4px 0 0;
}
.theme-firebug .tabs .tabs-menu-item.is-active a,
.theme-firebug .tabs .tabs-menu-item.is-active a:focus {
background-color: rgb(247, 251, 254);
border: 1px solid rgb(170, 188, 207);
border-bottom-color: transparent;
}
.theme-firebug .tabs .tabs-menu-item:hover a {
border: 1px solid #C8C8C8;
border-bottom: 1px solid transparent;
background-color: transparent !important;
}
.theme-firebug .tabs .tabs-menu-item.is-active:hover a {
border: 1px solid rgb(170, 188, 207) !important;
background-color: rgb(247, 251, 254) !important;
border-bottom-color: transparent !important;
}
/******************************************************************************/
/* Light Theme */
.theme-dark .tabs,
.theme-light .tabs {
background: var(--theme-tab-toolbar-background);
}
.theme-dark .tabs .tabs-navigation,
.theme-light .tabs .tabs-navigation {
border-bottom: 1px solid var(--theme-splitter-color);
box-shadow: 0 -2px 0 rgba(170, 170, 170,.1) inset;
height: 24px;
font-size: 12px;
}
.theme-dark .tabs .tab-panel,
.theme-light .tabs .tab-panel {
height: calc(100% - 24px); /* minus the height of the tab bar */
}
.theme-dark .tabs .tabs-menu-item,
.theme-light .tabs .tabs-menu-item {
margin: 0;
padding: 0;
border-style: solid;
border-width: 0;
-moz-border-start-width: 1px;
border-color: var(--theme-splitter-color);
}
.theme-dark .tabs .tabs-menu-item a,
.theme-light .tabs .tabs-menu-item a {
color: var(--theme-content-color1);
}
.theme-dark .tabs .tabs-menu-item a:hover,
.theme-dark .tabs .tabs-menu-item a,
.theme-light .tabs .tabs-menu-item a:hover,
.theme-light .tabs .tabs-menu-item a {
border: none !important;
background-color: transparent !important;
padding: 5px 15px;
}
.theme-dark .tabs .tabs-menu-item:hover,
.theme-light .tabs .tabs-menu-item:hover {
background-color: rgba(170,170,170,.2);
}
.theme-dark .tabs .tabs-menu-item.is-active,
.theme-dark .tabs .tabs-menu-item.is-active:hover,
.theme-light .tabs .tabs-menu-item.is-active,
.theme-light .tabs .tabs-menu-item.is-active:hover {
background-color: var(--theme-selection-background);
}
.theme-dark .tabs .tabs-menu-item.is-active a,
.theme-dark .tabs .tabs-menu-item.is-active:hover a,
.theme-light .tabs .tabs-menu-item.is-active a,
.theme-light .tabs .tabs-menu-item.is-active:hover a {
color: var(--theme-selection-color);
}
.theme-dark .tabs .tabs-menu-item:active:hover,
.theme-light .tabs .tabs-menu-item:active:hover {
background-color: rgba(170,170,170,.4);
}
.theme-dark .tabs .tabs-menu-item.is-active,
.theme-light .tabs .tabs-menu-item.is-active {
box-shadow: 0 2px 0 #d7f1ff inset,
0 8px 3px -5px #2b82bf inset,
0 -2px 0 rgba(0,0,0,.06) inset;
}
/******************************************************************************/
/* Dark Theme */
.theme-dark .tabs .tabs-navigation {
box-shadow: 0px -2px 0px rgba(0, 0, 0, 0.1) inset;
}
.theme-dark .tabs .tabs-menu-item a {
color: #CED3D9;
}
.theme-dark .tabs .tabs-menu-item a:hover,
.theme-dark .tabs .tabs-menu-item a {
border: none !important;
background-color: transparent !important;
padding: 5px 15px;
}
.theme-dark .tabs .tabs-menu-item:active:hover {
background-color: hsla(206,37%,4%,.4);
}
.theme-dark .tabs .tabs-menu-item.is-active {
box-shadow: 0px 2px 0px #D7F1FF inset,
0px 8px 3px -5px #2B82BF inset,
0px -2px 0px rgba(0, 0, 0, 0.2) inset;
}
.theme-dark .tabs .tab-panel {
background-color: var(--theme-body-background);
}

Просмотреть файл

@ -1,29 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
/******************************************************************************/
/* Text Panel */
.textPanelBox {
height: 100%;
}
.textPanelBox .data {
font-size: 11px;
font-family: monospace;
overflow: auto;
height: 100%;
}
.textPanelBox pre {
margin: 0;
}
/******************************************************************************/
/* Dark Theme */
.theme-dark .textPanelBox {
color: var(--theme-content-color1);
}

Просмотреть файл

@ -1,94 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
/******************************************************************************/
/* Toolbar */
.toolbar {
line-height: 20px;
font-size: 12px;
height: 22px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
padding: 4px 0 3px 0;
}
.toolbar .btn {
margin-left: 5px;
background-color: #E6E6E6;
border: 1px solid rgb(204, 204, 204);
text-decoration: none;
display: inline-block;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-moz-user-select: none;
padding: 0 2px 1px 2px;
}
.toolbar .btn::-moz-focus-inner {
border: 1px solid transparent;
}
/******************************************************************************/
/* Firebug Theme */
.theme-firebug .toolbar {
border-bottom: 1px solid rgb(170, 188, 207);
background-color: rgb(219, 234, 249) !important;
background-image: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
}
.theme-firebug .toolbar .btn {
border-radius: 2px;
color: #141414;
background-color: white;
}
.theme-firebug .toolbar .btn:hover {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.theme-firebug .toolbar .btn:active {
background-image: none;
outline: 0;
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
/******************************************************************************/
/* Light Theme & Dark Theme*/
.theme-dark .toolbar,
.theme-light .toolbar {
background-color: var(--theme-toolbar-background);
border-bottom: 1px solid var(--theme-splitter-color);
padding: 1px;
padding-left: 2px;
}
.theme-dark .toolbar .btn,
.theme-light .toolbar .btn {
min-width: 78px;
min-height: 18px;
color: var(--theme-content-color1);
text-shadow: none;
margin: 1px 2px 1px 2px;
border: none;
border-radius: 0;
background-color: rgba(170, 170, 170, .2); /* Splitter */
transition: background 0.05s ease-in-out;
}
.theme-dark .toolbar .btn:hover,
.theme-light .toolbar .btn:hover {
background: rgba(170, 170, 170, .3); /* Splitters */
}
.theme-dark .toolbar .btn:not([disabled]):hover:active,
.theme-light .toolbar .btn:not([disabled]):hover:active {
background: rgba(170, 170, 170, .4); /* Splitters */
}

Просмотреть файл

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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/. -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="11"
height="11"
id="svg2">
<defs
id="defs4">
<linearGradient
id="linearGradient3792">
<stop
id="stop3795"
style="stop-color:#c3baaa;stop-opacity:1"
offset="0" />
<stop
id="stop3797"
style="stop-color:#ffffff;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="6.0530181"
y1="7.092885"
x2="2.8882971"
y2="1.7999334"
id="linearGradient3799"
xlink:href="#linearGradient3792"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0256411,0,0,1.0256411,-0.11538478,1.8846152)" />
<linearGradient
x1="6.0530181"
y1="7.092885"
x2="2.8882971"
y2="1.7999334"
id="linearGradient2992"
xlink:href="#linearGradient3792"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0256411,0,0,1.0256411,-0.11538478,1.8846152)" />
<linearGradient
x1="6.0530181"
y1="7.092885"
x2="2.8882971"
y2="1.7999334"
id="linearGradient2996"
xlink:href="#linearGradient3792"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0256411,0,0,1.0256411,0.88461522,0.8846152)" />
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<rect
width="8"
height="8"
rx="1"
ry="1"
x="1.5"
y="1.5"
id="rect3022"
style="fill:url(#linearGradient2996);fill-opacity:1;stroke:#7898b5;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="M 5,3 5,5 3,5 3,6 5,6 5,8 6,8 6,6 8,6 8,5 6,5 6,3 5,3 z"
id="rect3801"
style="fill:#000000;fill-opacity:1;stroke:none" />
</svg>

До

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Просмотреть файл

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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/. -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="11"
height="11"
id="svg2">
<defs
id="defs4">
<linearGradient
id="linearGradient3792">
<stop
id="stop3795"
style="stop-color:#c3baaa;stop-opacity:1"
offset="0" />
<stop
id="stop3797"
style="stop-color:#ffffff;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="6.0530181"
y1="7.092885"
x2="2.8882971"
y2="1.7999334"
id="linearGradient3799"
xlink:href="#linearGradient3792"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0256411,0,0,1.0256411,-0.11538478,1.8846152)" />
<linearGradient
x1="6.0530181"
y1="7.092885"
x2="2.8882971"
y2="1.7999334"
id="linearGradient2992"
xlink:href="#linearGradient3792"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0256411,0,0,1.0256411,-0.11538478,1.8846152)" />
<linearGradient
x1="6.0530181"
y1="7.092885"
x2="2.8882971"
y2="1.7999334"
id="linearGradient2996"
xlink:href="#linearGradient3792"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0256411,0,0,1.0256411,0.88461522,0.8846152)" />
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<rect
width="8"
height="8"
rx="1"
ry="1"
x="1.5"
y="1.5"
id="rect3022"
style="fill:url(#linearGradient2996);fill-opacity:1;stroke:#7898b5;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<rect
width="5"
height="1"
x="3"
y="5"
id="rect3801"
style="fill:#000000;fill-opacity:1;stroke:none" />
</svg>

До

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Просмотреть файл

@ -1,100 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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/. */
define(function(require, exports, module) {
// ReactJS
const React = require("react");
// RDP Inspector
const { createFactories } = require("./components/reps/rep-utils");
const { MainTabbedArea } = createFactories(require("./components/main-tabbed-area"));
const json = document.getElementById("json");
const headers = document.getElementById("headers");
var jsonData;
try {
jsonData = JSON.parse(json.textContent);
} catch (err) {
jsonData = err + "";
}
// Application state object.
var input = {
jsonText: json.textContent,
jsonPretty : null,
json: jsonData,
headers: JSON.parse(headers.textContent),
tabActive: 1,
prettified: false
}
json.remove();
headers.remove();
/**
* Application actions/commands. This list implements all commands
* available for the JSON viewer.
*/
input.actions = {
onCopyJson: function() {
var value = input.prettified ? input.jsonPretty : input.jsonText;
postChromeMessage("copy", value);
},
onSaveJson: function() {
var value = input.prettified ? input.jsonPretty : input.jsonText;
postChromeMessage("save", value);
},
onCopyHeaders: function() {
postChromeMessage("copy-headers", input.headers);
},
onSearch: function(value) {
theApp.setState({searchFilter: value});
},
onPrettify: function(data) {
if (input.prettified) {
theApp.setState({jsonText: input.jsonText});
} else {
if (!input.jsonPretty) {
input.jsonPretty = JSON.stringify(jsonData, null, " ");
}
theApp.setState({jsonText: input.jsonPretty});
}
input.prettified = !input.prettified;
},
}
/**
* Render the main application component. It's the main tab bar displayed
* at the top of the window. This component also represents ReacJS root.
*/
var content = document.getElementById("content");
var theApp = React.render(MainTabbedArea(input), content);
var onResize = event => {
window.document.body.style.height = window.innerHeight + "px";
window.document.body.style.width = window.innerWidth + "px";
}
window.addEventListener("resize", onResize);
onResize();
// Send notification event to the window. Can be useful for
// tests as well as extensions.
var event = new CustomEvent("JSONViewInitialized", {});
window.jsonViewInitialized = true;
window.dispatchEvent(event);
// End of json-viewer.js
});

Просмотреть файл

@ -1,9 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; 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/.
EXTRA_JS_MODULES.devtools.jsonview.lib += [
'require.js'
]

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,74 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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 { Cu, Ci, Cc } = require("chrome");
const JsonViewUtils = require("devtools/jsonview/utils");
Cu.import("resource://gre/modules/Services.jsm");
const { makeInfallible } = require("devtools/toolkit/DevToolsUtils.js");
const globalMessageManager = Cc["@mozilla.org/globalmessagemanager;1"].
getService(Ci.nsIMessageListenerManager);
const parentProcessMessageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"].
getService(Ci.nsIMessageBroadcaster);
// Constants
const JSON_VIEW_PREF = "devtools.jsonview.enabled";
/**
* Singleton object that represents the JSON View in-content tool.
* It has the same lifetime as the browser. Initialization done by
* DevTools() object from gDevTools.jsm
*/
var JsonView = {
initialize: makeInfallible(function() {
// Only the DevEdition has this feature available by default.
// Users need to manually flip 'devtools.jsonview.enabled' preference
// to have it available in other distributions.
if (Services.prefs.getBoolPref(JSON_VIEW_PREF)) {
// Load JSON converter module. This converter is responsible
// for handling 'application/json' documents and converting
// them into a simple web-app that allows easy inspection
// of the JSON data.
globalMessageManager.loadFrameScript(
"resource:///modules/devtools/jsonview/converter-child.js",
true);
this.onSaveListener = this.onSave.bind(this);
// Register for messages coming from the child process.
parentProcessMessageManager.addMessageListener(
"devtools:jsonview:save", this.onSaveListener);
}
}),
destroy: makeInfallible(function() {
if (this.onSaveListener) {
parentProcessMessageManager.removeMessageListener(
"devtools:jsonview:save", this.onSaveListener);
}
}),
// Message handlers for events from child processes
/**
* Save JSON to a file needs to be implemented here
* in the parent process.
*/
onSave: function(message) {
let value = message.data;
let file = JsonViewUtils.getTargetFile();
if (file) {
JsonViewUtils.saveToFile(file, value);
}
}
};
// Exports from this module
module.exports.JsonView = JsonView;

Просмотреть файл

@ -1,21 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; 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/.
DIRS += [
'components',
'css',
'lib'
]
EXTRA_JS_MODULES.devtools.jsonview += [
'converter-child.js',
'json-viewer.js',
'main.js',
'utils.js',
'viewer-config.js'
]
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

Просмотреть файл

@ -1 +0,0 @@
[{"name": "jan"},{"name": "honza"},{"name": "odvarko"}]

Просмотреть файл

@ -1 +0,0 @@
Content-Type: application/json; charset=utf-8

Просмотреть файл

@ -1,21 +0,0 @@
[DEFAULT]
tags = devtools
subsuite = devtools
support-files =
array_json.json
array_json.json^headers^
doc_frame_script.js
head.js
invalid_json.json
invalid_json.json^headers^
simple_json.json
simple_json.json^headers^
valid_json.json
valid_json.json^headers^
[browser_jsonview_copy_headers.js]
[browser_jsonview_copy_json.js]
[browser_jsonview_copy_rawdata.js]
[browser_jsonview_filter.js]
[browser_jsonview_invalid_json.js]
[browser_jsonview_valid_json.js]

Просмотреть файл

@ -1,35 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_JSON_URL = URL_ROOT + "valid_json.json";
add_task(function* () {
info("Test valid JSON started");
let tab = yield addJsonViewTab(TEST_JSON_URL);
// Select the RawData tab
yield selectJsonViewContentTab("headers");
// Check displayed headers
let count = yield getElementCount(".headersPanelBox .netHeadersGroup");
is(count, 2, "There must be two header groups");
let text = yield getElementText(".headersPanelBox .netInfoHeadersTable");
isnot(text, "", "Headers text must not be empty");
let browser = gBrowser.selectedBrowser
// Verify JSON copy into the clipboard.
yield waitForClipboardPromise(function setup() {
BrowserTestUtils.synthesizeMouseAtCenter(
".headersPanelBox .toolbar button.copy",
{}, browser);
}, function validator(value) {
return value.indexOf("application/json") > 0;
});
});

Просмотреть файл

@ -1,31 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_JSON_URL = URL_ROOT + "simple_json.json";
add_task(function* () {
info("Test copy JSON started");
let tab = yield addJsonViewTab(TEST_JSON_URL);
let countBefore = yield getElementCount(".jsonPanelBox .domTable .memberRow");
ok(countBefore == 1, "There must be one row");
let text = yield getElementText(".jsonPanelBox .domTable .memberRow");
is(text, "name\"value\"", "There must be proper JSON displayed");
// Verify JSON copy into the clipboard.
let value = "{\"name\": \"value\"}\n";
let browser = gBrowser.selectedBrowser
let selector = ".jsonPanelBox .toolbar button.copy";
yield waitForClipboardPromise(function setup() {
BrowserTestUtils.synthesizeMouseAtCenter(selector, {}, browser);
}, function validator(result) {
let str = normalizeNewLines(result);
return str == value;
});
});

Просмотреть файл

@ -1,52 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_JSON_URL = URL_ROOT + "simple_json.json";
let jsonText = "{\"name\": \"value\"}\n";
let prettyJson = "{\n \"name\": \"value\"\n}";
add_task(function* () {
info("Test copy raw data started");
let tab = yield addJsonViewTab(TEST_JSON_URL);
// Select the RawData tab
yield selectJsonViewContentTab("rawdata");
// Check displayed JSON
let text = yield getElementText(".textPanelBox .data");
is(text, jsonText, "Proper JSON must be displayed in DOM");
let browser = gBrowser.selectedBrowser
// Verify JSON copy into the clipboard.
yield waitForClipboardPromise(function setup() {
BrowserTestUtils.synthesizeMouseAtCenter(
".textPanelBox .toolbar button.copy",
{}, browser);
}, jsonText);
// Click 'Pretty Print' button
yield BrowserTestUtils.synthesizeMouseAtCenter(
".textPanelBox .toolbar button.prettyprint",
{}, browser);
let prettyText = yield getElementText(".textPanelBox .data");
prettyText = normalizeNewLines(prettyText);
ok(prettyText.startsWith(prettyJson), "Pretty printed JSON must be displayed");
// Verify JSON copy into the clipboard.
yield waitForClipboardPromise(function setup() {
BrowserTestUtils.synthesizeMouseAtCenter(
".textPanelBox .toolbar button.copy",
{}, browser);
}, function validator(value) {
let str = normalizeNewLines(value);
return str == prettyJson;
});
});

Просмотреть файл

@ -1,27 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_JSON_URL = URL_ROOT + "array_json.json";
add_task(function* () {
info("Test valid JSON started");
let tab = yield addJsonViewTab(TEST_JSON_URL);
let count = yield getElementCount(".jsonPanelBox .domTable .memberRow");
is(count, 3, "There must be three rows");
// XXX use proper shortcut to focus the filter box
// as soon as bug Bug 1178771 is fixed.
yield sendString("h", ".jsonPanelBox .searchBox");
// The filtering is done asynchronously so, we need to wait.
yield waitForFilter();
let hiddenCount = yield getElementCount(".jsonPanelBox .domTable .memberRow.hidden");
is(hiddenCount, 2, "There must be two hidden rows");
});

Просмотреть файл

@ -1,20 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_JSON_URL = URL_ROOT + "invalid_json.json";
add_task(function* () {
info("Test invalid JSON started");
let tab = yield addJsonViewTab(TEST_JSON_URL);
let count = yield getElementCount(".jsonPanelBox .domTable .memberRow");
ok(count == 0, "There must be no row");
let text = yield getElementText(".jsonPanelBox .jsonParseError");
ok(text, "There must be an error description");
});

Просмотреть файл

@ -1,22 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_JSON_URL = URL_ROOT + "valid_json.json";
add_task(function* () {
info("Test valid JSON started");
let tab = yield addJsonViewTab(TEST_JSON_URL);
let countBefore = yield getElementCount(".jsonPanelBox .domTable .memberRow");
ok(countBefore == 1, "There must be one row");
yield expandJsonNode(".jsonPanelBox .domTable .memberLabel");
let countAfter = yield getElementCount(".jsonPanelBox .domTable .memberRow");
ok(countAfter == 3, "There must be three rows");
});

Просмотреть файл

@ -1,89 +0,0 @@
/* 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/ */
"use strict";
// XXX Some helper API could go to testing/mochitest/tests/SimpleTest/AsyncContentUtils.js
// (or at least to share test API in devtools)
// Set up a dummy environment so that EventUtils works. We need to be careful to
// pass a window object into each EventUtils method we call rather than having
// it rely on the |window| global.
let EventUtils = {};
EventUtils.window = content;
EventUtils.parent = EventUtils.window;
EventUtils._EU_Ci = Components.interfaces;
EventUtils._EU_Cc = Components.classes;
EventUtils.navigator = content.navigator;
EventUtils.KeyboardEvent = content.KeyboardEvent;
Services.scriptloader.loadSubScript(
"chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
/**
* When the JSON View is done rendering it triggers custom event
* "JSONViewInitialized", then the Test:TestPageProcessingDone message
* will be sent to the parent process for tests to wait for this event
* if needed.
*/
content.addEventListener("JSONViewInitialized", () => {
sendAsyncMessage("Test:JsonView:JSONViewInitialized");
}, false);
addMessageListener("Test:JsonView:GetElementCount", function(msg) {
let {selector} = msg.data;
let nodeList = content.document.querySelectorAll(selector);
sendAsyncMessage(msg.name, {count: nodeList.length});
});
addMessageListener("Test:JsonView:GetElementText", function(msg) {
let {selector} = msg.data;
let element = content.document.querySelector(selector);
let text = element ? element.textContent : null;
sendAsyncMessage(msg.name, {text: text});
});
addMessageListener("Test:JsonView:FocusElement", function(msg) {
let {selector} = msg.data;
let element = content.document.querySelector(selector);
if (element) {
element.focus();
}
sendAsyncMessage(msg.name);
});
addMessageListener("Test:JsonView:SendString", function(msg) {
let {selector, str} = msg.data;
if (selector) {
let element = content.document.querySelector(selector);
if (element) {
element.focus();
}
}
EventUtils.sendString(str, content);
sendAsyncMessage(msg.name);
});
addMessageListener("Test:JsonView:WaitForFilter", function(msg) {
let firstRow = content.document.querySelector(
".jsonPanelBox .domTable .memberRow");
// Wait till the first row has 'hidden' class set.
var observer = new content.MutationObserver(function(mutations) {
for (let i = 0; i < mutations.length; i++) {
let mutation = mutations[i];
if (mutation.attributeName == "class") {
if (firstRow.classList.contains("hidden")) {
observer.disconnect();
sendAsyncMessage(msg.name);
break;
}
}
}
});
observer.observe(firstRow, { attributes: true });
});

Просмотреть файл

@ -1,137 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// shared-head.js handles imports, constants, and utility functions
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/browser/devtools/framework/test/head.js", this);
// XXX move some API into devtools/framework/test/shared-head.js
/**
* Add a new test tab in the browser and load the given url.
* @param {String} url The url to be loaded in the new tab
* @return a promise that resolves to the tab object when the url is loaded
*/
function addJsonViewTab(url) {
info("Adding a new JSON tab with URL: '" + url + "'");
let deferred = promise.defer();
addTab(url).then(tab => {
let browser = tab.linkedBrowser;
// Load devtools/shared/frame-script-utils.js
getFrameScript();
// Load frame script with helpers for JSON View tests.
let rootDir = getRootDirectory(gTestPath);
let frameScriptUrl = rootDir + "doc_frame_script.js";
browser.messageManager.loadFrameScript(frameScriptUrl, false);
// Resolve if the JSONView is fully loaded or wait
// for an initialization event.
if (content.window.wrappedJSObject.jsonViewInitialized) {
deferred.resolve(tab);
} else {
waitForContentMessage("Test:JsonView:JSONViewInitialized").then(() => {
deferred.resolve(tab);
});
}
});
return deferred.promise;
}
/**
* Expanding a node in the JSON tree
*/
function expandJsonNode(selector) {
info("Expanding node: '" + selector + "'");
let browser = gBrowser.selectedBrowser;
return BrowserTestUtils.synthesizeMouseAtCenter(selector, {}, browser);
}
/**
* Select JSON View tab (in the content).
*/
function selectJsonViewContentTab(name) {
info("Selecting tab: '" + name + "'");
let browser = gBrowser.selectedBrowser;
let selector = ".tabs-menu .tabs-menu-item." + name + " a";
return BrowserTestUtils.synthesizeMouseAtCenter(selector, {}, browser);
}
function getElementCount(selector) {
info("Get element count: '" + selector + "'");
let data = {
selector: selector
};
return executeInContent("Test:JsonView:GetElementCount", data).then(result => {
return result.count;
});
}
function getElementText(selector) {
info("Get element text: '" + selector + "'");
let data = {
selector: selector
};
return executeInContent("Test:JsonView:GetElementText", data).then(result => {
return result.text;
});
}
function focusElement(selector) {
info("Focus element: '" + selector + "'");
let data = {
selector: selector
};
return executeInContent("Test:JsonView:FocusElement", data);
}
/**
* Send the string aStr to the focused element.
*
* For now this method only works for ASCII characters and emulates the shift
* key state on US keyboard layout.
*/
function sendString(str, selector) {
info("Send string: '" + str + "'");
let data = {
selector: selector,
str: str
};
return executeInContent("Test:JsonView:SendString", data);
}
function waitForTime(aDelay) {
let deferred = promise.defer();
setTimeout(deferred.resolve, aDelay);
return deferred.promise;
}
function waitForClipboardPromise(setup, expected) {
return new Promise((resolve, reject) => {
SimpleTest.waitForClipboard(expected, setup, resolve, reject);
});
}
function waitForFilter() {
return executeInContent("Test:JsonView:WaitForFilter");
}
function normalizeNewLines(value) {
return value.replace("(\r\n|\n)", "\n");
}

Просмотреть файл

@ -1 +0,0 @@
{,}

Просмотреть файл

@ -1 +0,0 @@
Content-Type: application/json; charset=utf-8

Просмотреть файл

@ -1 +0,0 @@
{"name": "value"}

Просмотреть файл

@ -1 +0,0 @@
Content-Type: application/json; charset=utf-8

Просмотреть файл

@ -1,6 +0,0 @@
{
"family": {
"father": "John Doe",
"mother": "Alice Doe"
}
}

Просмотреть файл

@ -1 +0,0 @@
Content-Type: application/json; charset=utf-8

Просмотреть файл

@ -1,100 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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 {Cu, Cc, Ci} = require("chrome");
const {getMostRecentBrowserWindow} = require("sdk/window/utils");
const OPEN_FLAGS = {
RDONLY: parseInt("0x01"),
WRONLY: parseInt("0x02"),
CREATE_FILE: parseInt("0x08"),
APPEND: parseInt("0x10"),
TRUNCATE: parseInt("0x20"),
EXCL: parseInt("0x80")
};
/**
* Open File Save As dialog and let the user to pick proper file location.
*/
exports.getTargetFile = function() {
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
var win = getMostRecentBrowserWindow();
fp.init(win, null, Ci.nsIFilePicker.modeSave);
fp.appendFilter("JSON Files","*.json; *.jsonp;");
fp.appendFilters(Ci.nsIFilePicker.filterText);
fp.appendFilters(Ci.nsIFilePicker.filterAll);
fp.filterIndex = 0;
var rv = fp.show();
if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
return fp.file;
}
return null;
}
/**
* Save JSON to a file
*/
exports.saveToFile = function(file, jsonString) {
var foStream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
// write, create, truncate
let openFlags = OPEN_FLAGS.WRONLY | OPEN_FLAGS.CREATE_FILE |
OPEN_FLAGS.TRUNCATE;
let permFlags = parseInt("0666", 8);
foStream.init(file, openFlags, permFlags, 0);
var converter = Cc["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Ci.nsIConverterOutputStream);
converter.init(foStream, "UTF-8", 0, 0);
// The entire jsonString can be huge so, write the data in chunks.
var chunkLength = 1024*1204;
for (var i=0; i<=jsonString.length; i++) {
var data = jsonString.substr(i, chunkLength+1);
if (data) {
converter.writeString(data);
}
i = i + chunkLength;
}
// this closes foStream
converter.close();
}
/**
* Get the current theme from preferences.
*/
exports.getCurrentTheme = function() {
return Services.prefs.getCharPref("devtools.theme");
}
/**
* Export given object into the target window scope.
*/
exports.exportIntoContentScope = function(win, obj, defineAs) {
var clone = Cu.createObjectIn(win, {
defineAs: defineAs
});
var props = Object.getOwnPropertyNames(obj);
for (var i=0; i<props.length; i++) {
var propName = props[i];
var propValue = obj[propName];
if (typeof propValue == "function") {
Cu.exportFunction(propValue, clone, {
defineAs: propName
});
}
}
}

Просмотреть файл

@ -1,31 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* 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/. */
/**
* RequireJS configuration for JSON Viewer.
*
* ReactJS library is shared among DevTools. Both, the minified (production)
* version and developer versions of the library are available.
*
* In order to use the developer version you need to specify the following
* in your .mozconfig (see also bug 1181646):
* ac_add_options --enable-debug-js-modules
*
* The path mapping uses paths fallback (a feature supported by RequireJS)
* See also: http://requirejs.org/docs/api.html#pathsfallbacks
*/
require.config({
baseUrl: ".",
paths: {
"react": [
"resource:///modules/devtools/shared/content/react-dev",
"resource:///modules/devtools/shared/content/react"
]
}
});
// Load the main panel module
requirejs(["json-viewer"]);

Просмотреть файл

@ -14,7 +14,6 @@ DIRS += [
'fontinspector',
'framework',
'inspector',
'jsonview',
'layoutview',
'markupview',
'netmonitor',

Просмотреть файл

@ -28,7 +28,6 @@ user_pref("javascript.options.showInConsole", true);
user_pref("devtools.browsertoolbox.panel", "jsdebugger");
user_pref("devtools.errorconsole.enabled", true);
user_pref("devtools.debugger.remote-port", 6023);
user_pref("devtools.jsonview.enabled", true);
user_pref("layout.debug.enable_data_xbl", true);
user_pref("browser.EULA.override", true);
user_pref("gfx.color_management.force_srgb", true);