Backed out changeset f80643f3c767 (bug 1201475) for test failures in dt1 tests on a CLOSED TREE

--HG--
extra : rebase_source : a9e9b15a33b443986220cc274134009a19013818
This commit is contained in:
Carsten "Tomcat" Book 2016-04-21 14:26:57 +02:00
Родитель 4193c6737d
Коммит 9292556dcd
55 изменённых файлов: 41 добавлений и 2951 удалений

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

@ -23,7 +23,6 @@ loader.lazyGetter(this, "PerformancePanel", () => require("devtools/client/perfo
loader.lazyGetter(this, "NetMonitorPanel", () => require("devtools/client/netmonitor/panel").NetMonitorPanel);
loader.lazyGetter(this, "StoragePanel", () => require("devtools/client/storage/panel").StoragePanel);
loader.lazyGetter(this, "ScratchpadPanel", () => require("devtools/client/scratchpad/scratchpad-panel").ScratchpadPanel);
loader.lazyGetter(this, "DomPanel", () => require("devtools/client/dom/dom-panel").DomPanel);
// Strings
const toolboxProps = "chrome://devtools/locale/toolbox.properties";
@ -39,7 +38,6 @@ const netMonitorProps = "chrome://devtools/locale/netmonitor.properties";
const storageProps = "chrome://devtools/locale/storage.properties";
const scratchpadProps = "chrome://devtools/locale/scratchpad.properties";
const memoryProps = "chrome://devtools/locale/memory.properties";
const domProps = "chrome://devtools/locale/dom.properties";
loader.lazyGetter(this, "toolboxStrings", () => Services.strings.createBundle(toolboxProps));
loader.lazyGetter(this, "performanceStrings", () => Services.strings.createBundle(performanceProps));
@ -54,7 +52,6 @@ loader.lazyGetter(this, "netMonitorStrings", () => Services.strings.createBundle
loader.lazyGetter(this, "storageStrings", () => Services.strings.createBundle(storageProps));
loader.lazyGetter(this, "scratchpadStrings", () => Services.strings.createBundle(scratchpadProps));
loader.lazyGetter(this, "memoryStrings", () => Services.strings.createBundle(memoryProps));
loader.lazyGetter(this, "domStrings", () => Services.strings.createBundle(domProps));
var Tools = {};
exports.Tools = Tools;
@ -400,33 +397,6 @@ Tools.scratchpad = {
}
};
Tools.dom = {
id: "dom",
accesskey: l10n("dom.accesskey", domStrings),
key: l10n("dom.commandkey", domStrings),
ordinal: 13,
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
visibilityswitch: "devtools.dom.enabled",
icon: "chrome://devtools/skin/images/tool-dom.svg",
invertIconForLightTheme: true,
url: "chrome://devtools/content/dom/dom.html",
label: l10n("dom.label", domStrings),
panelLabel: l10n("dom.panelLabel", domStrings),
get tooltip() {
return l10n("dom.tooltip", domStrings,
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
},
inMenu: true,
isTargetSupported: function(target) {
return target.getTrait("webConsoleCommands");
},
build: function(iframeWindow, toolbox) {
return new DomPanel(iframeWindow, toolbox);
}
};
var defaultTools = [
Tools.options,
Tools.webConsole,
@ -441,7 +411,6 @@ var defaultTools = [
Tools.storage,
Tools.scratchpad,
Tools.memory,
Tools.dom,
];
exports.defaultTools = defaultTools;

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

@ -1,15 +0,0 @@
{
"globals": {
"XMLHttpRequest": true,
"window": true,
"define": true,
"addEventListener": true,
"document": true,
"dispatchEvent": true,
"MessageEvent": true
},
"rules": {
"indent": 0,
"padded-blocks": 0,
}
}

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

@ -1,21 +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 constants = require("../constants");
/**
* Used to filter DOM panel content.
*/
function setVisibilityFilter(filter) {
return {
filter: filter,
type: constants.SET_VISIBILITY_FILTER,
};
}
// Exports from this module
exports.setVisibilityFilter = setVisibilityFilter;

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

@ -1,54 +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/. */
/* globals DomProvider */
"use strict";
const constants = require("../constants");
/**
* Used to fetch grip prototype and properties from the backend.
*/
function requestProperties(grip) {
return {
grip: grip,
type: constants.FETCH_PROPERTIES,
status: "start",
error: false
};
}
/**
* Executed when grip properties are received from the backend.
*/
function receiveProperties(grip, response, error) {
return {
grip: grip,
type: constants.FETCH_PROPERTIES,
status: "end",
response: response,
error: error
};
}
/**
* Used to get properties from the backend and fire an action
* when they are received.
*/
function fetchProperties(grip) {
return dispatch => {
// dispatch(requestProperties(grip));
// Use 'DomProvider' object exposed from the chrome scope.
return DomProvider.getPrototypeAndProperties(grip).then(response => {
dispatch(receiveProperties(grip, response));
});
};
}
// Exports from this module
exports.requestProperties = requestProperties;
exports.receiveProperties = receiveProperties;
exports.fetchProperties = fetchProperties;

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

@ -1,9 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'filter.js',
'grips.js',
)

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

@ -1,90 +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";
// React & Redux
const React = require("devtools/client/shared/vendor/react");
const { connect } = require("devtools/client/shared/vendor/react-redux");
// Reps
const { createFactories } = require("devtools/client/shared/components/reps/rep-utils");
const TreeView = React.createFactory(require("devtools/client/shared/components/tree/tree-view"));
const { Rep } = createFactories(require("devtools/client/shared/components/reps/rep"));
const { Grip } = require("devtools/client/shared/components/reps/grip");
// DOM Panel
const { GripProvider } = require("../grip-provider");
const { DomDecorator } = require("../dom-decorator");
// Shortcuts
const PropTypes = React.PropTypes;
/**
* Renders DOM panel tree.
*/
var DomTree = React.createClass({
propTypes: {
object: PropTypes.any,
filter: PropTypes.string,
dispatch: PropTypes.func.isRequired,
grips: PropTypes.object,
},
displayName: "DomTree",
/**
* Filter DOM properties. Return true if the object
* should be visible in the tree.
*/
onFilter: function(object) {
if (!this.props.filter) {
return true;
}
return (object.name && object.name.indexOf(this.props.filter) > -1);
},
/**
* Render DOM panel content
*/
render: function() {
let columns = [{
"id": "value"
}];
// This is the integration point with Reps. The DomTree is using
// Reps to render all values. The code also specifies default rep
// used for data types that don't have its own specific template.
let renderValue = props => {
return Rep(Object.assign({}, props, {
defaultRep: Grip,
}));
};
return (
TreeView({
object: this.props.object,
provider: new GripProvider(this.props.grips, this.props.dispatch),
decorator: new DomDecorator(),
mode: "short",
columns: columns,
renderValue: renderValue,
onFilter: this.onFilter
})
);
}
});
const mapStateToProps = (state) => {
return {
grips: state.grips,
filter: state.filter
};
};
// Exports from this module
module.exports = connect(mapStateToProps)(DomTree);

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

@ -1,60 +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";
// React & Redux
const React = require("devtools/client/shared/vendor/react");
const { connect } = require("devtools/client/shared/vendor/react-redux");
// DOM Panel
const DomTree = React.createFactory(require("./dom-tree"));
const MainToolbar = React.createFactory(require("./main-toolbar"));
// Shortcuts
const { div } = React.DOM;
const PropTypes = React.PropTypes;
/**
* Renders basic layout of the DOM panel. The DOM panel cotent consists
* from two main parts: toolbar and tree.
*/
var MainFrame = React.createClass({
propTypes: {
object: PropTypes.any,
filter: PropTypes.string,
dispatch: PropTypes.func.isRequired,
},
displayName: "MainFrame",
/**
* Render DOM panel content
*/
render: function() {
return (
div({className: "mainFrame"},
MainToolbar({
dispatch: this.props.dispatch
}),
DomTree({
object: this.props.object,
filter: this.props.filter,
})
)
);
}
});
// Transform state into props
// Note: use https://github.com/faassen/reselect for better performance.
const mapStateToProps = (state) => {
return {
filter: state.filter
};
};
// Exports from this module
module.exports = connect(mapStateToProps)(MainFrame);

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

@ -1,63 +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";
// React
const React = require("devtools/client/shared/vendor/react");
const { l10n } = require("../utils");
// Reps
const { createFactories } = require("devtools/client/shared/components/reps/rep-utils");
const { Toolbar, ToolbarButton } = createFactories(require("devtools/client/jsonview/components/reps/toolbar"));
// DOM Panel
const SearchBox = React.createFactory(require("../components/search-box"));
// Actions
const { fetchProperties } = require("../actions/grips");
const { setVisibilityFilter } = require("../actions/filter");
// Shortcuts
const PropTypes = React.PropTypes;
/**
* This template is responsible for rendering a toolbar
* within the 'Headers' panel.
*/
var MainToolbar = React.createClass({
propTypes: {
object: PropTypes.any,
dispatch: PropTypes.func.isRequired,
},
displayName: "MainToolbar",
onRefresh: function() {
this.props.dispatch(fetchProperties(this.props.object));
},
onSearch: function(value) {
this.props.dispatch(setVisibilityFilter(value));
},
render: function() {
return (
Toolbar({},
ToolbarButton({
className: "btn copy",
onClick: this.onRefresh},
l10n.getStr("dom.refresh")
),
SearchBox({
onSearch: this.onSearch
})
)
);
}
});
// Exports from this module
module.exports = MainToolbar;

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

@ -1,13 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'dom-tree.js',
'main-frame.js',
'main-toolbar.js',
'search-box.css',
'search-box.js',
'search.svg',
)

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

@ -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;
float: right;
background-image: url("./search.svg");
background-repeat: no-repeat;
background-position: 2px center;
padding-left: 20px;
margin-right: 5px;
}
/******************************************************************************/
/* Light Theme & Dark Theme*/
.theme-dark .searchBox,
.theme-light .searchBox {
border: 1px solid rgb(170, 170, 170);
background-image: url("chrome://devtools/skin/images/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://devtools/skin/images/magnifying-glass.png");
}

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

@ -1,65 +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 React = require("devtools/client/shared/vendor/react");
const { l10n } = require("../utils");
// For smooth incremental searching (in case the user is typing quickly).
const searchDelay = 250;
// Shortcuts
const { input } = React.DOM;
const PropTypes = React.PropTypes;
/**
* This object represents a search box located at the
* top right corner of the application.
*/
var SearchBox = React.createClass({
propTypes: {
onSearch: PropTypes.func,
},
displayName: "SearchBox",
componentWillUnmount: function() {
// Clean up an existing timeout.
if (this.searchTimeout) {
window.clearTimeout(this.searchTimeout);
}
},
onSearch: function(event) {
let searchBox = event.target;
// Clean up an existing timeout before creating a new one.
if (this.searchTimeout) {
window.clearTimeout(this.searchTimeout);
}
// Execute the search after a timeout. It makes the UX
// smoother if the user is typing quickly.
this.searchTimeout = window.setTimeout(() => {
this.searchTimeout = null;
this.props.onSearch(searchBox.value);
}, searchDelay);
},
render: function() {
return (
input({
className: "searchBox",
placeholder: l10n.getStr("dom.filterDOMPanel"),
onChange: this.onSearch
})
);
}
});
// Exports from this module
module.exports = SearchBox;

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

@ -1,22 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a">
<stop offset="0" stop-color="#427dc2"/>
<stop offset="1" stop-color="#5e9fce"/>
</linearGradient>
<linearGradient id="b">
<stop offset="0" stop-color="#2f5d93"/>
<stop offset="1" stop-color="#3a87bd"/>
</linearGradient>
<filter id="c" width="1.239" height="1.241" x="-.12" y="-.12" color-interpolation-filters="sRGB">
<feGaussianBlur stdDeviation=".637"/>
</filter>
<linearGradient id="d" x1="4.094" x2="4.094" y1="13.423" y2="2.743" xlink:href="#a" gradientUnits="userSpaceOnUse"/>
<linearGradient id="e" x1="8.711" x2="8.711" y1="13.58" y2="2.566" xlink:href="#b" gradientUnits="userSpaceOnUse"/>
</defs>
<path fill="#fff" stroke="#fff" stroke-width="1.5" d="M10.14 1.656c-2.35 0-4.25 1.9-4.25 4.25 0 .752.19 1.45.532 2.063L1.61 12.78l1.562 1.564 4.78-4.78c.64.384 1.387.592 2.19.592 2.35 0 4.25-1.9 4.25-4.25s-1.9-4.25-4.25-4.25zm0 1.532c1.504 0 2.72 1.214 2.72 2.718s-1.216 2.72-2.72 2.72c-1.503 0-2.718-1.216-2.718-2.72 0-1.504 1.215-2.718 2.72-2.718z" stroke-linejoin="round" filter="url(#c)"/>
<path fill="url(#d)" stroke="url(#e)" stroke-width=".6" d="M10 2C7.79 2 6 3.79 6 6c0 .828.256 1.612.688 2.25l-4.875 4.875 1.062 1.063L7.75 9.31C8.388 9.745 9.172 10 10 10c2.21 0 4-1.79 4-4s-1.79-4-4-4zm0 1c1.657 0 3 1.343 3 3s-1.343 3-3 3-3-1.343-3-3 1.343-3 3-3z" stroke-linejoin="round"/>
</svg>

До

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

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

@ -1,9 +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";
exports.FETCH_PROPERTIES = "FETCH_PROPERTIES";
exports.SET_VISIBILITY_FILTER = "SET_VISIBILITY_FILTER";

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

@ -1,48 +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 { Property } = require("./reducers/grips");
// Implementation
function DomDecorator() {
}
/**
* Decorator for DOM panel tree component. It's responsible for
* appending an icon to read only properties.
*/
DomDecorator.prototype = {
getRowClass: function(object) {
if (object instanceof Property) {
let value = object.value;
let names = [];
if (value.enumerable) {
names.push("enumerable");
}
if (value.writable) {
names.push("writable");
}
if (value.configurable) {
names.push("configurable");
}
return names;
}
},
/**
* Return custom React template for specified object. The template
* might depend on specified column.
*/
getValueRep: function(value, colId) {
}
};
// Exports from this module
exports.DomDecorator = DomDecorator;

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

@ -1,111 +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 {
padding: 0;
margin: 0;
height: 100%;
}
/******************************************************************************/
/* TreeView Customization */
.treeTable {
width: 100%;
}
/* Space for read only properties icon */
.treeTable td.treeValueCell {
padding-left: 16px;
}
/* Read only properties have a padlock icon */
.treeTable tr:not(.writable) td.treeValueCell {
background: url("chrome://devtools/skin/images/firebug/read-only.svg") no-repeat;
background-position: 1px 5px;
background-size: 10px 10px;
}
/* Non-enumerable properties are grayed out */
.treeTable tr:not(.enumerable) td.treeValueCell {
opacity: 0.7;
}
.treeTable > tbody > tr > td {
border-bottom: 1px solid #EFEFEF;
}
/* Label Types */
.treeTable .userLabel,
.treeTable .userClassLabel,
.treeTable .userFunctionLabel {
font-weight: bold;
}
.treeTable .userLabel {
color: #000000;
}
.treeTable .userClassLabel {
color: #E90000;
}
.treeTable .userFunctionLabel {
color: #025E2A;
}
.treeTable .domLabel {
color: #000000;
}
.treeTable .domClassLabel {
color: #E90000;
}
.treeTable .domFunctionLabel {
color: #025E2A;
}
.treeTable .ordinalLabel {
color: SlateBlue;
font-weight: bold;
}
/******************************************************************************/
/* Selection */
.treeTable .treeRow:hover a,
.treeTable .treeRow:hover span {
color: var(--theme-selection-color) !important;
}
/******************************************************************************/
/* Toolbar */
.toolbar {
position: fixed;
width: 100%;
top: 0;
z-index: 2;
}
.treeTable {
z-index: 1;
margin-top: 25px;
}
/******************************************************************************/
/* Theme Dark */
.theme-dark .treeTable > tbody > tr > td {
border-bottom: none;
}
.theme-dark body {
background-color: var(--theme-body-background);
}

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

@ -1,58 +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";
// React & Redux
const React = require("devtools/client/shared/vendor/react");
const ReactDOM = require("devtools/client/shared/vendor/react-dom");
const { Provider } = require("devtools/client/shared/vendor/react-redux");
const { combineReducers } = require("devtools/client/shared/vendor/redux");
// DOM Panel
const MainFrame = React.createFactory(require("./components/main-frame"));
// Store
const createStore = require("devtools/client/shared/redux/create-store")({
log: false
});
const { reducers } = require("./reducers/index");
const store = createStore(combineReducers(reducers));
/**
* This object represents view of the DOM panel and is responsible
* for rendering the content. It renders the top level ReactJS
* component: the MainFrame.
*/
function DomView() {
addEventListener("devtools/chrome/message",
this.onMessage.bind(this), true);
}
DomView.prototype = {
initialize: function(rootGrip) {
let content = document.querySelector("#content");
let mainFrame = MainFrame({
object: rootGrip,
});
// Render top level component
let provider = React.createElement(Provider, {store: store}, mainFrame);
this.mainFrame = ReactDOM.render(provider, content);
},
onMessage: function(event) {
let data = event.data;
let method = data.type;
if (typeof this[method] == "function") {
this[method](data.args);
}
},
};
// Construct DOM panel view object.
new DomView();

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

@ -1,99 +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 { fetchProperties } = require("./actions/grips");
const { Property } = require("./reducers/grips");
// Implementation
function GripProvider(grips, dispatch) {
this.grips = grips;
this.dispatch = dispatch;
}
/**
* This object provides data for the tree displayed in the tooltip
* content.
*/
GripProvider.prototype = {
/**
* Fetches properties from the backend. These properties might be
* displayed as child objects in e.g. a tree UI widget.
*/
getChildren: function(object) {
let grip = object;
if (object instanceof Property) {
grip = this.getValue(object);
}
if (!grip || !grip.actor) {
return [];
}
let props = this.grips.get(grip.actor);
if (!props) {
// Fetch missing data from the backend. Returning a promise
// from data provider causes the tree to show a spinner.
return this.dispatch(fetchProperties(grip));
}
return props;
},
hasChildren: function(object) {
if (object instanceof Property) {
let value = this.getValue(object);
if (!value) {
return false;
}
let hasChildren = value.ownPropertyLength > 0;
if (value.preview) {
hasChildren = hasChildren || value.preview.ownPropertiesLength > 0;
}
if (value.preview) {
let preview = value.preview;
let k = preview.kind;
let objectsWithProps = ["DOMNode", "ObjectWithURL"];
hasChildren = hasChildren || (objectsWithProps.indexOf(k) != -1);
hasChildren = hasChildren || (k == "ArrayLike" && preview.length > 0);
}
return (value.type == "object" && hasChildren);
}
},
getValue: function(object) {
if (object instanceof Property) {
let value = object.value;
return (typeof value.value != "undefined") ? value.value :
value.getterValue;
}
return object;
},
getLabel: function(object) {
if (object instanceof Property) {
return object.name;
}
},
getKey: function(object) {
if (object instanceof Property) {
return object.key;
}
},
getType: function(object) {
return object.class ? object.class : "";
},
};
// Exports from this module
exports.GripProvider = GripProvider;

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

@ -1,19 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [
'actions',
'components',
'reducers',
]
DevToolsModules(
'constants.js',
'dom-decorator.js',
'dom-view.css',
'dom-view.js',
'grip-provider.js',
'utils.js',
)

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

@ -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";
const constants = require("../constants");
/**
* Initial state definition
*/
function getInitialState() {
return "";
}
/**
* Filter displayed object properties.
*/
function filter(state = getInitialState(), action) {
if (action.type == constants.SET_VISIBILITY_FILTER) {
return action.filter;
}
return state;
}
// Exports from this module
exports.filter = filter;

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

@ -1,110 +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 constants = require("../constants");
/**
* Initial state definition
*/
function getInitialState() {
return new Map();
}
/**
* Maintain a cache of received grip responses from the backend.
*/
function grips(state = getInitialState(), action) {
// This reducer supports only one action, fetching actor properties
// from the backend so, bail out if we are dealing with any other
// action.
if (action.type != constants.FETCH_PROPERTIES) {
return state;
}
switch (action.status) {
case "start":
return onRequestProperties(state, action);
case "end":
return onReceiveProperties(state, action);
}
return state;
}
/**
* Handle requestProperties action
*/
function onRequestProperties(state, action) {
return state;
}
/**
* Handle receiveProperties action
*/
function onReceiveProperties(cache, action) {
let response = action.response;
let from = response.from;
// Properly deal with getters.
mergeProperties(response);
// Compute list of requested children.
let ownProps = response.ownProperties || response.preview.ownProperties || [];
let props = Object.keys(ownProps).map(key => {
return new Property(key, ownProps[key], key);
});
props.sort(sortName);
// Return new state/map.
let newCache = new Map(cache);
newCache.set(from, props);
return newCache;
}
// Helpers
function mergeProperties(response) {
let { ownProperties } = response;
// 'safeGetterValues' is new and isn't necessary defined on old grips.
let safeGetterValues = response.safeGetterValues || {};
// Merge the safe getter values into one object such that we can use it
// in variablesView.
for (let name of Object.keys(safeGetterValues)) {
if (name in ownProperties) {
let { getterValue, getterPrototypeLevel } = safeGetterValues[name];
ownProperties[name].getterValue = getterValue;
ownProperties[name].getterPrototypeLevel = getterPrototypeLevel;
} else {
ownProperties[name] = safeGetterValues[name];
}
}
}
function sortName(a, b) {
// Display non-enumerable properties at the end.
if (!a.value.enumerable && b.value.enumerable) {
return 1;
}
if (a.value.enumerable && !b.value.enumerable) {
return -1;
}
return a.name > b.name ? 1 : -1;
}
function Property(name, value, key) {
this.name = name;
this.value = value;
this.key = key;
}
// Exports from this module
exports.grips = grips;
exports.Property = Property;

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

@ -1,14 +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 { grips } = require("./grips");
const { filter } = require("./filter");
exports.reducers = {
grips,
filter,
};

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

@ -1,10 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'filter.js',
'grips.js',
'index.js',
)

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

@ -1,27 +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";
/**
* The default localization just returns the last part of the key
* (all after the last dot).
*/
const DefaultL10N = {
getStr: function(key) {
let index = key.lastIndexOf(".");
return key.substr(index + 1);
}
};
/**
* The 'l10n' object is set by main.js in case the DOM panel content
* runs within a scope with chrome privileges.
*
* Note that DOM panel content can also run within a scope with no chrome
* privileges, e.g. in an iframe with type 'content' or in a browser tab,
* which allows using our own tools for development.
*/
exports.l10n = window.l10n || DefaultL10N;

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

@ -1,188 +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 } = require("chrome");
const { defer } = require("sdk/core/promise");
const { ObjectClient } = require("devtools/shared/client/main");
const promise = require("promise");
const EventEmitter = require("devtools/shared/event-emitter");
/**
* This object represents DOM panel. It's responsibility is to
* render Document Object Model of the current debugger target.
*/
function DomPanel(iframeWindow, toolbox) {
this.panelWin = iframeWindow;
this._toolbox = toolbox;
this.onTabNavigated = this.onTabNavigated.bind(this);
this.onContentMessage = this.onContentMessage.bind(this);
EventEmitter.decorate(this);
}
DomPanel.prototype = {
/**
* Open is effectively an asynchronous constructor.
*
* @return object
* A promise that is resolved when the DOM panel completes opening.
*/
open: Task.async(function*() {
if (this._opening) {
return this._opening;
}
let deferred = promise.defer();
this._opening = deferred.promise;
// Local monitoring needs to make the target remote.
if (!this.target.isRemote) {
yield this.target.makeRemote();
}
this.initialize();
this.isReady = true;
this.emit("ready");
deferred.resolve(this);
return this._opening;
}),
// Initialization
initialize: function() {
this.panelWin.addEventListener("devtools/content/message",
this.onContentMessage, true);
this.target.on("navigate", this.onTabNavigated);
let provider = {
getPrototypeAndProperties: this.getPrototypeAndProperties.bind(this)
};
exportIntoContentScope(this.panelWin, provider, "DomProvider");
this.doRefresh();
},
destroy: Task.async(function*() {
if (this._destroying) {
return this._destroying;
}
let deferred = promise.defer();
this._destroying = deferred.promise;
this.target.off("navigate", this.onTabNavigated);
this.emit("destroyed");
deferred.resolve();
return this._destroying;
}),
// Events
doRefresh: function() {
this.refresh().then(rootGrip => {
this.postContentMessage("initialize", rootGrip);
});
},
onTabNavigated: function() {
this.doRefresh();
},
getPrototypeAndProperties: function(grip) {
let deferred = defer();
if (!grip.actor) {
console.error("No actor!", grip);
deferred.reject(new Error("Failed to get actor from grip."));
return deferred.promise;
}
if (!this.target) {
console.error("No target!", grip);
deferred.reject(new Error("Failed to get debugger target."));
return deferred.promise;
}
let client = new ObjectClient(this.target.client, grip);
client.getPrototypeAndProperties(deferred.resolve);
return deferred.promise;
},
// Refresh
refresh: function() {
let deferred = defer();
// Attach Console. It might involve RDP communication, so wait
// asynchronously for the result
this.target.activeConsole.evaluateJSAsync("window", res => {
deferred.resolve(res.result);
});
return deferred.promise;
},
// Helpers
postContentMessage: function(type, args) {
let data = {
type: type,
args: args,
};
let event = new this.panelWin.MessageEvent("devtools/chrome/message", {
bubbles: true,
cancelable: true,
data: data,
});
this.panelWin.dispatchEvent(event);
},
onContentMessage: function(event) {
let data = event.data;
let method = data.type;
if (typeof this[method] == "function") {
this[method](data.args);
}
},
get target() {
return this._toolbox.target;
},
};
// Helpers
function exportIntoContentScope(win, obj, defineAs) {
let clone = Cu.createObjectIn(win, {
defineAs: defineAs
});
let props = Object.getOwnPropertyNames(obj);
for (let i = 0; i < props.length; i++) {
let propName = props[i];
let propValue = obj[propName];
if (typeof propValue == "function") {
Cu.exportFunction(propValue, clone, {
defineAs: propName
});
}
}
}
// Exports from this module
exports.DomPanel = DomPanel;

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

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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/. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link href="resource://devtools/client/dom/content/dom-view.css" rel="stylesheet" />
<link href="resource://devtools/client/jsonview/css/toolbar.css" rel="stylesheet" />
<link href="resource://devtools/client/shared/components/tree/tree-view.css" rel="stylesheet" />
<link href="resource://devtools/client/dom/content/components/search-box.css" rel="stylesheet" />
<script type="text/javascript;version=1.8"
src="chrome://devtools/content/shared/theme-switching.js"></script>
</head>
<body class="theme-body devtools-monospace" role="application">
<div id="content"></div>
<script type="text/javascript" src="./main.js"></script>
</body>
</html>

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

@ -1,26 +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 { utils: Cu } = Components;
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
const { BrowserLoader } = Cu.import("resource://devtools/client/shared/browser-loader.js", {});
// Module Loader
const require = BrowserLoader({
baseURI: "resource://devtools/client/dom/",
window: this
}).require;
XPCOMUtils.defineConstant(this, "require", require);
// Localization
const { LocalizationHelper } = require("devtools/client/shared/l10n");
this.l10n = new LocalizationHelper("chrome://devtools/locale/dom.properties");
// Load DOM panel content
require("./content/dom-view.js");

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

@ -1,14 +0,0 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [
'content',
]
DevToolsModules(
'dom-panel.js',
'dom.html',
'main.js',
)

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

@ -1,5 +0,0 @@
[DEFAULT]
tags = devtools
subsuite = devtools
support-files =
head.js

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

@ -1,4 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";

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

@ -142,9 +142,6 @@ devtools.jar:
content/aboutdebugging/initializer.js (aboutdebugging/initializer.js)
content/responsive.html/index.xhtml (responsive.html/index.xhtml)
content/responsive.html/index.js (responsive.html/index.js)
content/dom/dom.html (dom/dom.html)
content/dom/content/dom-view.css (dom/content/dom-view.css)
content/dom/main.js (dom/main.js)
% skin devtools classic/1.0 %skin/
skin/devtools-browser.css (themes/devtools-browser.css)
skin/common.css (themes/common.css)
@ -199,7 +196,6 @@ devtools.jar:
skin/canvasdebugger.css (themes/canvasdebugger.css)
skin/debugger.css (themes/debugger.css)
skin/netmonitor.css (themes/netmonitor.css)
skin/dom.css (themes/dom.css)
skin/performance.css (themes/performance.css)
skin/memory.css (themes/memory.css)
skin/promisedebugger.css (themes/promisedebugger.css)
@ -283,7 +279,6 @@ devtools.jar:
skin/images/emojis/emoji-tool-scratchpad.svg (themes/images/emojis/emoji-tool-scratchpad.svg)
skin/images/emojis/emoji-tool-webaudio.svg (themes/images/emojis/emoji-tool-webaudio.svg)
skin/images/emojis/emoji-tool-memory.svg (themes/images/emojis/emoji-tool-memory.svg)
skin/images/emojis/emoji-tool-dom.svg (themes/images/emojis/emoji-tool-dom.svg)
skin/images/tool-options.svg (themes/images/tool-options.svg)
skin/images/tool-webconsole.svg (themes/images/tool-webconsole.svg)
skin/images/tool-canvas.svg (themes/images/tool-canvas.svg)
@ -303,7 +298,6 @@ devtools.jar:
skin/images/tool-webaudio.svg (themes/images/tool-webaudio.svg)
skin/images/tool-memory.svg (themes/images/tool-memory.svg)
skin/images/tool-memory-active.svg (themes/images/tool-memory-active.svg)
skin/images/tool-dom.svg (themes/images/tool-dom.svg)
skin/images/close.svg (themes/images/close.svg)
skin/images/clear.svg (themes/images/clear.svg)
skin/images/vview-delete.png (themes/images/vview-delete.png)

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

@ -1,39 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# LOCALIZATION NOTE These strings are used inside the DOM panel
# which is available from the Web Developer sub-menu -> 'DOM'.
# The correct localization of this file might be to keep it in
# English, or another language commonly spoken among web developers.
# You want to make that choice consistent across the developer tools.
# A good criteria is the language in which you'd find the best
# documentation on web development on the web.
# LOCALIZATION NOTE (dom.label):
# This string is displayed in the title of the tab when the DOM panel is
# displayed inside the developer tools window and in the Developer Tools Menu.
dom.label=DOM
# LOCALIZATION NOTE (dom.panelLabel):
# This is used as the label for the toolbox panel.
dom.panelLabel=DOM Panel
# LOCALIZATION NOTE (dom.commandkey, dom.accesskey)
# Used for the menuitem in the tool menu
dom.commandkey=W
dom.accesskey=D
# LOCALIZATION NOTE (dom.tooltip):
# This string is displayed in the tooltip of the tab when the DOM is
# displayed inside the developer tools window.
# Keyboard shortcut for DOM panel will be shown inside the brackets.
dom.tooltip=DOM (%S)
# LOCALIZATION NOTE (dom.filterDOMPanel): A placeholder text used for
# DOM panel search box.
dom.filterDOMPanel=Filter DOM Panel
# LOCALIZATION NOTE (dom.refresh): A label for Refresh button in
# DOM panel toolbar
dom.refresh=Refresh

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

@ -12,7 +12,6 @@ DIRS += [
'canvasdebugger',
'commandline',
'debugger',
'dom',
'eyedropper',
'framework',
'inspector',

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

@ -1,70 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
const { StringRep } = require("./string");
// Shortcuts
const { span } = React.DOM;
const { rep: StringRepFactory } = createFactories(StringRep);
/**
* Renders DOM attribute
*/
let Attribute = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired
},
displayName: "Attr",
getTitle: function(grip) {
return grip.preview.nodeName;
},
render: function() {
let grip = this.props.object;
let value = grip.preview.value;
return (
ObjectLink({className: "Attr"},
span({},
span({className: "attrTitle"},
this.getTitle(grip)
),
span({className: "attrEqual"},
"="
),
StringRepFactory({object: value})
)
)
);
},
});
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (type == "Attr" && grip.preview);
}
exports.Attribute = {
rep: Attribute,
supportsObject: supportsObject
};
});

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

@ -1,61 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
// Shortcuts
const { span } = React.DOM;
/**
* Used to render JS built-in Date() object.
*/
let DateTime = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired
},
displayName: "Date",
getTitle: function(grip) {
return new Date(grip.preview.timestamp).toString();
},
render: function() {
let grip = this.props.object;
return (
ObjectLink({className: "Date"},
span({className: "objectTitle"},
this.getTitle(grip)
)
)
);
},
});
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (type == "Date" && grip.preview);
}
// Exports from this module
exports.DateTime = {
rep: DateTime,
supportsObject: supportsObject
};
});

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

@ -1,72 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
const { getFileName } = require("./url");
// Shortcuts
const { span } = React.DOM;
/**
* Renders DOM document object.
*/
let Document = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired
},
displayName: "Document",
getLocation: function(grip) {
let location = grip.preview.location;
return location ? getFileName(location) : "";
},
getTitle: function(win, context) {
return "document";
},
getTooltip: function(doc) {
return doc.location.href;
},
render: function() {
let grip = this.props.object;
return (
ObjectBox({className: "object"},
span({className: "objectPropValue"},
this.getLocation(grip)
)
)
);
},
});
// Registration
function supportsObject(object, type) {
if (!isGrip(object)) {
return false;
}
return (object.preview && type == "HTMLDocument");
}
// Exports from this module
exports.Document = {
rep: Document,
supportsObject: supportsObject
};
});

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

@ -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/. */
"use strict";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
/**
* Renders DOM event objects.
*/
let Event = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired
},
displayName: "event",
summarizeEvent: function(grip) {
let info = [grip.preview.type, " "];
let eventFamily = grip.class;
let props = grip.preview.properties;
if (eventFamily == "MouseEvent") {
info.push("clientX=", props.clientX, ", clientY=", props.clientY);
} else if (eventFamily == "KeyboardEvent") {
info.push("charCode=", props.charCode, ", keyCode=", props.keyCode);
} else if (eventFamily == "MessageEvent") {
info.push("origin=", props.origin, ", data=", props.data);
}
return info.join("");
},
render: function() {
let grip = this.props.object;
return (
ObjectLink({className: "event"},
this.summarizeEvent(grip)
)
);
},
});
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (grip.preview && grip.preview.kind == "DOMEvent");
}
// Exports from this module
exports.Event = {
rep: Event,
supportsObject: supportsObject
};
});

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

@ -1,60 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
const { cropString } = require("./string");
/**
* This component represents a template for Function objects.
*/
let Func = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired
},
displayName: "Func",
summarizeFunction: function(grip) {
let name = grip.displayName || grip.name || "function";
return cropString(name + "()", 100);
},
render: function() {
let grip = this.props.object;
return (
ObjectLink({className: "function"},
this.summarizeFunction(grip)
)
);
},
});
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return (type == "function");
}
return (type == "Function");
}
// Exports from this module
exports.Func = {
rep: Func,
supportsObject: supportsObject
};
});

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

@ -1,209 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// Dependencies
const React = require("devtools/client/shared/vendor/react");
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
const { Caption } = createFactories(require("./caption"));
// Shortcuts
const { a, span } = 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.
*/
let GripArray = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
mode: React.PropTypes.string,
provider: React.PropTypes.object,
},
displayName: "GripArray",
getLength: function(grip) {
return grip.preview ? grip.preview.length : 0;
},
getTitle: function(object, context) {
return "[" + object.length + "]";
},
arrayIterator: function(grip, max) {
let items = [];
if (!grip.preview || !grip.preview.length) {
return items;
}
let array = grip.preview.items;
if (!array) {
return items;
}
let provider = this.props.provider;
if (!provider) {
return items;
}
let delim;
for (let i = 0; i < array.length && i <= max; i++) {
try {
let value = provider.getValue(array[i]);
delim = (i == array.length - 1 ? "" : ", ");
if (value === array) {
items.push(Reference({
key: i,
object: value,
delim: delim}
));
} else {
items.push(GripArrayItem(Object.assign({}, this.props, {
key: i,
object: value,
delim: delim}
)));
}
} catch (exc) {
items.push(GripArrayItem(Object.assign({}, this.props, {
object: exc,
delim: delim,
key: i}
)));
}
}
if (array.length > max + 1) {
items.pop();
items.push(Caption({
key: "more",
object: "more..."}
));
}
return items;
},
hasSpecialProperties: function(array) {
return false;
},
// Event Handlers
onToggleProperties: function(event) {
},
onClickBracket: function(event) {
},
render: function() {
let mode = this.props.mode || "short";
let object = this.props.object;
let items;
if (mode == "tiny") {
items = span({className: "length"}, this.getLength(object));
} else {
let max = (mode == "short") ? 3 : 300;
items = this.arrayIterator(object, max);
}
return (
ObjectBox({
className: "array",
onClick: this.onToggleProperties},
a({
className: "objectLink",
onclick: this.onClickBracket},
span({
className: "arrayLeftBracket",
role: "presentation"},
"["
)
),
items,
a({
className: "objectLink",
onclick: this.onClickBracket},
span({
className: "arrayRightBracket",
role: "presentation"},
"]"
)
),
span({
className: "arrayProperties",
role: "group"}
)
)
);
},
});
/**
* Renders array item. Individual values are separated by
* a delimiter (a comma by default).
*/
let GripArrayItem = React.createFactory(React.createClass({
propTypes: {
delim: React.PropTypes.string,
},
displayName: "GripArrayItem",
render: function() {
let { Rep } = createFactories(require("./rep"));
return (
span({},
Rep(Object.assign({}, this.props, {
mode: "tiny"
})),
this.props.delim
)
);
}
}));
/**
* Renders cycle references in an array.
*/
let Reference = React.createFactory(React.createClass({
displayName: "Reference",
render: function() {
return (
span({title: "Circular reference"},
"[...]"
)
);
}
}));
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (grip.preview && grip.preview.kind == "ArrayLike");
}
// Exports from this module
exports.GripArray = {
rep: GripArray,
supportsObject: supportsObject
};
});

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

@ -1,217 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Dependencies
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
const { Caption } = createFactories(require("./caption"));
// Shortcuts
const { span } = React.DOM;
/**
* @template TODO docs
*/
const Grip = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
mode: React.PropTypes.string,
},
displayName: "Grip",
getTitle: function() {
return "";
},
longPropIterator: function(object) {
try {
return this.propIterator(object, 100);
} catch (err) {
console.error(err);
}
return [];
},
shortPropIterator: function(object) {
try {
return this.propIterator(object, 3);
} catch (err) {
console.error(err);
}
return [];
},
propIterator: function(object, max) {
// Property filter. Show only interesting properties to the user.
let isInterestingProp = (type, value) => {
return (
type == "boolean" ||
type == "number" ||
type == "string" ||
type == "object"
);
};
// Object members with non-empty values are preferred since it gives the
// user a better overview of the object.
let props = this.getProps(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.
props = props.concat(this.getProps(object, max, (t, value) => {
return !isInterestingProp(t, value);
}));
}
// getProps() can return max+1 properties (it can't return more)
// to indicate that there is more props than allowed. Remove the last
// one and append 'more...' postfix in such case.
if (props.length > max) {
props.pop();
props.push(Caption({
key: "more",
object: "more...",
}));
} else if (props.length > 0) {
// Remove the last comma.
// NOTE: do not change comp._store.props directly to update a property,
// it should be re-rendered or cloned with changed props
let last = props.length - 1;
props[last] = React.cloneElement(props[last], {
delim: ""
});
}
return props;
},
getProps: function(object, max, filter) {
let props = [];
max = max || 3;
if (!object) {
return props;
}
try {
let ownProperties = object.preview ? object.preview.ownProperties : [];
for (let name in ownProperties) {
if (props.length > max) {
return props;
}
let prop = ownProperties[name];
let value = prop.value || {};
// Type is specified in grip's "class" field and for primitive
// values use typeof.
let type = (value.class || typeof value);
type = type.toLowerCase();
// Show only interesting properties.
if (filter(type, value)) {
props.push(PropRep(Object.assign({}, this.props, {
key: name,
mode: "tiny",
name: name,
object: value,
equal: ": ",
delim: ", ",
})));
}
}
} catch (err) {
console.error(err);
}
return props;
},
render: function() {
let object = this.props.object;
let props = this.shortPropIterator(object);
if (this.props.mode == "tiny" || !props.length) {
return (
ObjectBox({className: "object"},
span({className: "objectTitle"}, this.getTitle(object)),
span({className: "objectLeftBrace", role: "presentation"}, "{}")
)
);
}
return (
ObjectBox({className: "object"},
span({className: "objectTitle"}, this.getTitle(object)),
span({className: "objectLeftBrace", role: "presentation"}, "{"),
props,
span({className: "objectRightBrace"}, "}")
)
);
},
});
/**
* Property for a grip object.
*/
let PropRep = React.createFactory(React.createClass({
propTypes: {
name: React.PropTypes.string,
equal: React.PropTypes.string,
delim: React.PropTypes.string,
},
displayName: "PropRep",
render: function() {
let { Rep } = createFactories(require("./rep"));
return (
span({},
span({
"className": "nodeName"},
this.props.name),
span({
"className": "objectEqual",
role: "presentation"},
this.props.equal
),
Rep(this.props),
span({
"className": "objectComma",
role: "presentation"},
this.props.delim
)
)
);
}
}));
// Registration
function supportsObject(object, type) {
if (!isGrip(object)) {
return false;
}
return (object.preview && object.preview.ownProperties);
}
// Exports from this module
exports.Grip = {
rep: Grip,
supportsObject: supportsObject
};
});

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

@ -6,30 +6,16 @@
DevToolsModules(
'array.js',
'attribute.js',
'caption.js',
'date-time.js',
'document.js',
'event.js',
'function.js',
'grip-array.js',
'grip.js',
'named-node-map.js',
'null.js',
'number.js',
'object-box.js',
'object-link.js',
'object-with-text.js',
'object-with-url.js',
'object.js',
'regexp.js',
'rep-utils.js',
'rep.js',
'reps.css',
'string.js',
'stylesheet.js',
'text-node.js',
'undefined.js',
'url.js',
'window.js',
)

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

@ -1,172 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
const { Caption } = createFactories(require("./caption"));
// Shortcuts
const { span } = React.DOM;
/**
* Used to render a map of values provided as a grip.
*/
let NamedNodeMap = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
mode: React.PropTypes.string,
provider: React.PropTypes.object,
},
className: "NamedNodeMap",
getLength: function(object) {
return object.preview.length;
},
getTitle: function(object) {
return object.class ? object.class : "";
},
getItems: function(array, max) {
let items = this.propIterator(array, max);
items = items.map(item => PropRep(item));
if (items.length > max + 1) {
items.pop();
items.push(Caption({
key: "more",
object: "more...",
}));
}
return items;
},
propIterator: function(grip, max) {
max = max || 3;
let props = [];
let provider = this.props.provider;
if (!provider) {
return props;
}
let ownProperties = grip.preview ? grip.preview.ownProperties : [];
for (let name in ownProperties) {
if (props.length > max) {
break;
}
let item = ownProperties[name];
let label = provider.getLabel(item);
let value = provider.getValue(item);
props.push(Object.assign({}, this.props, {
name: label,
object: value,
equal: ": ",
delim: ", ",
}));
}
return props;
},
render: function() {
let grip = this.props.object;
let mode = this.props.mode;
let items;
if (mode == "tiny") {
items = this.getLength(grip);
} else {
let max = (mode == "short") ? 3 : 100;
items = this.getItems(grip, max);
}
return (
ObjectLink({className: "NamedNodeMap"},
span({className: "objectTitle"},
this.getTitle(grip)
),
span({
className: "arrayLeftBracket",
role: "presentation"},
"["
),
items,
span({
className: "arrayRightBracket",
role: "presentation"},
"]"
)
)
);
},
});
/**
* Property for a grip object.
*/
let PropRep = React.createFactory(React.createClass({
propTypes: {
equal: React.PropTypes.string,
delim: React.PropTypes.string,
},
displayName: "PropRep",
render: function() {
const { Rep } = createFactories(require("./rep"));
return (
span({},
span({
className: "nodeName"},
"$prop.name"
),
span({
className: "objectEqual",
role: "presentation"},
this.props.equal
),
Rep(this.props),
span({
className: "objectComma",
role: "presentation"},
this.props.delim
)
)
);
}
}));
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (type == "NamedNodeMap" && grip.preview);
}
// Exports from this module
exports.NamedNodeMap = {
rep: NamedNodeMap,
supportsObject: supportsObject
};
});

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

@ -1,65 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
// Shortcuts
const { span } = React.DOM;
/**
* Renders a grip object with textual data.
*/
let ObjectWithText = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
},
displayName: "ObjectWithText",
getType: function(grip) {
return grip.class;
},
getDescription: function(grip) {
return (grip.preview.kind == "ObjectWithText") ? grip.preview.text : "";
},
render: function() {
let grip = this.props.object;
return (
ObjectLink({className: this.getType(grip)},
span({className: "objectPropValue"},
this.getDescription(grip)
)
)
);
},
});
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (grip.preview && grip.preview.kind == "ObjectWithText");
}
// Exports from this module
exports.ObjectWithText = {
rep: ObjectWithText,
supportsObject: supportsObject
};
});

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

@ -1,65 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
// Shortcuts
const { span } = React.DOM;
/**
* Renders a grip object with URL data.
*/
let ObjectWithURL = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
},
displayName: "ObjectWithURL",
getType: function(grip) {
return grip.class;
},
getDescription: function(grip) {
return (grip.preview.kind == "ObjectWithURL") ? grip.preview.url : "";
},
render: function() {
let grip = this.props.object;
return (
ObjectLink({className: this.getType(grip)},
span({className: "objectPropValue"},
this.getDescription(grip)
)
)
);
},
});
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (grip.preview && grip.preview.kind == "ObjectWithURL");
}
// Exports from this module
exports.ObjectWithURL = {
rep: ObjectWithURL,
supportsObject: supportsObject
};
});

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

@ -15,20 +15,29 @@ define(function(require, exports, module) {
const { Caption } = createFactories(require("./caption"));
// Shortcuts
const { span } = React.DOM;
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({
propTypes: {
object: React.PropTypes.object,
mode: React.PropTypes.string,
},
displayName: "Obj",
render: function() {
let object = this.props.object;
let 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 "";
},
@ -52,10 +61,10 @@ define(function(require, exports, module) {
},
propIterator: function(object, max) {
let isInterestingProp = (t, value) => {
// Do not pick objects, it could cause recursion.
return (t == "boolean" || t == "number" || (t == "string" && value));
};
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]") {
@ -64,15 +73,16 @@ define(function(require, exports, module) {
// Object members with non-empty values are preferred since it gives the
// user a better overview of the object.
let props = this.getProps(object, max, isInterestingProp);
let 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.
props = props.concat(this.getProps(object, max, (t, value) => {
this.getProps(props, object, max, function(t, value) {
return !isInterestingProp(t, value);
}));
});
}
if (props.length > max) {
@ -90,12 +100,10 @@ define(function(require, exports, module) {
return props;
},
getProps: function(object, max, filter) {
let props = [];
getProps: function(props, object, max, filter) {
max = max || 3;
if (!object) {
return props;
return [];
}
let mode = this.props.mode;
@ -103,7 +111,7 @@ define(function(require, exports, module) {
try {
for (let name in object) {
if (props.length > max) {
return props;
return [];
}
let value;
@ -129,21 +137,7 @@ define(function(require, exports, module) {
console.error(err);
}
return props;
},
render: function() {
let object = this.props.object;
let props = this.shortPropIterator(object);
return (
ObjectBox({className: "object"},
span({className: "objectTitle"}, this.getTitle(object)),
span({className: "objectLeftBrace", role: "presentation"}, "{"),
props,
span({className: "objectRightBrace"}, "}")
)
);
return [];
},
});
@ -151,14 +145,6 @@ define(function(require, exports, module) {
* Renders object property, name-value pair.
*/
let PropRep = React.createFactory(React.createClass({
propTypes: {
object: React.PropTypes.any,
mode: React.PropTypes.string,
name: React.PropTypes.string,
equal: React.PropTypes.string,
delim: React.PropTypes.string,
},
displayName: "PropRep",
render: function() {
@ -167,12 +153,12 @@ define(function(require, exports, module) {
let mode = this.props.mode;
return (
span({},
span({
DOM.span({},
DOM.span({
"className": "nodeName"},
this.props.name
),
span({
DOM.span({
"className": "objectEqual",
role: "presentation"},
this.props.equal
@ -181,7 +167,7 @@ define(function(require, exports, module) {
object: object,
mode: mode
}),
span({
DOM.span({
"className": "objectComma",
role: "presentation"},
this.props.delim

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

@ -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/. */
"use strict";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
// Shortcuts
const { span } = React.DOM;
/**
* Renders a grip object with regular expression.
*/
let RegExp = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
},
displayName: "regexp",
getTitle: function(grip) {
return grip.class;
},
getSource: function(grip) {
return grip.displayString;
},
render: function() {
let grip = this.props.object;
return (
ObjectLink({className: "regexp"},
span({className: "objectTitle"},
this.getTitle(grip)
),
span(" "),
span({className: "regexpSource"},
this.getSource(grip)
)
)
);
},
});
// Registration
function supportsObject(object, type) {
if (!isGrip(object)) {
return false;
}
return (type == "RegExp");
}
// Exports from this module
exports.RegExp = {
rep: RegExp,
supportsObject: supportsObject
};
});

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

@ -24,14 +24,6 @@ define(function(require, exports, module) {
return result;
}
/**
* Returns true if the given object is a grip (see RDP protocol)
*/
function isGrip(object) {
return object && object.actor;
}
// Exports from this module
exports.createFactories = createFactories;
exports.isGrip = isGrip;
});

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

@ -11,8 +11,6 @@ define(function(require, exports, module) {
// Dependencies
const React = require("devtools/client/shared/vendor/react");
const { isGrip } = require("./rep-utils");
// Load all existing rep templates
const { Undefined } = require("./undefined");
const { Null } = require("./null");
@ -21,46 +19,11 @@ define(function(require, exports, module) {
const { ArrayRep } = require("./array");
const { Obj } = require("./object");
// DOM types (grips)
const { Attribute } = require("./attribute");
const { DateTime } = require("./date-time");
const { Document } = require("./document");
const { Event } = require("./event");
const { Func } = require("./function");
const { NamedNodeMap } = require("./named-node-map");
const { RegExp } = require("./regexp");
const { StyleSheet } = require("./stylesheet");
const { TextNode } = require("./text-node");
const { Window } = require("./window");
const { ObjectWithText } = require("./object-with-text");
const { ObjectWithURL } = require("./object-with-url");
const { GripArray } = require("./grip-array");
const { Grip } = require("./grip");
// List of all registered template.
// XXX there should be a way for extensions to register a new
// or modify an existing rep.
let reps = [
RegExp,
StyleSheet,
Event,
DateTime,
TextNode,
NamedNodeMap,
Attribute,
Func,
ArrayRep,
Document,
Window,
ObjectWithText,
ObjectWithURL,
GripArray,
Grip,
Undefined,
Null,
StringRep,
Number,
];
let reps = [Undefined, Null, StringRep, Number, ArrayRep, Obj];
let defaultRep;
/**
* Generic rep that is using for rendering native JS types or an object.
@ -69,15 +32,10 @@ define(function(require, exports, module) {
* property.
*/
const Rep = React.createClass({
propTypes: {
object: React.PropTypes.any,
defaultRep: React.PropTypes.object,
},
displayName: "Rep",
render: function() {
let rep = getRep(this.props.object, this.props.defaultRep);
let rep = getRep(this.props.object);
return rep(this.props);
},
});
@ -91,11 +49,8 @@ define(function(require, exports, module) {
* @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).
*
* @param defaultObject {React.Component} The default template
* that should be used to render given object if none is found.
*/
function getRep(object, defaultRep = Obj) {
function getRep(object) {
let type = typeof object;
if (type == "object" && object instanceof String) {
type = "string";
@ -115,13 +70,17 @@ define(function(require, exports, module) {
return React.createFactory(rep.rep);
}
} catch (err) {
console.error(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;
});

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

@ -96,9 +96,6 @@ define(function(require, exports, module) {
exports.StringRep = {
rep: StringRep,
supportsObject: supportsObject,
isCropped: isCropped
};
exports.isCropped = isCropped;
exports.cropString = cropString;
exports.cropMultipleLines = cropMultipleLines;
});

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

@ -1,67 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
const { getFileName } = require("./url");
// Shortcuts
const DOM = React.DOM;
/**
* Renders a grip representing CSSStyleSheet
*/
let StyleSheet = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
},
displayName: "object",
getLocation: function(grip) {
// Embedded stylesheets don't have URL and so, no preview.
let url = grip.preview ? grip.preview.url : "";
return url ? getFileName(url) : "";
},
render: function() {
let grip = this.props.object;
return (
ObjectBox({className: "object"},
"StyleSheet ",
DOM.span({className: "objectPropValue"},
this.getLocation(grip)
)
)
);
},
});
// Registration
function supportsObject(object, type) {
if (!isGrip(object)) {
return false;
}
return (type == "CSSStyleSheet");
}
// Exports from this module
exports.StyleSheet = {
rep: StyleSheet,
supportsObject: supportsObject
};
});

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

@ -1,82 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectLink } = createFactories(require("./object-link"));
const { cropMultipleLines } = require("./string");
// Shortcuts
const DOM = React.DOM;
/**
* Renders DOM #text node.
*/
let TextNode = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
mode: React.PropTypes.string,
},
displayName: "TextNode",
getTextContent: function(grip) {
return cropMultipleLines(grip.preview.textContent);
},
getTitle: function(win, context) {
return "textNode";
},
render: function() {
let grip = this.props.object;
let mode = this.props.mode || "short";
if (mode == "short" || mode == "tiny") {
return (
ObjectLink({className: "textNode"},
"\"" + this.getTextContent(grip) + "\""
)
);
}
return (
ObjectLink({className: "textNode"},
"<",
DOM.span({className: "nodeTag"}, "TextNode"),
" textContent=\"",
DOM.span({className: "nodeValue"},
this.getTextContent(grip)
),
"\"",
">;"
)
);
},
});
// Registration
function supportsObject(grip, type) {
if (!isGrip(grip)) {
return false;
}
return (grip.preview && grip.class == "Text");
}
// Exports from this module
exports.TextNode = {
rep: TextNode,
supportsObject: supportsObject
};
});

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

@ -32,50 +32,7 @@ define(function(require, exports, module) {
});
}
function getFileName(url) {
let split = splitURLBase(url);
return split.name;
}
function splitURLBase(url) {
if (!isDataURL(url)) {
return splitURLTrue(url);
}
return {};
}
function isDataURL(url) {
return (url && url.substr(0, 5) == "data:");
}
function splitURLTrue(url) {
const reSplitFile = /(.*?):\/{2,3}([^\/]*)(.*?)([^\/]*?)($|\?.*)/;
let m = reSplitFile.exec(url);
if (!m) {
return {
name: url,
path: url
};
} else if (m[4] == "" && m[5] == "") {
return {
protocol: m[1],
domain: m[2],
path: m[3],
name: m[3] != "/" ? m[3] : m[2]
};
}
return {
protocol: m[1],
domain: m[2],
path: m[2] + m[3],
name: m[4] + m[5]
};
}
// Exports from this module
exports.parseURLParams = parseURLParams;
exports.parseURLEncodedText = parseURLEncodedText;
exports.getFileName = getFileName;
});

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

@ -1,71 +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";
// Make this available to both AMD and CJS environments
define(function(require, exports, module) {
// ReactJS
const React = require("devtools/client/shared/vendor/react");
// Reps
const { createFactories, isGrip } = require("./rep-utils");
const { ObjectBox } = createFactories(require("./object-box"));
const { cropString } = require("./string");
// Shortcuts
const DOM = React.DOM;
/**
* Renders a grip representing a window.
*/
let Window = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired,
},
displayName: "Window",
getLocation: function(grip) {
return cropString(grip.preview.url);
},
getTitle: function(grip, context) {
return grip.class;
},
getTooltip: function(grip) {
return grip.preview.url;
},
render: function() {
let grip = this.props.object;
return (
ObjectBox({className: "Window"},
DOM.span({className: "objectPropValue"},
this.getLocation(grip)
)
)
);
},
});
// Registration
function supportsObject(object, type) {
if (!isGrip(object)) {
return false;
}
return (object.preview && type == "Window");
}
// Exports from this module
exports.Window = {
rep: Window,
supportsObject: supportsObject
};
});

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

@ -1,9 +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/. */
:root.theme-dark {
}
:root.theme-light {
}

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

@ -1,95 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
<g id="Layer_2">
<path fill="#51BA7B" d="M487.819,258.669H439.1c-10.041,0-18.181-8.14-18.181-18.181s8.14-18.181,18.181-18.181h48.719
c10.041,0,18.181,8.14,18.181,18.181S497.86,258.669,487.819,258.669z"/>
</g>
<g id="Layer_3">
<path fill="#BADEBE" d="M415.747,69.674c0,0-0.387,0.603-1.059,1.667c-0.19,0.28-0.364,0.483-0.638,0.799
c-0.294,0.505-0.672,1.205-1.057,1.933c-0.357,0.806-0.812,1.618-1.199,2.599c-0.412,0.953-0.833,1.983-1.233,3.083
c-0.433,1.086-0.783,2.248-1.19,3.426c-0.364,1.183-0.742,2.395-1.064,3.614c-0.316,1.219-0.645,2.445-0.884,3.643
c-0.286,1.219-0.475,2.381-0.679,3.523c-0.188,1.142-0.308,2.214-0.434,3.243c-0.041,0.505-0.077,0.988-0.118,1.457
c-0.043,0.483-0.07,0.939-0.063,1.338c-0.007,0.812-0.063,1.646,0,2.221c0.014,0.315,0.034,0.609,0.048,0.882
c0,0.14,0.007,0.273,0.015,0.399c0.014,0.105,0.027,0.209,0.041,0.301c0.113,0.777,0.161,1.26,0.161,1.26l0.19,2.025
c0.364,3.895-2.5,7.348-6.396,7.712c-2.829,0.267-5.421-1.177-6.774-3.467c0,0-0.489-0.826-1.308-2.353
c-0.099-0.189-0.204-0.392-0.316-0.603c-0.084-0.203-0.181-0.413-0.274-0.63c-0.195-0.448-0.398-0.932-0.616-1.45
c-0.484-1.058-0.806-2.164-1.233-3.432c-0.217-0.637-0.398-1.275-0.561-1.933c-0.174-0.665-0.349-1.352-0.532-2.066
c-0.301-1.387-0.622-2.879-0.876-4.393c-0.231-1.506-0.491-3.089-0.638-4.659c-0.195-1.583-0.308-3.18-0.419-4.784
c-0.106-1.604-0.147-3.201-0.19-4.791c0-1.576-0.027-3.145,0.043-4.665c0.034-1.513,0.125-2.998,0.238-4.42
c0.077-1.408,0.28-2.802,0.414-4.063c0.188-1.31,0.371-2.48,0.588-3.622c0.301-1.31,0.622-2.529,0.853-3.411
c0.31-1.212,0.477-1.913,0.477-1.913c1.968-7.887,9.967-12.692,17.856-10.724c7.894,1.975,12.691,9.968,10.725,17.862
c-0.387,1.549-1.009,2.984-1.815,4.266L415.747,69.674z M359.397,86.684c0.566-1.408,0.923-2.921,1.036-4.518
c0.559-8.111-5.562-15.145-13.681-15.705c-8.118-0.56-15.151,5.562-15.711,13.681c0,0-0.05,0.715-0.133,1.976
c-0.097,1.071-0.21,2.549-0.258,4.133c0.014,0.665,0.055,1.233,0.091,1.912c0.048,0.638,0.063,1.366,0.154,2.025
c0.174,1.331,0.308,2.823,0.595,4.245c0.133,0.722,0.267,1.457,0.407,2.221c0.168,0.729,0.335,1.478,0.511,2.234
c0.322,1.527,0.783,3.033,1.19,4.575c0.477,1.526,0.91,3.068,1.457,4.574c0.518,1.52,1.065,3.019,1.654,4.483
c0.552,1.464,1.211,2.893,1.806,4.259c0.638,1.379,1.276,2.696,1.905,3.936c0.694,1.254,1.255,2.41,1.948,3.496
c0.665,1.086,1.226,2.052,1.864,2.936c0.622,0.882,1.079,1.611,1.618,2.248c1.016,1.24,1.59,1.941,1.59,1.941
c1.849,2.255,4.973,3.243,7.887,2.234c3.74-1.289,5.715-5.373,4.426-9.107l-0.469-1.338c0,0-0.168-0.497-0.469-1.366
c-0.162-0.386-0.303-1.051-0.498-1.688c-0.204-0.631-0.357-1.478-0.554-2.347c-0.217-0.833-0.344-1.891-0.532-2.906
c-0.154-1.058-0.301-2.192-0.428-3.362c-0.097-1.198-0.231-2.396-0.274-3.664c-0.084-1.247-0.111-2.529-0.118-3.797
c-0.029-1.268,0.041-2.543,0.063-3.775c0.091-1.219,0.111-2.438,0.251-3.566c0.063-0.56,0.12-1.121,0.174-1.661
c0.077-0.518,0.162-1.03,0.233-1.526c0.132-1.016,0.371-1.829,0.525-2.627c0.077-0.407,0.21-0.693,0.301-1.016
c0.097-0.294,0.181-0.645,0.267-0.841c0.188-0.127,0.258-0.147,0.342-0.294c0.477-1.163,0.751-1.829,0.751-1.829L359.397,86.684z"
/>
</g>
<g id="Layer_4">
<path fill="#8ACCA0" d="M456.112,143.24c-11.449-34.634-48.8-53.434-83.441-41.983c-34.634,11.449-53.431,48.807-41.982,83.442
c17.717,53.598,16.873,94.849-2.59,126.04c-1.716,2.393-3.661,5.076-4.907,6.585c-2.608,1.882-5.037,3.926-7.289,6.104
c-1.264,0.639-2.52,1.306-3.758,2.035c0,0-0.989,0.581-2.851,1.674c-0.113,0.077-0.154,0.112-0.246,0.189
c-0.041,0.035-0.077,0.07-0.125,0.112c-0.022,0.021-0.029,0.035-0.07,0.07l-0.233,0.127c-0.301,0.182-0.629,0.371-0.973,0.575
c-0.364,0.203-0.749,0.413-1.156,0.637c-1.659,0.876-3.761,1.92-6.494,2.956c-2.711,1.044-6.03,2.109-10.03,3.04
c-4.007,0.911-8.672,1.709-13.996,2.179c-5.317,0.483-11.27,0.672-17.694,0.476c-1.613-0.056-3.251-0.126-4.912-0.224
c-1.597-0.105-3.208-0.21-4.826-0.322c-4.134-0.393-8.308-0.784-12.517-1.191c-1.907-0.168-3.875-0.42-5.821-0.623
c-1.962-0.217-3.776-0.469-5.681-0.693c-1.828-0.259-3.656-0.504-5.437-0.777c-1.765-0.287-3.537-0.553-5.288-0.882
c-1.738-0.294-3.538-0.673-5.331-1.023l-2.774-0.603c-0.925-0.203-1.864-0.406-2.865-0.652l-2.943-0.693l-3.095-0.77
c-2.136-0.539-4.26-1.078-6.382-1.618c-8.713-2.241-17.861-4.617-26.604-6.732l-1.64-0.398l-0.202-0.05l-0.099-0.028
c-1.233-0.357-0.398-0.104-0.699-0.189l-0.4-0.07l-0.792-0.147c-1.057-0.182-2.109-0.371-3.152-0.56
c-2.634-0.476-5.24-0.953-7.824-1.415c-0.694-0.133-1.337-0.231-1.955-0.322c-0.631-0.097-1.26-0.196-1.891-0.287
c-1.254-0.189-2.5-0.371-3.74-0.56c-2.516-0.316-4.966-0.658-7.439-0.924c-9.863-1.1-19.447-1.646-28.545-1.619
c-9.107,0.05-17.682,0.61-25.54,1.661c-7.839,1.023-14.949,2.522-21.051,4.175c-3.054,0.827-5.892,1.716-8.419,2.578
c-2.564,0.889-4.862,1.773-6.851,2.592c-2.032,0.847-3.79,1.646-5.204,2.326c-0.898,0.441-1.584,0.777-2.039,1.001
c-0.982,0.505-1.479,0.757-1.479,0.757C8.67,342.764-1.563,374.966,11.983,401.136c13.555,26.178,45.756,36.405,71.927,22.857
c0,0-0.484,0.245-1.45,0.735c-0.301,0.14-0.742,0.351-1.324,0.63c-0.344,0.155-0.848,0.386-1.507,0.693
c-0.251,0.133-0.342,0.203-0.21,0.21c0.169,0.015,0.504-0.014,1.072-0.063c1.163-0.091,3.138-0.259,5.955-0.231
c2.774,0,6.41,0.231,10.661,0.757c4.272,0.54,9.225,1.457,14.668,2.767c1.358,0.321,2.767,0.721,4.175,1.071
c0.715,0.203,1.437,0.413,2.165,0.617l1.086,0.308c0.378,0.105,0.735,0.203,1.023,0.302c1.394,0.441,2.808,0.882,4.231,1.331
c1.765,0.575,3.544,1.149,5.337,1.731c7.824,2.472,15.711,5.092,24.357,7.978c2.227,0.743,4.462,1.478,6.709,2.221l3.496,1.142
l3.692,1.17l1.864,0.589l1.946,0.588l3.923,1.177c2.704,0.77,5.387,1.555,8.175,2.269c2.76,0.75,5.527,1.415,8.294,2.087
c2.745,0.658,5.464,1.248,8.168,1.843c2.634,0.54,5.344,1.121,7.901,1.604c2.584,0.476,5.107,0.981,7.704,1.429
c2.543,0.441,5.072,0.876,7.586,1.31c2.208,0.364,4.407,0.722,6.6,1.086c1.443,0.217,2.885,0.427,4.315,0.644
c1.366,0.182,2.724,0.371,4.077,0.553c2.711,0.351,5.428,0.666,8.139,0.946c10.851,1.128,21.682,1.647,32.23,1.513
c10.543-0.119,20.833-0.932,30.479-2.291c9.666-1.366,18.689-3.313,26.716-5.548c8.028-2.214,15.053-4.742,20.791-7.061
c1.428-0.595,2.781-1.162,4.055-1.695c1.269-0.568,2.459-1.093,3.566-1.59c0.28-0.126,0.547-0.245,0.812-0.364
c0.31-0.147,0.617-0.294,0.912-0.434c0.602-0.295,1.177-0.568,1.731-0.834c1.086-0.54,2.073-1.023,2.955-1.464
c1.919-0.981,2.943-1.5,2.943-1.5l1.975-1.008c1.107-0.568,2.199-1.17,3.285-1.808c4.709-2.771,8.938-6.043,12.681-9.695
c2.101-1.074,4.167-2.266,6.185-3.588c18.693-12.238,30.142-28.256,38.55-40.018l0.926-1.294l0.862-1.338
c23.738-36.839,36.169-79.029,36.947-125.397C475.941,222.291,469.472,183.656,456.112,143.24z"/>
</g>
<g id="Layer_5">
<path fill="#FFFFFF" d="M379.069,155.928l4.301,16.062h-0.021c0.007,0.028,0.027,0.028,0.034,0.042
c1.688,6.311-2.059,12.798-8.363,14.486c-6.312,1.688-12.799-2.059-14.487-8.364c-0.007-0.014-0.007-0.021-0.014-0.049l-0.05,0.014
l-4.301-16.062l0.14-0.035c-1.057-5.989,2.55-11.887,8.532-13.492c5.969-1.597,12.048,1.709,14.116,7.425L379.069,155.928z
M427.228,135.341c-2.697-5.45-9.107-8.048-14.858-5.792c-5.765,2.263-8.693,8.532-6.971,14.367l-0.132,0.049l6.08,15.481
l0.05-0.021c0.007,0.021,0.007,0.027,0.014,0.042c2.387,6.08,9.254,9.071,15.334,6.683c6.08-2.381,9.071-9.254,6.682-15.334
c0-0.008-0.027-0.008-0.034-0.028l0.021-0.015l-6.08-15.474L427.228,135.341z"/>
</g>
<g id="Layer_6">
<path fill="#51BA7B" d="M386.722,311.106l40.557,17.233c9.247,3.93,13.555,14.612,9.632,23.859
c-3.93,9.253-14.619,13.561-23.866,9.632c-0.405-0.175-0.847-0.379-1.24-0.581l-39.143-20.223
c-8.118-4.196-11.292-14.171-7.104-22.29C369.552,311.008,378.842,307.786,386.722,311.106"/>
</g>
<g id="Layer_7">
<path fill="#74C48D" d="M394.574,405.513c-12.623,0-25.31-3.56-36.185-10.523c-2.646-1.694-3.417-5.212-1.723-7.858
c1.693-2.645,5.212-3.415,7.857-1.723c15.343,9.826,35.001,11.501,51.304,4.37c2.88-1.255,6.232,0.054,7.49,2.933
c1.26,2.878-0.053,6.232-2.932,7.491C412.248,403.76,403.426,405.513,394.574,405.513z M342.441,446.116
c0.156-3.138-2.26-5.809-5.396-5.966c-14.406-0.721-28.217-7.446-37.895-18.452c-2.074-2.358-5.666-2.589-8.027-0.515
c-2.359,2.075-2.59,5.668-0.515,8.028c11.694,13.299,28.412,21.428,45.868,22.301c0.098,0.005,0.194,0.007,0.289,0.007
C339.776,451.52,342.289,449.157,342.441,446.116z M423.905,312.771c15.644-0.293,30.09-5.857,41.777-16.091
c2.363-2.07,2.601-5.664,0.531-8.026c-2.069-2.363-5.663-2.602-8.027-0.532c-9.641,8.443-21.568,13.033-34.493,13.275
c-3.141,0.059-5.639,2.653-5.581,5.794c0.057,3.104,2.593,5.581,5.684,5.581C423.832,312.772,423.869,312.772,423.905,312.771z"/>
</g>
</svg>

До

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

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

@ -1,6 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="whitesmoke">
<path d="M.2 6.3l3.5 3.6c.1.1.3.2.5.2h.9c.3 0 .5-.2.6-.4.1-.2.1-.5-.1-.7l-3-3.1 3-2.9c.2-.2.3-.5.2-.7-.2-.4-.5-.5-.7-.5h-.9c-.2 0-.4 0-.5.2L.2 5.4c-.3.2-.3.6 0 .9M15.8 9.7l-3.5-3.6c-.1-.1-.3-.2-.5-.2h-.9c-.3 0-.5.2-.6.4-.1.2-.1.5.1.7l3 3.1-3 2.9c-.2.2-.3.5-.2.7.1.3.3.4.6.4h.9c.2 0 .3-.1.5-.2l3.5-3.4c.4-.1.4-.5.1-.8"/>
</svg>

До

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