Merge inbound to mozilla-central. a=merge

This commit is contained in:
Margareta Eliza Balazs 2018-04-12 12:38:56 +03:00
commit 8ca418adb9
97 changed files with 957 additions and 590 deletions

View File

@ -259,7 +259,7 @@
// HTML form autocomplete
var controller = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
popupNode = controller.input.popup.QueryInterface(nsIDOMNode);
popupNode = controller.input.popup;
}
if (popupNode) {

View File

@ -4,6 +4,7 @@ support-files =
[test_bindings.xhtml]
[test_embeds.xul]
skip-if = os == 'linux' && !debug # bug 1411145
[test_general.html]
[test_general.xul]
[test_tabbrowser.xul]

View File

@ -39,8 +39,7 @@ var FullZoom = {
// nsISupports
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener,
Ci.nsIObserver,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsIContentPrefObserver,
Ci.nsISupportsWeakReference,
Ci.nsISupports]),
@ -87,7 +86,7 @@ var FullZoom = {
// Event Handlers
// nsIDOMEventListener
// EventListener
handleEvent: function FullZoom_handleEvent(event) {
switch (event.type) {

View File

@ -100,7 +100,7 @@
</xul:arrowscrollbox>
</content>
<implementation implements="nsIDOMEventListener, nsIObserver">
<implementation implements="nsIObserver">
<constructor>
<![CDATA[
this._tabClipWidth = Services.prefs.getIntPref("browser.tabs.tabClipWidth");
@ -1965,7 +1965,7 @@
<binding id="tabbrowser-alltabs-popup"
extends="chrome://global/content/bindings/popup.xml#popup">
<implementation implements="nsIDOMEventListener">
<implementation>
<method name="_tabOnAttrModified">
<parameter name="aEvent"/>
<body><![CDATA[

View File

@ -53,7 +53,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
<children includes="toolbarbutton"/>
</content>
<implementation implements="nsIObserver, nsIDOMEventListener">
<implementation implements="nsIObserver">
<field name="ExtensionSearchHandler" readonly="true">
(ChromeUtils.import("resource://gre/modules/ExtensionSearchHandler.jsm", {})).ExtensionSearchHandler;
</field>

View File

@ -546,7 +546,7 @@ FeedWriter.prototype = {
}
},
// nsIDomEventListener
// EventListener
handleEvent(event) {
if (event.target.ownerDocument != this._document) {
LOG("FeedWriter.handleEvent: Someone passed the feed writer as a listener to the events of another document!");
@ -981,7 +981,7 @@ FeedWriter.prototype = {
},
classID: FEEDWRITER_CID,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener, Ci.nsIObserver,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsIDOMGlobalPropertyInitializer])
};

View File

@ -349,7 +349,7 @@ var BookmarkPropertiesPanel = {
acceptButton.disabled = acceptButtonDisabled;
},
// nsIDOMEventListener
// EventListener
handleEvent: function BPP_handleEvent(aEvent) {
var target = aEvent.target;
switch (aEvent.type) {
@ -373,8 +373,7 @@ var BookmarkPropertiesPanel = {
// nsISupports
QueryInterface: function BPP_QueryInterface(aIID) {
if (aIID.equals(Ci.nsIDOMEventListener) ||
aIID.equals(Ci.nsISupports))
if (aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;

View File

@ -1009,8 +1009,7 @@ PlacesToolbar.prototype = {
"mousemove", "mouseover", "mouseout"],
QueryInterface: function PT_QueryInterface(aIID) {
if (aIID.equals(Ci.nsIDOMEventListener) ||
aIID.equals(Ci.nsITimerCallback))
if (aIID.equals(Ci.nsITimerCallback))
return this;
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
@ -1911,13 +1910,6 @@ function PlacesMenu(aPopupShowingEvent, aPlace, aOptions) {
PlacesMenu.prototype = {
__proto__: PlacesViewBase.prototype,
QueryInterface: function PM_QueryInterface(aIID) {
if (aIID.equals(Ci.nsIDOMEventListener))
return this;
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
},
_removeChild: function PM_removeChild(aChild) {
PlacesViewBase.prototype._removeChild.apply(this, arguments);
},

View File

@ -465,8 +465,7 @@ var gEditItemOverlay = {
},
QueryInterface:
XPCOMUtils.generateQI([Ci.nsIDOMEventListener,
Ci.nsINavBookmarkObserver]),
XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]),
_element(aID) {
return document.getElementById("editBMPanel_" + aID);
@ -955,7 +954,7 @@ var gEditItemOverlay = {
this._folderTree.columns.getFirstColumn());
},
// nsIDOMEventListener
// EventListener
handleEvent(aEvent) {
switch (aEvent.type) {
case "CheckboxStateChange":

View File

@ -197,8 +197,7 @@ var PlacesOrganizer = {
},
QueryInterface: function PO_QueryInterface(aIID) {
if (aIID.equals(Ci.nsIDOMEventListener) ||
aIID.equals(Ci.nsISupports))
if (aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_NOINTERFACE;

View File

@ -1295,7 +1295,7 @@ var gMainPane = {
// nsISupports
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsIDOMEventListener]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
// nsIObserver
@ -1327,7 +1327,7 @@ var gMainPane = {
},
// nsIDOMEventListener
// EventListener
handleEvent(aEvent) {
if (aEvent.type == "unload") {

View File

@ -1117,7 +1117,7 @@
</xul:menupopup>
</content>
<implementation implements="nsIDOMEventListener,nsIObserver,nsIWeakReference">
<implementation implements="nsIObserver,nsIWeakReference">
<!-- Width in pixels of the one-off buttons. 49px is the min-width of
each search engine button, adapt this const when changing the css.

View File

@ -429,7 +429,6 @@ Object.freeze(SessionStore);
var SessionStoreInternal = {
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIDOMEventListener,
Ci.nsIObserver,
Ci.nsISupportsWeakReference
]),
@ -999,7 +998,7 @@ var SessionStoreInternal = {
/* ........ Window Event Handlers .............. */
/**
* Implement nsIDOMEventListener for handling various window and tab events
* Implement EventListener for handling various window and tab events
*/
handleEvent: function ssi_handleEvent(aEvent) {
let win = aEvent.currentTarget.ownerGlobal;

View File

@ -51,6 +51,9 @@ const PREF_INTERVAL = "browser.sessionstore.interval";
const kNoIndex = Number.MAX_SAFE_INTEGER;
const kLastIndex = Number.MAX_SAFE_INTEGER - 1;
// Grab our global so we can access it in functions below.
const global = this;
/**
* A function that will recursively call |cb| to collected data for all
* non-dynamic frames in the current frame/docShell tree.
@ -150,7 +153,7 @@ var StateChangeNotifier = {
var EventListener = {
init() {
addEventListener("load", ssu.createDynamicFrameEventFilter(this), true);
ssu.addDynamicFrameFilteredListener(global, "load", this, true);
},
handleEvent(event) {
@ -464,7 +467,7 @@ var SessionHistoryListener = {
*/
var ScrollPositionListener = {
init() {
addEventListener("scroll", ssu.createDynamicFrameEventFilter(this));
ssu.addDynamicFrameFilteredListener(global, "scroll", this, false);
StateChangeNotifier.addObserver(this);
},
@ -504,7 +507,7 @@ var ScrollPositionListener = {
*/
var FormDataListener = {
init() {
addEventListener("input", ssu.createDynamicFrameEventFilter(this), true);
ssu.addDynamicFrameFilteredListener(global, "input", this, true);
StateChangeNotifier.addObserver(this);
},
@ -596,13 +599,15 @@ var SessionStorageListener = {
resetEventListener() {
if (!this._listener) {
this._listener = ssu.createDynamicFrameEventFilter(this);
addEventListener("MozSessionStorageChanged", this._listener, true);
this._listener =
ssu.addDynamicFrameFilteredListener(global, "MozSessionStorageChanged",
this, true);
}
},
removeEventListener() {
removeEventListener("MozSessionStorageChanged", this._listener, true);
ssu.removeDynamicFrameFilteredListener(global, "MozSessionStorageChanged",
this._listener, true);
this._listener = null;
},

View File

@ -5,7 +5,7 @@
#include "nsISupports.idl"
interface mozIDOMWindowProxy;
interface nsIDOMEventListener;
interface nsIDOMEventTarget;
/**
* A callback passed to nsISessionStoreUtils.forEachNonDynamicChildFrame().
@ -35,12 +35,35 @@ interface nsISessionStoreUtils : nsISupports
in nsISessionStoreUtilsFrameCallback callback);
/**
* Creates and returns an event listener that filters events from dynamic
* docShells. It forwards those from non-dynamic docShells to the given
* |listener|.
* Takes the given listener, wraps it in a filter that filters out events from
* dynamic docShells, and adds that filter as a listener for the given event
* type on the given event target. The listener that was added is returned
* (as nsISupports) so that it can later be removed via
* removeDynamicFrameFilteredListener.
*
* This is implemented as a native filter, rather than a JS-based one, for
* performance reasons.
*
* Once bug 1444991 is fixed, this should start taking an EventTarget.
*/
nsIDOMEventListener createDynamicFrameEventFilter(in nsIDOMEventListener listener);
[implicit_jscontext]
nsISupports addDynamicFrameFilteredListener(in nsIDOMEventTarget target,
in AString type,
in jsval listener,
in boolean useCapture);
/**
* Remove the passed-in filtered listener from the given event target, if it's
* currently a listener for the given event type there. The 'listener'
* argument must be something that was returned by
* addDynamicFrameFilteredListener.
*
* This is needed, instead of the normal removeEventListener, because the
* caller doesn't actually have something that WebIDL considers an
* EventListener.
*/
void removeDynamicFrameFilteredListener(in nsIDOMEventTarget target,
in AString type,
in nsISupports listener,
in boolean useCapture);
};

View File

@ -5,6 +5,9 @@
#include "nsSessionStoreUtils.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventListenerBinding.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsPIDOMWindow.h"
#include "nsIDocShell.h"
@ -18,14 +21,14 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(DynamicFrameEventFilter)
explicit DynamicFrameEventFilter(nsIDOMEventListener* aListener)
explicit DynamicFrameEventFilter(EventListener* aListener)
: mListener(aListener)
{ }
NS_IMETHODIMP HandleEvent(nsIDOMEvent* aEvent) override
{
if (mListener && TargetInNonDynamicDocShell(aEvent)) {
mListener->HandleEvent(aEvent);
mListener->HandleEvent(*aEvent->InternalDOMEvent());
}
return NS_OK;
@ -56,7 +59,7 @@ private:
return NS_SUCCEEDED(rv) && !isDynamic;
}
nsCOMPtr<nsIDOMEventListener> mListener;
RefPtr<EventListener> mListener;
};
NS_IMPL_CYCLE_COLLECTION(DynamicFrameEventFilter, mListener)
@ -114,13 +117,45 @@ nsSessionStoreUtils::ForEachNonDynamicChildFrame(mozIDOMWindowProxy* aWindow,
}
NS_IMETHODIMP
nsSessionStoreUtils::CreateDynamicFrameEventFilter(nsIDOMEventListener* aListener,
nsIDOMEventListener** aResult)
nsSessionStoreUtils::AddDynamicFrameFilteredListener(nsIDOMEventTarget* aTarget,
const nsAString& aType,
JS::Handle<JS::Value> aListener,
bool aUseCapture,
JSContext* aCx,
nsISupports** aResult)
{
NS_ENSURE_TRUE(aListener, NS_ERROR_INVALID_ARG);
if (NS_WARN_IF(!aListener.isObject())) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget);
NS_ENSURE_TRUE(target, NS_ERROR_NO_INTERFACE);
JS::Rooted<JSObject*> obj(aCx, &aListener.toObject());
RefPtr<EventListener> listener =
new EventListener(aCx, obj, GetIncumbentGlobal());
nsCOMPtr<nsIDOMEventListener> filter(new DynamicFrameEventFilter(listener));
nsresult rv = target->AddEventListener(aType, filter, aUseCapture);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMEventListener> filter(new DynamicFrameEventFilter(aListener));
filter.forget(aResult);
return NS_OK;
}
NS_IMETHODIMP
nsSessionStoreUtils::RemoveDynamicFrameFilteredListener(nsIDOMEventTarget* aTarget,
const nsAString& aType,
nsISupports* aListener,
bool aUseCapture)
{
nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget);
NS_ENSURE_TRUE(target, NS_ERROR_NO_INTERFACE);
nsCOMPtr<nsIDOMEventListener> listener = do_QueryInterface(aListener);
NS_ENSURE_TRUE(listener, NS_ERROR_NO_INTERFACE);
target->RemoveEventListener(aType, listener, aUseCapture);
return NS_OK;
}

View File

@ -155,8 +155,7 @@ function PreviewController(win, tab) {
}
PreviewController.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsITaskbarPreviewController,
Ci.nsIDOMEventListener]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsITaskbarPreviewController]),
destroy() {
this.tab.removeEventListener("TabAttrModified", this);
@ -333,7 +332,7 @@ PreviewController.prototype = {
return true;
},
// nsIDOMEventListener
// EventListener
handleEvent(evt) {
switch (evt.type) {
case "TabAttrModified":
@ -496,7 +495,7 @@ TabWindow.prototype = {
}
},
// nsIDOMEventListener
// EventListener
handleEvent(evt) {
let tab = evt.originalTarget;
switch (evt.type) {

View File

@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 33.0
Version 34.0
Comparison: https://github.com/devtools-html/debugger.html/compare/release-32...release-33
Comparison: https://github.com/devtools-html/debugger.html/compare/release-33...release-34
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.0

View File

@ -326,18 +326,6 @@ menuseparator {
--reference-color: var(--theme-highlight-purple);
}
.theme-firebug {
--number-color: #000088;
--string-color: #ff0000;
--null-color: #787878;
--object-color: DarkGreen;
--caption-color: #444444;
--location-color: #555555;
--source-link-color: blue;
--node-color: rgb(0, 0, 136);
--reference-color: rgb(102, 102, 255);
}
/******************************************************************************/
.objectLink:hover {
@ -1078,10 +1066,6 @@ html[dir="rtl"] .tree-node img.arrow {
font-family: Menlo, monospace;
}
.project-text-search .result.focused {
background-color: var(--search-overlays-semitransparent);
}
.project-text-search .result .query-match {
background-color: var(--theme-selection-background);
color: white;
@ -1090,10 +1074,6 @@ html[dir="rtl"] .tree-node img.arrow {
border-radius: 2px;
}
.project-text-search .result.focused .line-number {
font-weight: bolder;
}
.project-text-search .result .line-number {
margin-right: 1em;
width: 2em;
@ -1121,10 +1101,6 @@ html[dir="rtl"] .tree-node img.arrow {
margin: 2px 0 2px 0;
}
.project-text-search .file-result.focused {
background-color: var(--search-overlays-semitransparent);
}
.project-text-search .line-match {
display: "flex";
flex-grow: 1;
@ -1148,6 +1124,22 @@ html[dir="rtl"] .tree-node img.arrow {
.project-text-search .managed-tree .tree {
height: 100%;
}
/* Focus values */
.project-text-search .file-result.focused,
.project-text-search .result.focused {
background-color: var(--theme-selection-background);
}
.project-text-search .result.focused .line-number {
font-weight: bolder;
}
.project-text-search .result.focused .query-match {
background-color: #ffffff;
color: #000000;
}
/* 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/>. */
@ -2925,7 +2917,8 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
display: inline-block;
}
.CodeMirror.cm-s-mozilla-breakpoint .CodeMirror-code {
.CodeMirror.cm-s-mozilla-breakpoint .CodeMirror-code,
.CodeMirror.cm-s-mozilla-breakpoint .CodeMirror-scroll {
cursor: default;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
@ -3009,10 +3002,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
background-color: var(--theme-selection-background-hover);
}
:root.theme-firebug .expression-container:hover {
background-color: var(--theme-selection-background-hover);
}
.tree .tree-node:not(.focused):hover {
background-color: transparent;
}
@ -3158,8 +3147,7 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
flex-shrink: 0;
}
.theme-light .frames .location,
.theme-firebug .frames .location {
.theme-light .frames .location {
color: var(--theme-comment);
}
@ -3194,7 +3182,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
}
:root.theme-light .frames ul li.selected .location,
:root.theme-firebug .frames ul li.selected .location,
:root.theme-dark .frames ul li.selected .location {
color: white;
}
@ -4067,7 +4054,6 @@ html .welcomebox .toggle-button-end.collapsed {
line-height: 1.5em;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

View File

@ -5113,6 +5113,14 @@ function showSource(sourceId) {
return ({ dispatch, getState }) => {
const source = (0, _selectors.getSource)(getState(), sourceId);
if ((0, _selectors.getPaneCollapse)(getState(), "start")) {
dispatch({
type: "TOGGLE_PANE",
position: "start",
paneCollapsed: false
});
}
dispatch(setPrimaryPaneTab("sources"));
dispatch({
type: "SHOW_SOURCE",
@ -6433,10 +6441,7 @@ function getMappedExpression(expression) {
return expression;
}
return await dispatch({
type: "MAP_EXPRESSION_RESULT",
[_promise.PROMISE]: parser.mapOriginalExpression(expression, mappings)
});
return parser.mapOriginalExpression(expression, mappings);
};
}
@ -6616,14 +6621,31 @@ var _WasmDis = __webpack_require__(678);
var wasmStates = Object.create(null);
function maybeWasmSectionNameResolver(data) {
try {
const parser = new _WasmParser.BinaryReader();
parser.setData(data.buffer, 0, data.length);
const reader = new _WasmDis.NameSectionReader();
reader.read(parser);
return reader.hasValidNames() ? reader.getNameResolver() : null;
} catch (ex) {
// Ignoring any errors during names section retrival.
return null;
}
}
/**
* @memberof utils/wasm
* @static
*/
function getWasmText(sourceId, data) {
const nameResolver = maybeWasmSectionNameResolver(data);
const parser = new _WasmParser.BinaryReader();
parser.setData(data.buffer, 0, data.length);
const dis = new _WasmDis.WasmDisassembler();
if (nameResolver) {
dis.nameResolver = nameResolver;
}
dis.addOffsets = true;
const done = dis.disassembleChunk(parser);
let result = dis.getResult();
@ -7019,9 +7041,18 @@ class ManagedTree extends _react.Component {
if (expanded.has(this.props.getPath(highlightItems[0]))) {
this.focusItem(highlightItems[0]);
} else {
// Look at folders starting from the top-level until finds a
// closed folder and highlights this folder
const index = highlightItems.reverse().findIndex(item => !expanded.has(this.props.getPath(item)));
// Look at folders starting from the top-level and expand all the items
// which lie in the path of the item to be highlighted
highlightItems.reverse();
let index = highlightItems.findIndex(item => !expanded.has(this.props.getPath(item)));
if (this.props.autoExpandOnHighlight) {
while (index < highlightItems.length - 1) {
this.setExpanded(highlightItems[index], true, false);
index++;
}
}
this.focusItem(highlightItems[index]);
}
}
@ -7103,7 +7134,7 @@ function getURL(sourceUrl, debuggeeUrl = "") {
// A Webpack source is a special case
return (0, _lodash.merge)(def, {
path: path,
group: "Webpack",
group: "webpack://",
filename: filename
});
@ -7111,7 +7142,7 @@ function getURL(sourceUrl, debuggeeUrl = "") {
// An Angular source is a special case
return (0, _lodash.merge)(def, {
path: path,
group: "Angular",
group: "ng://",
filename: filename
});
@ -9892,7 +9923,7 @@ function isUnderRoot(url, projectRoot) {
return true;
}
return `/${url.group}${url.path}`.startsWith(projectRoot);
return `${url.group}${url.path}`.startsWith(projectRoot);
} /* 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/>. */
@ -9958,7 +9989,7 @@ function traverseTree(url, tree, debuggeeHost, projectRoot) {
let path = "";
return parts.reduce((subTree, part, index) => {
path = `${path}/${part}`;
path = path ? `${path}/${part}` : part;
const debuggeeHostIfRoot = index === 0 ? debuggeeHost : null;
return findOrCreateNode(parts, subTree, path, part, index, url, debuggeeHostIfRoot);
}, tree);
@ -12874,8 +12905,12 @@ var _pause = __webpack_require__(1394);
var _sources = __webpack_require__(1369);
function visibleSourceId(location) {
return (0, _devtoolsSourceMap.isOriginalId)(location.sourceId) ? (0, _devtoolsSourceMap.originalToGeneratedId)(location.sourceId) : location.sourceId;
function getGeneratedId(sourceId) {
if ((0, _devtoolsSourceMap.isOriginalId)(sourceId)) {
return (0, _devtoolsSourceMap.originalToGeneratedId)(sourceId);
}
return sourceId;
}
/*
@ -12894,7 +12929,11 @@ function isSelectedFrameVisible(state) {
return false;
}
return visibleSourceId(selectedLocation) === visibleSourceId(selectedFrame.location);
if ((0, _devtoolsSourceMap.isOriginalId)(selectedLocation.sourceId)) {
return selectedLocation.sourceId === selectedFrame.location.sourceId;
}
return selectedLocation.sourceId === getGeneratedId(selectedFrame.location.sourceId);
}
/***/ }),
@ -16159,7 +16198,7 @@ function findSource(sourceTree, sourceUrl) {
function getDirectories(sourceUrl, sourceTree) {
const url = (0, _getURL.getURL)(sourceUrl);
const fullUrl = `/${url.group}${url.path}`;
const fullUrl = `${url.group}${url.path}`;
const parentMap = (0, _utils.createParentMap)(sourceTree);
const source = findSource(sourceTree, fullUrl);
if (!source) {
@ -16737,6 +16776,15 @@ class SourcesTree extends _react.Component {
}
}
renderItemName(name) {
const hosts = {
"ng://": "Angular",
"webpack://": "Webpack"
};
return hosts[name] || name;
}
renderEmptyElement(message) {
return _react2.default.createElement(
"div",
@ -16803,6 +16851,7 @@ class SourcesTree extends _react.Component {
const treeProps = {
autoExpandAll: false,
autoExpandDepth: expanded ? 0 : 1,
autoExpandOnHighlight: true,
expanded,
getChildren: item => (0, _sourcesTree.nodeHasChildren)(item) ? item.contents : [],
getParent: item => parentMap.get(item),
@ -16874,7 +16923,7 @@ var _initialiseProps = function () {
this.getIcon = (sources, item, depth) => {
const { debuggeeUrl, projectRoot } = this.props;
if (item.path === "/Webpack") {
if (item.path === "webpack://") {
return _react2.default.createElement(_Svg2.default, { name: "webpack" });
}
if (item.path === "/Angular") {
@ -16986,7 +17035,7 @@ var _initialiseProps = function () {
"span",
{ className: "label" },
" ",
item.name,
this.renderItemName(item.name),
" "
)
);
@ -18295,9 +18344,7 @@ class Preview extends _react.PureComponent {
this.onMouseOver = e => {
const { target } = e;
if (this.props.selectedFrameVisible) {
this.props.updatePreview(target, this.props.editor);
}
this.props.updatePreview(target, this.props.editor);
};
this.onMouseUp = () => {
@ -18384,8 +18431,7 @@ const {
exports.default = (0, _reactRedux.connect)(state => ({
preview: (0, _selectors.getPreview)(state),
selectedSource: (0, _selectors.getSelectedSource)(state),
selectedFrameVisible: (0, _selectors.isSelectedFrameVisible)(state)
selectedSource: (0, _selectors.getSelectedSource)(state)
}), {
addExpression,
setPopupObjectProperties,
@ -30462,7 +30508,7 @@ function updatePreview(target, editor) {
return;
}
if (!(0, _selectors.isLineInScope)(getState(), tokenPos.line)) {
if (!(0, _selectors.isSelectedFrameVisible)(getState()) || !(0, _selectors.isLineInScope)(getState(), tokenPos.line)) {
return;
}
@ -38777,7 +38823,6 @@ function formatSource(source, root) {
function getRelativeSources(state) {
const sources = (0, _selectors.getSources)(state);
const root = (0, _selectors.getProjectDirectoryRoot)(state);
return sources.valueSeq().toJS().filter(({ url }) => url && url.includes(root)).map(source => formatSource(source, root));
}
@ -38986,6 +39031,7 @@ class BreakpointItem extends _react.Component {
// $FlowIgnore
mountNode.innerHTML = "";
this.editor.appendToLocalElement(mountNode);
this.editor.codeMirror.on("mousedown", (_, e) => e.preventDefault());
}
}
}

View File

@ -9,10 +9,6 @@ add_task(async function() {
await waitForSources(dbg, "doc-asm.html", "asm.js");
// Expand nodes and make sure more sources appear.
is(findAllElements(dbg, "sourceNodes").length, 2);
await clickElement(dbg, "sourceDirectoryLabel", 2);
is(findAllElements(dbg, "sourceNodes").length, 4);
await selectSource(dbg, "asm.js");

View File

@ -1,6 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests for preview through Babel's compile output.
requestLongerTimeout(3);
function getCoordsFromPosition(cm, { line, ch }) {
return cm.charCoords({ line: ~~line, ch: ~~ch });
}

View File

@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
// This test can be really slow on debug platforms and should be split.
requestLongerTimeout(4);
requestLongerTimeout(6);
// Tests loading sourcemapped sources for Babel's compile output.

View File

@ -1,24 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function getCoordsFromPosition(cm, { line, ch }) {
return cm.charCoords({ line: ~~line, ch: ~~ch });
}
function hoverAtPos(dbg, { line, ch }) {
info(`Hovering at (${line}, ${ch})\n`);
const cm = getCM(dbg);
const coords = getCoordsFromPosition(cm, { line: line - 1, ch });
const tokenEl = dbg.win.document.elementFromPoint(coords.left, coords.top);
const previewed = waitForDispatch(dbg, "SET_PREVIEW");
tokenEl.dispatchEvent(
new MouseEvent("mouseover", {
bubbles: true,
cancelable: true,
view: dbg.win
})
);
return previewed;
async function assertNoTooltip(dbg) {
await waitForTime(200);
const el = findElement(dbg, "tooltip");
is(el, null, "Tooltip should not exist")
}
function assertPreviewTooltip(dbg, { result, expression }) {
@ -58,12 +45,21 @@ add_task(async function() {
await waitForPaused(dbg);
await waitForSelectedSource(dbg, "times2");
await hoverAtPos(dbg, { line: 2, ch: 9 });
assertPreviewTooltip(dbg, { result: 4, expression: "x" });
info(`Test previewing in the original location`)
await assertPreviews(dbg, [
{ line: 2, column: 10, result: 4, expression: "x" }
]);
info(`Test previewing in the generated location`)
await dbg.actions.jumpToMappedSelectedLocation();
await waitForSelectedSource(dbg, "bundle.js");
await assertPreviews(dbg, [
{ line: 70, column: 11, result: 4, expression: "x" }
]);
await hoverAtPos(dbg, { line: 70, ch: 10 });
assertPreviewTooltip(dbg, { result: 4, expression: "x" });
info(`Test that you can not preview in another original file`);
await selectSource(dbg, "output");
await hoverAtPos(dbg, { line: 2, ch: 16 });
await assertNoTooltip(dbg)
});

View File

@ -22,6 +22,23 @@ function getLabel(dbg, index) {
.replace(/^[\s\u200b]*/g, "");
}
add_task(async function() {
const dbg = await initDebugger("doc-sources.html");
const { selectors: { getSelectedSource, getExpandedState }, getState } = dbg;
await waitForSources(dbg, "nested-source");
await selectSource(dbg, "nested-source");
const expanded = getExpandedState(getState());
ok(
expanded.has(
`example.com/browser/devtools/client/debugger/new/test/mochitest/examples/nested/nested/`
),
"Nodes in path are automatically expanded"
);
});
add_task(async function() {
const dbg = await initDebugger("doc-sources.html");
const { selectors: { getSelectedSource }, getState } = dbg;

View File

@ -16,6 +16,7 @@ support-files =
doc_edit_imported_selector.html
doc_filter.html
doc_frame_script.js
doc_grid_names.html
doc_inline_sourcemap.html
doc_invalid_sourcemap.css
doc_invalid_sourcemap.html
@ -176,6 +177,7 @@ skip-if = (os == "win" && debug) # bug 963492: win.
[browser_rules_grid-toggle_02.js]
[browser_rules_grid-toggle_03.js]
[browser_rules_grid-toggle_04.js]
[browser_rules_gridline-names-autocomplete.js]
[browser_rules_guessIndentation.js]
[browser_rules_highlight-used-fonts.js]
[browser_rules_inherited-properties_01.js]

View File

@ -0,0 +1,169 @@
/* 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";
// Tests that CSS property values are autocompleted and cycled
// correctly when editing an existing property in the rule view.
// format :
// [
// what key to press,
// modifers,
// expected input box value after keypress,
// is the popup open,
// is a suggestion selected in the popup,
// expect ruleview-changed,
// ]
const OPEN = true, SELECTED = true, CHANGE = true;
const changeTestData = [
["c", {}, "col1-start", OPEN, SELECTED, CHANGE],
["o", {}, "col1-start", OPEN, SELECTED, CHANGE],
["l", {}, "col1-start", OPEN, SELECTED, CHANGE],
["VK_DOWN", {}, "col2-start", OPEN, SELECTED, CHANGE],
["VK_RIGHT", {}, "col2-start", !OPEN, !SELECTED, !CHANGE],
];
// Creates a new CSS property value.
// Checks that grid-area autocompletes column and row names.
const newAreaTestData = [
["g", {}, "grid", OPEN, SELECTED, !CHANGE],
["VK_DOWN", {}, "grid-area", OPEN, SELECTED, !CHANGE],
["VK_TAB", {}, "", !OPEN, !SELECTED, !CHANGE],
"grid-line-names-updated",
["c", {}, "col1-start", OPEN, SELECTED, CHANGE],
["VK_BACK_SPACE", {}, "c", !OPEN, !SELECTED, CHANGE],
["VK_BACK_SPACE", {}, "", !OPEN, !SELECTED, CHANGE],
["r", {}, "row1-start", OPEN, SELECTED, CHANGE],
["r", {}, "rr", !OPEN, !SELECTED, CHANGE],
["VK_BACK_SPACE", {}, "r", !OPEN, !SELECTED, CHANGE],
["o", {}, "row1-start", OPEN, SELECTED, CHANGE],
["VK_RETURN", {}, "", !OPEN, !SELECTED, CHANGE],
];
// Creates a new CSS property value.
// Checks that grid-row only autocompletes row names.
const newRowTestData = [
["g", {}, "grid", OPEN, SELECTED, !CHANGE],
["r", {}, "grid", OPEN, SELECTED, !CHANGE],
["i", {}, "grid", OPEN, SELECTED, !CHANGE],
["d", {}, "grid", OPEN, SELECTED, !CHANGE],
["-", {}, "grid-area", OPEN, SELECTED, !CHANGE],
["r", {}, "grid-row", OPEN, SELECTED, !CHANGE],
["VK_RETURN", {}, "", !OPEN, !SELECTED, !CHANGE],
"grid-line-names-updated",
["c", {}, "c", !OPEN, !SELECTED, CHANGE],
["VK_BACK_SPACE", {}, "", !OPEN, !SELECTED, CHANGE],
["r", {}, "row1-start", OPEN, SELECTED, CHANGE],
["VK_TAB", {}, "", !OPEN, !SELECTED, CHANGE],
];
const TEST_URL = URL_ROOT + "doc_grid_names.html";
add_task(async function() {
await addTab(TEST_URL);
let {toolbox, inspector, view} = await openRuleView();
info("Test autocompletion changing a preexisting property");
await runChangePropertyAutocompletionTest(toolbox, inspector, view, changeTestData);
info("Test autocompletion creating a new property");
await runNewPropertyAutocompletionTest(toolbox, inspector, view, newAreaTestData);
info("Test autocompletion creating a new property");
await runNewPropertyAutocompletionTest(toolbox, inspector, view, newRowTestData);
});
async function runNewPropertyAutocompletionTest(toolbox, inspector, view, testData) {
info("Selecting the test node");
await selectNode("#cell2", inspector);
info("Focusing the css property editable field");
let ruleEditor = getRuleViewRuleEditor(view, 0);
let editor = await focusNewRuleViewProperty(ruleEditor);
let gridLineNamesUpdated = inspector.once("grid-line-names-updated");
info("Starting to test for css property completion");
for (let data of testData) {
if (data == "grid-line-names-updated") {
await gridLineNamesUpdated;
continue;
}
await testCompletion(data, editor, view);
}
}
async function runChangePropertyAutocompletionTest(toolbox, inspector, view, testData) {
info("Selecting the test node");
await selectNode("#cell3", inspector);
let ruleEditor = getRuleViewRuleEditor(view, 1).rule;
let prop = ruleEditor.textProps[0];
info("Focusing the css property editable value");
let gridLineNamesUpdated = inspector.once("grid-line-names-updated");
let editor = await focusEditableField(view, prop.editor.valueSpan);
await gridLineNamesUpdated;
info("Starting to test for css property completion");
for (let data of testData) {
// Re-define the editor at each iteration, because the focus may have moved
// from property to value and back
editor = inplaceEditor(view.styleDocument.activeElement);
await testCompletion(data, editor, view);
}
}
async function testCompletion([key, modifiers, completion, open, selected, change],
editor, view) {
info("Pressing key " + key);
info("Expecting " + completion);
info("Is popup opened: " + open);
info("Is item selected: " + selected);
let onDone;
if (change) {
// If the key triggers a ruleview-changed, wait for that event, it will
// always be the last to be triggered and tells us when the preview has
// been done.
onDone = view.once("ruleview-changed");
} else {
// Otherwise, expect an after-suggest event (except if the popup gets
// closed).
onDone = key !== "VK_RIGHT" && key !== "VK_BACK_SPACE"
? editor.once("after-suggest")
: null;
}
// Also listening for popup opened/closed events if needed.
let popupEvent = open ? "popup-opened" : "popup-closed";
let onPopupEvent = editor.popup.isOpen !== open ? once(editor.popup, popupEvent) : null;
info("Synthesizing key " + key + ", modifiers: " + Object.keys(modifiers));
EventUtils.synthesizeKey(key, modifiers, view.styleWindow);
// Flush the debounce for the preview text.
view.debounce.flush();
await onDone;
await onPopupEvent;
// The key might have been a TAB or shift-TAB, in which case the editor will
// be a new one
editor = inplaceEditor(view.styleDocument.activeElement);
info("Checking the state");
if (completion !== null) {
is(editor.input.value, completion, "Correct value is autocompleted");
}
if (!open) {
ok(!(editor.popup && editor.popup.isOpen), "Popup is closed");
} else {
ok(editor.popup.isOpen, "Popup is open");
is(editor.popup.selectedIndex !== -1, selected, "An item is selected");
}
}

View File

@ -0,0 +1,17 @@
<!doctype html>
<style type='text/css'>
#grid {
display: grid;
grid-template-rows: [row1-start] auto [row2-start] auto [row2-end];
grid-template-columns: [col1-start] 100px [col2-start] 100px [col3-start] 100px [col3-end];
}
#cell3 {
grid-column: "col3-start";
grid-row: "row2-start";
}
</style>
<div id="grid">
<div>cell1</div>
<div id="cell2">cell2</div>
<div id="cell3">cell3</div>
</div>

View File

@ -84,17 +84,18 @@ function TextPropertyEditor(ruleEditor, property) {
const toolbox = this.ruleView.inspector.toolbox;
this.cssProperties = getCssProperties(toolbox);
this.getGridlineNames = this.getGridlineNames.bind(this);
this.update = this.update.bind(this);
this.updatePropertyState = this.updatePropertyState.bind(this);
this._onEnableClicked = this._onEnableClicked.bind(this);
this._onExpandClicked = this._onExpandClicked.bind(this);
this._onStartEditing = this._onStartEditing.bind(this);
this._onNameDone = this._onNameDone.bind(this);
this._onValueDone = this._onValueDone.bind(this);
this._onStartEditing = this._onStartEditing.bind(this);
this._onSwatchCommit = this._onSwatchCommit.bind(this);
this._onSwatchPreview = this._onSwatchPreview.bind(this);
this._onSwatchRevert = this._onSwatchRevert.bind(this);
this._onValidate = this.ruleView.debounce(this._previewValue, 10, this);
this.update = this.update.bind(this);
this.updatePropertyState = this.updatePropertyState.bind(this);
this._onValueDone = this._onValueDone.bind(this);
this._create();
this.update();
@ -316,10 +317,42 @@ TextPropertyEditor.prototype = {
maxWidth: () => this.container.getBoundingClientRect().width,
cssProperties: this.cssProperties,
cssVariables: this.rule.elementStyle.variables,
getGridLineNames: this.getGridlineNames,
});
}
},
/**
* Get the grid line names of the grid that the currently selected element is
* contained in.
*
* @return {Object} Contains the names of the cols and rows as arrays
* {cols: [], rows: []}.
*/
getGridlineNames: async function() {
let gridLineNames = {cols: [], rows: []};
let layoutInspector = await this.ruleView.inspector.walker.getLayoutInspector();
let gridFront = await layoutInspector.getCurrentGrid(
this.ruleView.inspector.selection.nodeFront);
if (gridFront) {
let gridFragments = gridFront.gridFragments;
for (let gridFragment of gridFragments) {
for (let rowLine of gridFragment.rows.lines) {
gridLineNames.rows = gridLineNames.rows.concat(rowLine.names);
}
for (let colLine of gridFragment.cols.lines) {
gridLineNames.cols = gridLineNames.cols.concat(colLine.names);
}
}
}
// Emit message for test files
this.ruleView.inspector.emit("grid-line-names-updated");
return gridLineNames;
},
/**
* Get the path from which to resolve requests for this
* rule's stylesheet.

View File

@ -58,10 +58,6 @@ netmonitor.security.notAvailable=<Not Available>
# that collapses the network details pane in the UI.
collapseDetailsPane=Hide request details
# LOCALIZATION NOTE (expandDetailsPane): This is the tooltip for the button
# that expands the network details pane in the UI.
expandDetailsPane=Show request details
# LOCALIZATION NOTE (headersEmptyText): This is the text displayed in the
# headers tab of the network details pane when there are no headers available.
headersEmptyText=No headers for this request

View File

@ -45,27 +45,3 @@
margin-inline-end: 3px;
white-space: nowrap;
}
/* Network details panel toggle */
.network-details-panel-toggle:dir(ltr)::before,
.network-details-panel-toggle.pane-collapsed:dir(rtl)::before {
background-image: var(--theme-pane-collapse-image);
}
.network-details-panel-toggle.pane-collapsed:dir(ltr)::before,
.network-details-panel-toggle:dir(rtl)::before {
background-image: var(--theme-pane-expand-image);
}
/* Responsive web design support */
@media (max-width: 700px) {
.network-details-panel-toggle:dir(ltr)::before {
transform: rotate(90deg);
}
.network-details-panel-toggle:dir(rtl)::before {
transform: rotate(-90deg);
}
}

View File

@ -2,6 +2,7 @@
* 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 "resource://devtools/client/shared/components/SidebarToggle.css";
@import "resource://devtools/client/shared/components/splitter/SplitBox.css";
@import "resource://devtools/client/shared/components/tree/TreeView.css";
@import "resource://devtools/client/shared/components/tabs/Tabs.css";

View File

@ -31,6 +31,7 @@ function NetworkDetailsPanel({
request,
selectTab,
sourceMapService,
toggleNetworkDetails,
openLink,
}) {
if (!request) {
@ -48,6 +49,7 @@ function NetworkDetailsPanel({
request,
selectTab,
sourceMapService,
toggleNetworkDetails,
}) :
CustomRequestPanel({
connector,
@ -67,6 +69,7 @@ NetworkDetailsPanel.propTypes = {
request: PropTypes.object,
selectTab: PropTypes.func.isRequired,
sourceMapService: PropTypes.object,
toggleNetworkDetails: PropTypes.func.isRequired,
openLink: PropTypes.func,
};
@ -78,5 +81,6 @@ module.exports = connect(
(dispatch) => ({
cloneSelectedRequest: () => dispatch(Actions.cloneSelectedRequest()),
selectTab: (tabId) => dispatch(Actions.selectDetailsPanelTab(tabId)),
toggleNetworkDetails: () => dispatch(Actions.toggleNetworkDetails()),
}),
)(NetworkDetailsPanel);

View File

@ -20,6 +20,7 @@ const SecurityPanel = createFactory(require("./SecurityPanel"));
const StackTracePanel = createFactory(require("./StackTracePanel"));
const TimingsPanel = createFactory(require("./TimingsPanel"));
const COLLAPSE_DETAILS_PANE = L10N.getStr("collapseDetailsPane");
const COOKIES_TITLE = L10N.getStr("netmonitor.tab.cookies");
const HEADERS_TITLE = L10N.getStr("netmonitor.tab.headers");
const PARAMS_TITLE = L10N.getStr("netmonitor.tab.params");
@ -40,6 +41,7 @@ function TabboxPanel({
request,
selectTab,
sourceMapService,
toggleNetworkDetails,
}) {
if (!request) {
return null;
@ -52,6 +54,12 @@ function TabboxPanel({
onSelect: selectTab,
renderOnlySelected: true,
showAllTabsMenu: true,
sidebarToggleButton: {
collapsed: false,
collapsePaneTitle: COLLAPSE_DETAILS_PANE,
expandPaneTitle: "",
onClick: toggleNetworkDetails,
},
},
TabPanel({
id: PANELS.HEADERS,

View File

@ -15,7 +15,6 @@ const { FILTER_SEARCH_DELAY, FILTER_TAGS } = require("../constants");
const {
getRecordingState,
getTypeFilteredRequests,
isNetworkDetailsToggleButtonDisabled,
} = require("../selectors/index");
const { autocompleteProvider } = require("../utils/filter-autocomplete-provider");
const { L10N } = require("../utils/l10n");
@ -27,8 +26,6 @@ const SearchBox = createFactory(require("devtools/client/shared/components/Searc
const { button, div, input, label, span } = dom;
// Localization
const COLLAPSE_DETAILS_PANE = L10N.getStr("collapseDetailsPane");
const EXPAND_DETAILS_PANE = L10N.getStr("expandDetailsPane");
const SEARCH_KEY_SHORTCUT = L10N.getStr("netmonitor.toolbar.filterFreetext.key");
const SEARCH_PLACE_HOLDER = L10N.getStr("netmonitor.toolbar.filterFreetext.label");
const TOOLBAR_CLEAR = L10N.getStr("netmonitor.toolbar.clear");
@ -61,9 +58,6 @@ class Toolbar extends Component {
clearRequests: PropTypes.func.isRequired,
requestFilterTypes: PropTypes.object.isRequired,
setRequestFilterText: PropTypes.func.isRequired,
networkDetailsToggleDisabled: PropTypes.bool.isRequired,
networkDetailsOpen: PropTypes.bool.isRequired,
toggleNetworkDetails: PropTypes.func.isRequired,
enablePersistentLogs: PropTypes.func.isRequired,
togglePersistentLogs: PropTypes.func.isRequired,
persistentLogsEnabled: PropTypes.bool.isRequired,
@ -92,9 +86,7 @@ class Toolbar extends Component {
}
shouldComponentUpdate(nextProps) {
return this.props.networkDetailsOpen !== nextProps.networkDetailsOpen
|| this.props.networkDetailsToggleDisabled !== nextProps.networkDetailsToggleDisabled
|| this.props.persistentLogsEnabled !== nextProps.persistentLogsEnabled
return this.props.persistentLogsEnabled !== nextProps.persistentLogsEnabled
|| this.props.browserCacheDisabled !== nextProps.browserCacheDisabled
|| this.props.recording !== nextProps.recording
|| !Object.is(this.props.requestFilterTypes, nextProps.requestFilterTypes)
@ -149,9 +141,6 @@ class Toolbar extends Component {
clearRequests,
requestFilterTypes,
setRequestFilterText,
networkDetailsToggleDisabled,
networkDetailsOpen,
toggleNetworkDetails,
togglePersistentLogs,
persistentLogsEnabled,
toggleBrowserCache,
@ -186,19 +175,6 @@ class Toolbar extends Component {
recording ? "devtools-pause-icon" : "devtools-play-icon",
].join(" ");
// Detail toggle button
let toggleDetailButtonClassList = [
"network-details-panel-toggle",
"devtools-button",
];
if (!networkDetailsOpen) {
toggleDetailButtonClassList.push("pane-collapsed");
}
let toggleDetailButtonClass = toggleDetailButtonClassList.join(" ");
let toggleDetailButtonTitle = networkDetailsOpen ? COLLAPSE_DETAILS_PANE :
EXPAND_DETAILS_PANE;
// Render the entire toolbar.
return (
span({ className: "devtools-toolbar devtools-toolbar-container" },
@ -253,14 +229,7 @@ class Toolbar extends Component {
onChange: setRequestFilterText,
onFocus: this.onSearchBoxFocus,
autocompleteProvider: this.autocompleteProvider,
}),
button({
className: toggleDetailButtonClass,
title: toggleDetailButtonTitle,
disabled: networkDetailsToggleDisabled,
tabIndex: "0",
onClick: toggleNetworkDetails,
}),
})
)
)
);
@ -271,8 +240,6 @@ module.exports = connect(
(state) => ({
browserCacheDisabled: state.ui.browserCacheDisabled,
filteredRequests: getTypeFilteredRequests(state),
networkDetailsToggleDisabled: isNetworkDetailsToggleButtonDisabled(state),
networkDetailsOpen: state.ui.networkDetailsOpen,
persistentLogsEnabled: state.ui.persistentLogsEnabled,
recording: getRecordingState(state),
requestFilterTypes: state.filters.requestFilterTypes,
@ -283,7 +250,6 @@ module.exports = connect(
enablePersistentLogs: (enabled) => dispatch(Actions.enablePersistentLogs(enabled)),
setRequestFilterText: (text) => dispatch(Actions.setRequestFilterText(text)),
toggleBrowserCache: () => dispatch(Actions.toggleBrowserCache()),
toggleNetworkDetails: () => dispatch(Actions.toggleNetworkDetails()),
toggleRecording: () => dispatch(Actions.toggleRecording()),
togglePersistentLogs: () => dispatch(Actions.togglePersistentLogs()),
toggleRequestFilterType: (type) => dispatch(Actions.toggleRequestFilterType(type)),

View File

@ -6,14 +6,9 @@
const { createSelector } = require("devtools/client/shared/vendor/reselect");
const { REQUESTS_WATERFALL } = require("../constants");
const { getDisplayedRequests } = require("./requests");
const EPSILON = 0.001;
function isNetworkDetailsToggleButtonDisabled(state) {
return getDisplayedRequests(state).length == 0;
}
const getWaterfallScale = createSelector(
state => state.requests,
state => state.timingMarkers,
@ -36,6 +31,5 @@ const getWaterfallScale = createSelector(
);
module.exports = {
isNetworkDetailsToggleButtonDisabled,
getWaterfallScale,
};

View File

@ -49,8 +49,7 @@ add_task(async function() {
wait = waitForDOM(document, ".CodeMirror-code");
let onResponseContent = monitor.panelWin.once(EVENTS.RECEIVED_RESPONSE_CONTENT);
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -13,7 +13,6 @@ add_task(async function() {
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let detailsPanelToggleButton = document.querySelector(".network-details-panel-toggle");
let clearButton = document.querySelector(".requests-list-clear-button");
store.dispatch(Actions.batchEnable(false));
@ -40,11 +39,11 @@ add_task(async function() {
assertSingleRequestState();
// Make sure we can now open the network details panel
EventUtils.sendMouseEvent({ type: "click" }, detailsPanelToggleButton);
ok(document.querySelector(".network-details-panel") &&
store.dispatch(Actions.toggleNetworkDetails());
let detailsPanelToggleButton = document.querySelector(".sidebar-toggle");
ok(detailsPanelToggleButton &&
!detailsPanelToggleButton.classList.contains("pane-collapsed"),
"The details pane should be visible after clicking the toggle button.");
"The details pane should be visible.");
// Click clear and make sure the details pane closes
EventUtils.sendMouseEvent({ type: "click" }, clearButton);
@ -61,8 +60,6 @@ add_task(async function() {
function assertSingleRequestState() {
is(store.getState().requests.requests.size, 1,
"The request menu should have one item at this point.");
is(detailsPanelToggleButton.hasAttribute("disabled"), false,
"The pane toggle button should be enabled after a request is made.");
}
/**
@ -71,7 +68,5 @@ add_task(async function() {
function assertNoRequestState() {
is(store.getState().requests.requests.size, 0,
"The request menu should be empty at this point.");
is(detailsPanelToggleButton.hasAttribute("disabled"), true,
"The pane toggle button should be disabled when the request menu is cleared.");
}
});

View File

@ -21,8 +21,7 @@ add_task(async function() {
await performRequests(monitor, tab, 1);
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -51,8 +51,7 @@ add_task(async function() {
});
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -43,8 +43,7 @@ add_task(async function() {
});
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -20,7 +20,12 @@ add_task(async function() {
// Execute requests.
await performRequests(monitor, tab, 1);
await openResponsePanel();
let onReponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await onReponsePanelReady;
checkResponsePanelDisplaysJSON();
let tabpanel = document.querySelector("#response-panel");
@ -57,17 +62,4 @@ add_task(async function() {
is(panel.querySelector(".response-image-box") === null, true,
"The response image box doesn't have the intended visibility.");
}
/**
* Open the netmonitor details panel and switch to the response tab.
* Returns a promise that will resolve when the response panel DOM element is available.
*/
function openResponsePanel() {
let onReponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
return onReponsePanelReady;
}
});

View File

@ -45,8 +45,7 @@ add_task(async function() {
});
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -46,8 +46,7 @@ add_task(async function() {
});
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -64,8 +64,7 @@ add_task(async function() {
info("Testing first request");
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -50,8 +50,7 @@ add_task(async function() {
});
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -11,40 +11,41 @@ add_task(async function() {
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, windowRequire } = monitor.panelWin;
let { document, store, windowRequire } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
let { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs");
let detailsPaneToggleButton = document.querySelector(".network-details-panel-toggle");
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
await wait;
ok(!document.querySelector(".network-details-panel") &&
detailsPaneToggleButton.classList.contains("pane-collapsed"),
!document.querySelector(".sidebar-toggle"),
"The details panel should initially be hidden.");
EventUtils.sendMouseEvent({ type: "click" }, detailsPaneToggleButton);
store.dispatch(Actions.toggleNetworkDetails());
is(~~(document.querySelector(".network-details-panel").clientWidth),
Prefs.networkDetailsWidth,
"The details panel has an incorrect width.");
ok(document.querySelector(".network-details-panel") &&
!detailsPaneToggleButton.classList.contains("pane-collapsed"),
document.querySelector(".sidebar-toggle"),
"The details panel should at this point be visible.");
EventUtils.sendMouseEvent({ type: "click" }, detailsPaneToggleButton);
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".sidebar-toggle"));
ok(!document.querySelector(".network-details-panel") &&
detailsPaneToggleButton.classList.contains("pane-collapsed"),
!document.querySelector(".sidebar-toggle"),
"The details panel should not be visible after collapsing.");
EventUtils.sendMouseEvent({ type: "click" }, detailsPaneToggleButton);
store.dispatch(Actions.toggleNetworkDetails());
is(~~(document.querySelector(".network-details-panel").clientWidth),
Prefs.networkDetailsWidth,
"The details panel has an incorrect width after uncollapsing.");
ok(document.querySelector(".network-details-panel") &&
!detailsPaneToggleButton.classList.contains("pane-collapsed"),
document.querySelector(".sidebar-toggle"),
"The details panel should be visible again after uncollapsing.");
await teardown(monitor);

View File

@ -45,24 +45,22 @@ add_task(async function() {
await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS);
await wait;
let toggleButton = document.querySelector(".network-details-panel-toggle");
info("Test with the first request in the list visible");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-all-button"));
document.querySelector(".requests-list-filter-all-button"));
testDetailsPanel(true, 0);
info("Test with first request in the list not visible");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-all-button"));
document.querySelector(".requests-list-filter-all-button"));
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-js-button"));
document.querySelector(".requests-list-filter-js-button"));
testFilterButtons(monitor, "js");
testDetailsPanel(true, 2);
info("Test with no request in the list visible i.e. no request match the filters");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".requests-list-filter-all-button"));
document.querySelector(".requests-list-filter-all-button"));
setFreetextFilter("foobar");
// The network details panel should not open as there are no available requests visible
testDetailsPanel(false);
@ -78,50 +76,36 @@ add_task(async function() {
async function testDetailsPanel(shouldPanelOpen, selectedItemIndex = 0) {
// Expected default state should be panel closed
if (shouldPanelOpen) {
// Toggle switch should be enabled only when there are visible requests
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should be enabled.");
} else {
is(toggleButton.hasAttribute("disabled"), true,
"The pane toggle button should be disabled.");
}
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should still indicate that the details pane is " +
"collapsed.");
ok(!document.querySelector(".sidebar-toggle"),
"The pane toggle button should not be visible.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should still be hidden.");
"The details pane should still be hidden.");
is(getSelectedRequest(store.getState()), null,
"There should still be no selected item in the requests menu.");
"There should still be no selected item in the requests menu.");
// Trigger the details panel toggle action
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
store.dispatch(Actions.toggleNetworkDetails());
let toggleButton = document.querySelector(".sidebar-toggle");
if (shouldPanelOpen) {
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should still be enabled after being pressed.");
is(toggleButton.classList.contains("pane-collapsed"), false,
"The pane toggle button should now indicate that the details pane is " +
"not collapsed anymore after being pressed.");
"The pane toggle button should now indicate that the details pane is " +
"not collapsed anymore after being pressed.");
is(!!document.querySelector(".network-details-panel"), true,
"The details pane should not be hidden after toggle button was pressed.");
"The details pane should not be hidden after toggle button was pressed.");
isnot(getSelectedRequest(store.getState()), null,
"There should be a selected item in the requests menu.");
"There should be a selected item in the requests menu.");
is(getSelectedIndex(store.getState()), selectedItemIndex,
`The item index ${selectedItemIndex} should be selected in the requests menu.`);
`The item index ${selectedItemIndex} should be selected in the requests menu.`);
// Close the panel
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
} else {
is(toggleButton.hasAttribute("disabled"), true,
"The pane toggle button should be disabled.");
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should still indicate that the details pane is " +
"collapsed.");
ok(!toggleButton, "The pane toggle button should be not visible.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should still be hidden.");
"The details pane should still be hidden.");
is(getSelectedRequest(store.getState()), null,
"There should still be no selected item in the requests menu.");
"There should still be no selected item in the requests menu.");
}
}
});

View File

@ -21,13 +21,8 @@ add_task(async function() {
store.dispatch(Actions.batchEnable(false));
let toggleButton = document.querySelector(".network-details-panel-toggle");
is(toggleButton.hasAttribute("disabled"), true,
"The pane toggle button should be disabled when the frontend is opened.");
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should indicate that the details pane is " +
"collapsed when the frontend is opened.");
ok(!document.querySelector(".sidebar-toggle"),
"The pane toggle button should not be visible.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should be hidden when the frontend is opened.");
is(getSelectedRequest(store.getState()), null,
@ -37,23 +32,20 @@ add_task(async function() {
tab.linkedBrowser.reload();
await networkEvent;
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should be enabled after the first request.");
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should still indicate that the details pane is " +
"collapsed after the first request.");
ok(!document.querySelector(".sidebar-toggle"),
"The pane toggle button should not be visible after the first request.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should still be hidden after the first request.");
is(getSelectedRequest(store.getState()), null,
"There should still be no selected item in the requests menu.");
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
store.dispatch(Actions.toggleNetworkDetails());
let toggleButton = document.querySelector(".sidebar-toggle");
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should still be enabled after being pressed.");
is(toggleButton.classList.contains("pane-collapsed"), false,
"The pane toggle button should now indicate that the details pane is " +
"not collapsed anymore after being pressed.");
"not collapsed anymore.");
is(!!document.querySelector(".network-details-panel"), true,
"The details pane should not be hidden after toggle button was pressed.");
isnot(getSelectedRequest(store.getState()), null,
@ -63,11 +55,6 @@ add_task(async function() {
EventUtils.sendMouseEvent({ type: "click" }, toggleButton);
is(toggleButton.hasAttribute("disabled"), false,
"The pane toggle button should still be enabled after being pressed again.");
is(toggleButton.classList.contains("pane-collapsed"), true,
"The pane toggle button should now indicate that the details pane is " +
"collapsed after being pressed again.");
is(!!document.querySelector(".network-details-panel"), false,
"The details pane should now be hidden after the toggle button was pressed again.");
is(getSelectedRequest(store.getState()), null,

View File

@ -24,8 +24,7 @@ add_task(async function() {
// Wait for all tree view updated by react
wait = waitForDOM(document, "#headers-panel .tree-section .treeLabel", 3);
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#headers-tab"));
await wait;

View File

@ -24,8 +24,7 @@ add_task(async function() {
// Wait for all tree view updated by react
wait = waitForDOM(document, "#params-panel .tree-section");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#params-tab"));
await wait;

View File

@ -184,8 +184,7 @@ add_task(async function() {
await networkEvent;
let wait = waitForDOM(getDoc(), ".network-details-panel");
EventUtils.sendMouseEvent({ type: "click" },
getDoc().querySelector(".network-details-panel-toggle"));
getStore().dispatch(Actions.toggleNetworkDetails());
await wait;
}

View File

@ -24,8 +24,7 @@ add_task(async function() {
});
await wait;
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#security-tab"));
await waitUntil(() => document.querySelector(

View File

@ -23,8 +23,7 @@ add_task(async function() {
await requestsDone;
let securityInfoLoaded = waitForDOM(document, ".security-info-value");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
await waitUntil(() => document.querySelector("#security-tab"));
EventUtils.sendMouseEvent({ type: "click" },

View File

@ -35,8 +35,7 @@ add_task(async function() {
is(!!document.querySelector(".network-details-panel"), false,
"The network details panel should still be hidden after first request.");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");

View File

@ -21,9 +21,6 @@ add_task(async function() {
store.dispatch(Actions.batchEnable(false));
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
true,
"The pane toggle button should be disabled when the frontend is opened.");
ok(document.querySelector(".request-list-empty-notice"),
"An empty notice should be displayed when the frontend is opened.");
is(store.getState().requests.requests.size, 0,
@ -33,9 +30,6 @@ add_task(async function() {
await reloadAndWait();
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
false,
"The pane toggle button should be enabled after the first request.");
ok(!document.querySelector(".request-list-empty-notice"),
"The empty notice should be hidden after the first request.");
is(store.getState().requests.requests.size, 1,
@ -45,9 +39,6 @@ add_task(async function() {
await reloadAndWait();
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
false,
"The pane toggle button should be still be enabled after a reload.");
ok(!document.querySelector(".request-list-empty-notice"),
"The empty notice should be still hidden after a reload.");
is(store.getState().requests.requests.size, 1,
@ -57,9 +48,6 @@ add_task(async function() {
store.dispatch(Actions.clearRequests());
is(document.querySelector(".network-details-panel-toggle").hasAttribute("disabled"),
true,
"The pane toggle button should be disabled when after clear.");
ok(document.querySelector(".request-list-empty-notice"),
"An empty notice should be displayed again after clear.");
is(store.getState().requests.requests.size, 0,

View File

@ -51,8 +51,7 @@ add_task(async function() {
await performRequestsInContent(requests);
await wait;
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");

View File

@ -51,8 +51,7 @@ add_task(async function() {
await performRequestsInContent(requests);
await wait;
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
isnot(getSelectedRequest(store.getState()), undefined,
"There should be a selected item in the requests menu.");

View File

@ -57,8 +57,7 @@ add_task(async function() {
});
wait = waitForDOM(document, "#response-panel");
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector(".network-details-panel-toggle"));
store.dispatch(Actions.toggleNetworkDetails());
EventUtils.sendMouseEvent({ type: "click" },
document.querySelector("#response-tab"));
await wait;

View File

@ -51,6 +51,14 @@ const isWordChar = function(str) {
return str && WORD_REGEXP.test(str);
};
const GRID_PROPERTY_NAMES = ["grid-area", "grid-row", "grid-row-start",
"grid-row-end", "grid-column", "grid-column-start",
"grid-column-end"];
const GRID_ROW_PROPERTY_NAMES = ["grid-area", "grid-row", "grid-row-start",
"grid-row-end"];
const GRID_COL_PROPERTY_NAMES = ["grid-area", "grid-column", "grid-column-start",
"grid-column-end"];
/**
* Helper to check if the provided key matches one of the expected keys.
* Keys will be prefixed with DOM_VK_ and should match a key in KeyCodes.
@ -131,6 +139,9 @@ function isKeyIn(key, ...keys) {
* {Object} cssVariables: A Map object containing all CSS variables.
* {Number} defaultIncrement: The value by which the input is incremented
* or decremented by default (0.1 for properties like opacity and 1 by default)
* {Function} getGridLineNames:
* Will be called before offering autocomplete sugestions, if the property is
* a member of GRID_PROPERTY_NAMES.
*/
function editableField(options) {
return editableItem(options, function(element, event) {
@ -295,10 +306,6 @@ function InplaceEditor(options, event) {
this.input.select();
}
if (this.contentType == CONTENT_TYPES.CSS_VALUE && this.input.value == "") {
this._maybeSuggestCompletion(false);
}
this.input.addEventListener("blur", this._onBlur);
this.input.addEventListener("keypress", this._onKeyPress);
this.input.addEventListener("input", this._onInput);
@ -321,6 +328,8 @@ function InplaceEditor(options, event) {
if (options.start) {
options.start(this, event);
}
this._getGridNamesBeforeCompletion(options.getGridLineNames);
}
exports.InplaceEditor = InplaceEditor;
@ -992,6 +1001,25 @@ InplaceEditor.prototype = {
}
},
/**
* Before offering autocomplete, set this.gridLineNames as the line names
* of the current grid, if they exist.
*
* @param {Function} getGridLineNames
* A function which gets the line names of the current grid.
*/
_getGridNamesBeforeCompletion: async function(getGridLineNames) {
if (getGridLineNames && this.property &&
GRID_PROPERTY_NAMES.includes(this.property.name)) {
this.gridLineNames = await getGridLineNames();
}
if (this.contentType == CONTENT_TYPES.CSS_VALUE && this.input &&
this.input.value == "") {
this._maybeSuggestCompletion(false);
}
},
/**
* Event handler called by the autocomplete popup when receiving a click
* event.
@ -1567,7 +1595,18 @@ InplaceEditor.prototype = {
* @return {Array} array of CSS property values (Strings)
*/
_getCSSValuesForPropertyName: function(propertyName) {
return this.cssProperties.getValues(propertyName);
let gridLineList = [];
if (this.gridLineNames) {
if (GRID_ROW_PROPERTY_NAMES.includes(this.property.name)) {
gridLineList.push(...this.gridLineNames.rows);
}
if (GRID_COL_PROPERTY_NAMES.includes(this.property.name)) {
gridLineList.push(...this.gridLineNames.cols);
}
}
// Must be alphabetically sorted before comparing the results with
// the user input, otherwise we will lose some results.
return gridLineList.concat(this.cssProperties.getValues(propertyName)).sort();
},
/**

View File

@ -1,13 +1,13 @@
# wasmparser version
Current vesion is: 0.5.3
Current vesion is: 0.6.0
# Upgrade process
1. Pull latest release from npm and extract WasmDis.js and WasmParser.js, e.g.
```
curl https://registry.npmjs.org/wasmparser/-/wasmparser-0.5.3.tgz | tar -x --strip-components 2 package/dist/{WasmDis,WasmParser}.js
curl https://registry.npmjs.org/wasmparser/-/wasmparser-0.6.0.tgz | tar -x --strip-components 2 package/dist/{WasmDis,WasmParser}.js
```
2. Remove reference to source maps (last line)

View File

@ -1,4 +1,14 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/* Copyright 2016 Mozilla Foundation
*
@ -981,3 +991,119 @@ var WasmDisassembler = /** @class */ (function () {
return WasmDisassembler;
}());
exports.WasmDisassembler = WasmDisassembler;
var UNKNOWN_FUNCTION_PREFIX = "unknown";
var NameSectionNameResolver = /** @class */ (function (_super) {
__extends(NameSectionNameResolver, _super);
function NameSectionNameResolver(names) {
var _this = _super.call(this) || this;
_this._names = names;
return _this;
}
NameSectionNameResolver.prototype.getFunctionName = function (index, isImport, isRef) {
var name = this._names[index];
if (!name)
return "$" + UNKNOWN_FUNCTION_PREFIX + index;
return isRef ? "$" + name : "$" + name + " (;" + index + ";)";
};
return NameSectionNameResolver;
}(DefaultNameResolver));
var NameSectionReader = /** @class */ (function () {
function NameSectionReader() {
this._done = false;
this._functionsCount = 0;
this._functionImportsCount = 0;
this._functionNames = null;
this._hasNames = false;
}
NameSectionReader.prototype.read = function (reader) {
var _this = this;
if (this._done)
throw new Error('Invalid state: disassembly process was already finished.');
while (true) {
if (!reader.read())
return false;
switch (reader.state) {
case 2 /* END_WASM */:
if (!reader.hasMoreBytes()) {
this._done = true;
return true;
}
break;
case -1 /* ERROR */:
throw reader.error;
case 1 /* BEGIN_WASM */:
this._functionsCount = 0;
this._functionImportsCount = 0;
this._functionNames = [];
this._hasNames = false;
break;
case 4 /* END_SECTION */:
break;
case 3 /* BEGIN_SECTION */:
var sectionInfo = reader.result;
if (sectionInfo.id === 0 /* Custom */ &&
WasmParser_1.bytesToString(sectionInfo.name) === "name") {
break;
}
if (sectionInfo.id === 3 /* Function */ ||
sectionInfo.id === 2 /* Import */) {
break;
}
reader.skipSection();
break;
case 12 /* IMPORT_SECTION_ENTRY */:
var importInfo = reader.result;
if (importInfo.kind === 0 /* Function */)
this._functionImportsCount++;
break;
case 13 /* FUNCTION_SECTION_ENTRY */:
this._functionsCount++;
break;
case 19 /* NAME_SECTION_ENTRY */:
var nameInfo = reader.result;
if (nameInfo.type !== 1 /* Function */)
break;
var functionNameInfo = nameInfo;
functionNameInfo.names.forEach(function (naming) {
_this._functionNames[naming.index] = WasmParser_1.bytesToString(naming.name);
});
this._hasNames = true;
break;
default:
throw new Error("Expectected state: " + reader.state);
}
}
};
NameSectionReader.prototype.hasValidNames = function () {
return this._hasNames;
};
NameSectionReader.prototype.getNameResolver = function () {
if (!this.hasValidNames())
throw new Error("Has no valid name section");
// Fix bad names.
var functionNamesLength = this._functionImportsCount + this._functionsCount;
var functionNames = this._functionNames.slice(0, functionNamesLength);
var usedNameAt = Object.create(null);
for (var i = 0; i < functionNames.length; i++) {
var name_1 = functionNames[i];
if (!name_1)
continue;
var goodName = !(name_1 in usedNameAt) &&
!/[^0-9A-Za-z!#$%&'*+.:<=>?@^_`|~\/\-]/.test(name_1) &&
name_1.indexOf(UNKNOWN_FUNCTION_PREFIX) !== 0;
if (!goodName) {
if (usedNameAt[name_1] >= 0) {
// Remove all non-unique names.
functionNames[usedNameAt[name_1]] = null;
usedNameAt[name_1] = -1;
}
functionNames[i] = null;
continue;
}
usedNameAt[name_1] = i;
}
return new NameSectionNameResolver(functionNames);
};
return NameSectionReader;
}());
exports.NameSectionReader = NameSectionReader;

View File

@ -142,17 +142,20 @@ const LayoutActor = ActorClassWithSpec(layoutSpec, {
},
/**
* Returns the flex container found by iterating on the given selected node. The current
* node can be a flex container or flex item. If it is a flex item, returns the parent
* flex container. Otherwise, return null if the current or parent node is not a flex
* container.
* Helper function for getCurrentGrid and getCurrentFlexbox. Returns the grid or
* flex container (whichever is requested) found by iterating on the given selected
* node. The current node can be a grid/flex container or grid/flex item. If it is a
* grid/flex item, returns the parent grid/flex container. Otherwise, returns null
* if the current or parent node is not a grid/flex container.
*
* @param {Node|NodeActor} node
* The node to start iterating at.
* @return {FlexboxActor|Null} The FlexboxActor of the flex container of the give node.
* Otherwise, returns null.
* @param {String} type
* Can be "grid" or "flex", the display type we are searching for.
* @return {GridActor|FlexboxActor|Null} The GridActor or FlexboxActor of the
* grid/flex container of the give node. Otherwise, returns null.
*/
getCurrentFlexbox(node) {
getCurrentDisplay(node, type) {
if (isNodeDead(node)) {
return null;
}
@ -171,9 +174,12 @@ const LayoutActor = ActorClassWithSpec(layoutSpec, {
return null;
}
// Check if the current node is a flex container.
if (displayType == "inline-flex" || displayType == "flex") {
return new FlexboxActor(this, treeWalker.currentNode);
if (type == "flex" &&
(displayType == "inline-flex" || displayType == "flex")) {
return new FlexboxActor(this, currentNode);
} else if (type == "grid" &&
(displayType == "inline-grid" || displayType == "grid")) {
return new GridActor(this, currentNode);
}
// Otherwise, check if this is a flex item or the parent node is a flex container.
@ -184,13 +190,15 @@ const LayoutActor = ActorClassWithSpec(layoutSpec, {
displayType = this.walker.getNode(currentNode).displayType;
switch (displayType) {
case "inline-flex":
case "flex":
return new FlexboxActor(this, currentNode);
case "contents":
// Continue walking up the tree since the parent node is a content element.
continue;
if (type == "flex" &&
(displayType == "inline-flex" || displayType == "flex")) {
return new FlexboxActor(this, currentNode);
} else if (type == "grid" &&
(displayType == "inline-grid" || displayType == "grid")) {
return new GridActor(this, currentNode);
} else if (displayType == "contents") {
// Continue walking up the tree since the parent node is a content element.
continue;
}
break;
@ -199,6 +207,36 @@ const LayoutActor = ActorClassWithSpec(layoutSpec, {
return null;
},
/**
* Returns the grid container found by iterating on the given selected node. The current
* node can be a grid container or grid item. If it is a grid item, returns the parent
* grid container. Otherwise, return null if the current or parent node is not a grid
* container.
*
* @param {Node|NodeActor} node
* The node to start iterating at.
* @return {GridActor|Null} The GridActor of the grid container of the give node.
* Otherwise, returns null.
*/
getCurrentGrid(node) {
return this.getCurrentDisplay(node, "grid");
},
/**
* Returns the flex container found by iterating on the given selected node. The current
* node can be a flex container or flex item. If it is a flex item, returns the parent
* flex container. Otherwise, return null if the current or parent node is not a flex
* container.
*
* @param {Node|NodeActor} node
* The node to start iterating at.
* @return {FlexboxActor|Null} The FlexboxActor of the flex container of the give node.
* Otherwise, returns null.
*/
getCurrentFlexbox(node) {
return this.getCurrentDisplay(node, "flex");
},
/**
* Returns an array of GridActor objects for all the grid elements contained in the
* given root node.

View File

@ -1,11 +1,11 @@
"use strict";
var {Ci} = require("chrome");
var Services = require("Services");
var ChromeUtils = require("ChromeUtils");
exports.setupParent = function({mm, prefix}) {
let args = [
!!mm.QueryInterface(Ci.nsIMessageSender),
ChromeUtils.getClassName(mm) == "ChromeMessageSender",
prefix
];
Services.obs.notifyObservers(null, "test:setupParent", JSON.stringify(args));

View File

@ -31,6 +31,15 @@ const layoutSpec = generateActorSpec({
}
},
getCurrentGrid: {
request: {
node: Arg(0, "domnode"),
},
response: {
grid: RetVal("nullable:grid")
}
},
getGrids: {
request: {
rootNode: Arg(0, "domnode")

View File

@ -211,8 +211,6 @@
is(savedElement.QueryInterface(Ci.nsISupports), savedElement,
"QI to nsISupports works");
is(savedElement.QueryInterface(Ci.nsIDOMNode), savedElement,
"QI to a random (implemented) interface works");
function testNoInterface(savedElement, i) {
try {

View File

@ -46,10 +46,10 @@ function test_isEqualNode_setAttribute()
check_eq_nodes(node1, node2);
el(node1).setAttribute("bar", "baz");
node1.setAttribute("bar", "baz");
check_neq_nodes(node1, node2);
el(node2).setAttribute("bar", "baz");
node2.setAttribute("bar", "baz");
check_eq_nodes(node1, node2);
@ -85,7 +85,7 @@ function test_isEqualNode_clones()
var all_elts = doc.getElementsByTagName("*");
for (var i = 0; i < all_elts.length; i++)
{
var elt = el(all_elts.item(i));
var elt = all_elts.item(i);
check_eq_nodes(elt, elt.cloneNode(true));
var attrs = elt.attributes;
@ -386,12 +386,6 @@ function test_isEqualNode_wholeDoc()
} while(tw2.nextNode());
}
// UTILITY FUNCTIONS
function n(node) { return node ? node.QueryInterface(nsIDOMNode) : null; }
function el(node) { return node ? node.QueryInterface(nsIDOMElement) : null; }
// TESTING FUNCTIONS
/**

View File

@ -746,7 +746,7 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> proto,
const NativeProperties* properties,
const NativeProperties* chromeOnlyProperties,
const char* name, bool defineOnGlobal)
const char* name, bool isChrome, bool defineOnGlobal)
{
JS::Rooted<JSObject*> constructor(cx);
MOZ_ASSERT(constructorProto);
@ -783,6 +783,13 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
JSPROP_READONLY | JSPROP_PERMANENT)) {
return nullptr;
}
if (isChrome && !JS_DefineFunction(cx, constructor, "isInstance",
InterfaceHasInstance, 1,
// Don't bother making it enumerable
0)) {
return nullptr;
}
}
if (properties) {
@ -802,7 +809,7 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
}
}
if (chromeOnlyProperties) {
if (chromeOnlyProperties && isChrome) {
if (chromeOnlyProperties->HasStaticMethods() &&
!DefinePrefable(cx, constructor,
chromeOnlyProperties->StaticMethods())) {
@ -983,11 +990,14 @@ CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
"Must have a constructor proto if we plan to create a constructor "
"object");
bool isChrome = nsContentUtils::ThreadsafeIsSystemCaller(cx);
JS::Rooted<JSObject*> proto(cx);
if (protoClass) {
proto =
CreateInterfacePrototypeObject(cx, global, protoProto, protoClass,
properties, chromeOnlyProperties,
properties,
isChrome ? chromeOnlyProperties : nullptr,
unscopableNames, isGlobal);
if (!proto) {
return;
@ -1005,6 +1015,7 @@ CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
constructorClass, ctorNargs,
namedConstructors, proto, properties,
chromeOnlyProperties, name,
isChrome,
defineOnGlobal);
if (!interface) {
if (protoCache) {
@ -1748,6 +1759,26 @@ XrayResolveOwnProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
desc, cacheOnHolder);
}
if (id == GetJSIDByIndex(cx, XPCJSContext::IDX_ISINSTANCE) &&
DOMIfaceAndProtoJSClass::FromJSClass(js::GetObjectClass(obj))->
wantsInterfaceHasInstance) {
cacheOnHolder = true;
JSNativeWrapper interfaceIsInstanceWrapper = { InterfaceIsInstance,
nullptr };
JSObject* funObj = XrayCreateFunction(cx, wrapper,
interfaceIsInstanceWrapper, 1, id);
if (!funObj) {
return false;
}
desc.value().setObject(*funObj);
desc.setAttributes(0);
desc.object().set(wrapper);
desc.setSetter(nullptr);
desc.setGetter(nullptr);
return true;
}
if (id == SYMBOL_TO_JSID(JS::GetWellKnownSymbol(cx, JS::SymbolCode::hasInstance)) &&
DOMIfaceAndProtoJSClass::FromJSClass(js::GetObjectClass(obj))->
wantsInterfaceHasInstance) {
@ -2500,33 +2531,53 @@ InterfaceHasInstance(JSContext* cx, int prototypeID, int depth,
}
bool
InterfaceIsInstance(JSContext* cx, unsigned argc, JS::Value* vp,
prototypes::ID prototypeID, int depth)
InterfaceIsInstance(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (MOZ_UNLIKELY(args.length() < 1)) {
nsPrintfCString message("%s.isInstance",
NamesOfInterfacesWithProtos(prototypeID));
return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, message.get());
}
if (!args[0].isObject()) {
nsPrintfCString message("Argument 1 of %s.isInstance",
NamesOfInterfacesWithProtos(prototypeID));
return ThrowErrorMessage(cx, MSG_NOT_OBJECT, message.get());
}
JS::Rooted<JSObject*> instance(cx, &args[0].toObject());
const DOMJSClass* domClass =
GetDOMClass(js::UncheckedUnwrap(instance, /* stopAtWindowProxy = */ false));
if (domClass && domClass->mInterfaceChain[depth] == prototypeID) {
args.rval().setBoolean(true);
// If the thing we were passed is not an object, return false.
if (!args.get(0).isObject()) {
args.rval().setBoolean(false);
return true;
}
args.rval().setBoolean(false);
// If "this" isn't a DOM constructor or is a constructor for an interface
// without a prototype, return false.
if (!args.thisv().isObject()) {
args.rval().setBoolean(false);
return true;
}
JS::Rooted<JSObject*> thisObj(cx, js::CheckedUnwrap(&args.thisv().toObject()));
if (!thisObj) {
args.rval().setBoolean(false);
return true;
}
const js::Class* thisClass = js::GetObjectClass(thisObj);
if (!IsDOMIfaceAndProtoClass(thisClass)) {
args.rval().setBoolean(false);
return true;
}
const DOMIfaceAndProtoJSClass* clasp =
DOMIfaceAndProtoJSClass::FromJSClass(thisClass);
if (clasp->mType != eInterface ||
clasp->mPrototypeID == prototypes::id::_ID_Count) {
args.rval().setBoolean(false);
return true;
}
JS::Rooted<JSObject*> instance(cx, &args[0].toObject());
const DOMJSClass* domClass =
GetDOMClass(js::UncheckedUnwrap(instance, /* stopAtWindowProxy = */ false));
bool isInstance =
domClass &&
domClass->mInterfaceChain[clasp->mDepth] == clasp->mPrototypeID;
args.rval().setBoolean(isInstance);
return true;
}

View File

@ -2709,8 +2709,7 @@ InterfaceHasInstance(JSContext* cx, int prototypeID, int depth,
// Used to implement the cross-context <Interface>.isInstance static method.
bool
InterfaceIsInstance(JSContext* cx, unsigned argc, JS::Value* vp,
prototypes::ID prototypeID, int depth);
InterfaceIsInstance(JSContext* cx, unsigned argc, JS::Value* vp);
// Helper for lenient getters/setters to report to console. If this
// returns false, we couldn't even get a global.

View File

@ -1772,23 +1772,6 @@ def JSNativeArguments():
Argument('JS::Value*', 'vp')]
class CGIsInstanceMethod(CGAbstractStaticMethod):
"""
A class for generating the static isInstance method.
"""
def __init__(self, descriptor):
assert descriptor.interface.hasInterfacePrototypeObject()
CGAbstractStaticMethod.__init__(self, descriptor, "isInstance", "bool",
JSNativeArguments())
def definition_body(self):
return fill(
"""
return InterfaceIsInstance(cx, argc, vp, prototypes::id::${name},
PrototypeTraits<prototypes::id::${name}>::Depth);
""",
name=self.descriptor.name)
class CGClassConstructor(CGAbstractStaticMethod):
"""
JS-visible constructor for our objects
@ -2336,18 +2319,6 @@ class MethodDefiner(PropertyDefiner):
else:
self.regular.append(method)
# Generate the isInstance static method.
if (static and
(self.descriptor.interface.hasInterfaceObject() and
self.descriptor.interface.hasInterfacePrototypeObject())):
self.chrome.append({
"name": "isInstance",
"methodInfo": False,
"length": 1,
"flags": "JSPROP_ENUMERATE",
"condition": MemberCondition(),
})
# TODO: Once iterable is implemented, use tiebreak rules instead of
# failing. Also, may be more tiebreak rules to implement once spec bug
# is resolved.
@ -2732,7 +2703,6 @@ class ConstDefiner(PropertyDefiner):
class PropertyArrays():
def __init__(self, descriptor):
self.descriptor = descriptor
self.staticMethods = MethodDefiner(descriptor, "StaticMethods",
static=True)
self.staticAttrs = AttrDefiner(descriptor, "StaticAttributes",
@ -2751,11 +2721,7 @@ class PropertyArrays():
"unforgeableMethods", "unforgeableAttrs", "consts"]
def hasChromeOnly(self):
# All interfaces that generate an interface object and interface
# prototype object have a chrome only isInstance static method.
return ((self.staticMethods.descriptor.interface.hasInterfaceObject() and
self.staticMethods.descriptor.interface.hasInterfacePrototypeObject()) or
any(getattr(self, a).hasChromeOnly() for a in self.arrayNames()))
return any(getattr(self, a).hasChromeOnly() for a in self.arrayNames())
def hasNonChromeOnly(self):
return any(getattr(self, a).hasNonChromeOnly() for a in self.arrayNames())
@ -3079,7 +3045,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
else:
properties = "nullptr"
if self.properties.hasChromeOnly():
chromeProperties = "nsContentUtils::ThreadsafeIsSystemCaller(aCx) ? sChromeOnlyNativeProperties.Upcast() : nullptr"
chromeProperties = "sChromeOnlyNativeProperties.Upcast()"
else:
chromeProperties = "nullptr"
@ -12321,9 +12287,6 @@ class CGDescriptor(CGThing):
for n in descriptor.interface.namedConstructors:
cgThings.append(CGClassConstructor(descriptor, n,
NamedConstructorName(n)))
if (descriptor.interface.hasInterfaceObject() and
descriptor.interface.hasInterfacePrototypeObject()):
cgThings.append(CGIsInstanceMethod(descriptor))
for m in descriptor.interface.members:
if m.isMethod() and m.identifier.name == 'QueryInterface':
continue
@ -13869,13 +13832,9 @@ class CGBindingRoot(CGThing):
# JS-implemented interfaces with an interface object get a
# chromeonly _create method. And interfaces with an
# interface object might have a ChromeOnly constructor.
# Also interfaces whose interface prototype object is
# generated (which is most of them) for the isInstance
# method.
(desc.interface.hasInterfaceObject() and
(desc.interface.isJSImplemented() or
(ctor and isChromeOnly(ctor)) or
desc.interface.hasInterfacePrototypeObject())) or
(ctor and isChromeOnly(ctor)))) or
# JS-implemented interfaces with clearable cached
# attrs have chromeonly _clearFoo methods.
(desc.interface.isJSImplemented() and

View File

@ -22,6 +22,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/TimelineConsumers.h"
#include "mozilla/EventTimelineMarker.h"
@ -292,14 +293,11 @@ EventListenerManager::AddEventListenerInternal(
nsContentUtils::LegacyIsCallerChromeOrNativeCode();
// Detect the type of event listener.
nsCOMPtr<nsIXPConnectWrappedJS> wjs;
if (aFlags.mListenerIsJSListener) {
MOZ_ASSERT(!aListenerHolder.HasWebIDLCallback());
listener->mListenerType = Listener::eJSEventListener;
} else if (aListenerHolder.HasWebIDLCallback()) {
listener->mListenerType = Listener::eWebIDLListener;
} else if ((wjs = do_QueryInterface(aListenerHolder.GetXPCOMCallback()))) {
listener->mListenerType = Listener::eWrappedJSListener;
} else {
listener->mListenerType = Listener::eNativeListener;
}
@ -1572,16 +1570,28 @@ EventListenerManager::GetListenerInfo(nsCOMArray<nsIEventListenerInfo>* aList)
} else {
eventType.Assign(Substring(nsDependentAtomString(listener.mTypeAtom), 2));
}
nsCOMPtr<nsIDOMEventListener> callback = listener.mListener.ToXPCOMCallback();
if (!callback) {
// This will be null for cross-compartment event listeners which have been
// destroyed.
continue;
JS::Rooted<JSObject*> callback(RootingCx());
if (JSEventHandler* handler = listener.GetJSEventHandler()) {
if (handler->GetTypedEventHandler().HasEventHandler()) {
callback = handler->GetTypedEventHandler().Ptr()->CallableOrNull();
if (!callback) {
// This will be null for cross-compartment event listeners
// which have been destroyed.
continue;
}
}
} else if (listener.mListenerType == Listener::eWebIDLListener) {
callback = listener.mListener.GetWebIDLCallback()->CallbackOrNull();
if (!callback) {
// This will be null for cross-compartment event listeners
// which have been destroyed.
continue;
}
}
// EventListenerInfo is defined in XPCOM, so we have to go ahead
// and convert to an XPCOM callback here...
RefPtr<EventListenerInfo> info =
new EventListenerInfo(eventType, callback.forget(),
new EventListenerInfo(eventType, callback,
listener.mFlags.mCapture,
listener.mFlags.mAllowUntrustedEvents,
listener.mFlags.mInSystemGroup);
@ -1715,8 +1725,6 @@ EventListenerManager::MarkForCC()
if (typedHandler.HasEventHandler()) {
typedHandler.Ptr()->MarkForCC();
}
} else if (listener.mListenerType == Listener::eWrappedJSListener) {
xpc_TryUnmarkWrappedGrayObject(listener.mListener.GetXPCOMCallback());
} else if (listener.mListenerType == Listener::eWebIDLListener) {
listener.mListener.GetWebIDLCallback()->MarkForCC();
}

View File

@ -189,10 +189,13 @@ public:
enum ListenerType : uint8_t
{
// No listener.
eNoListener,
// A generic C++ implementation of nsIDOMEventListener.
eNativeListener,
// An event handler attribute using JSEventHandler.
eJSEventListener,
eWrappedJSListener,
// A scripted EventListener.
eWebIDLListener,
};
ListenerType mListenerType;

View File

@ -80,7 +80,37 @@ EventListenerChange::GetCountOfEventListenerChangesAffectingAccessibility(
* mozilla::EventListenerInfo
******************************************************************************/
NS_IMPL_CYCLE_COLLECTION(EventListenerInfo, mListener)
EventListenerInfo::EventListenerInfo(const nsAString& aType,
JS::Handle<JSObject*> aScriptedListener,
bool aCapturing,
bool aAllowsUntrusted,
bool aInSystemEventGroup)
: mType(aType)
, mScriptedListener(aScriptedListener)
, mCapturing(aCapturing)
, mAllowsUntrusted(aAllowsUntrusted)
, mInSystemEventGroup(aInSystemEventGroup)
{
HoldJSObjects(this);
}
EventListenerInfo::~EventListenerInfo()
{
DropJSObjects(this);
}
NS_IMPL_CYCLE_COLLECTION_CLASS(EventListenerInfo)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EventListenerInfo)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(EventListenerInfo)
tmp->mScriptedListener = nullptr;
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(EventListenerInfo)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mScriptedListener)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EventListenerInfo)
NS_INTERFACE_MAP_ENTRY(nsIEventListenerInfo)
@ -138,28 +168,13 @@ EventListenerInfo::GetJSVal(JSContext* aCx,
Maybe<JSAutoCompartment>& aAc,
JS::MutableHandle<JS::Value> aJSVal)
{
aJSVal.setNull();
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(mListener);
if (wrappedJS) {
JS::Rooted<JSObject*> object(aCx, wrappedJS->GetJSObject());
if (!object) {
return false;
}
aAc.emplace(aCx, object);
aJSVal.setObject(*object);
if (mScriptedListener) {
aJSVal.setObject(*mScriptedListener);
aAc.emplace(aCx, mScriptedListener);
return true;
}
nsCOMPtr<JSEventHandler> jsHandler = do_QueryInterface(mListener);
if (jsHandler && jsHandler->GetTypedEventHandler().HasEventHandler()) {
JS::Handle<JSObject*> handler =
jsHandler->GetTypedEventHandler().Ptr()->CallableOrNull();
if (handler) {
aAc.emplace(aCx, handler);
aJSVal.setObject(*handler);
return true;
}
}
aJSVal.setNull();
return false;
}

View File

@ -48,32 +48,24 @@ class EventListenerInfo final : public nsIEventListenerInfo
{
public:
EventListenerInfo(const nsAString& aType,
already_AddRefed<nsIDOMEventListener> aListener,
JS::Handle<JSObject*> aScriptedListener,
bool aCapturing,
bool aAllowsUntrusted,
bool aInSystemEventGroup)
: mType(aType)
, mListener(aListener)
, mCapturing(aCapturing)
, mAllowsUntrusted(aAllowsUntrusted)
, mInSystemEventGroup(aInSystemEventGroup)
{
}
bool aInSystemEventGroup);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(EventListenerInfo)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(EventListenerInfo)
NS_DECL_NSIEVENTLISTENERINFO
protected:
virtual ~EventListenerInfo() {}
virtual ~EventListenerInfo();
bool GetJSVal(JSContext* aCx,
Maybe<JSAutoCompartment>& aAc,
JS::MutableHandle<JS::Value> aJSVal);
nsString mType;
// nsReftPtr because that is what nsListenerStruct uses too.
RefPtr<nsIDOMEventListener> mListener;
JS::Heap<JSObject*> mScriptedListener; // May be null.
bool mCapturing;
bool mAllowsUntrusted;
bool mInSystemEventGroup;

View File

@ -13,7 +13,7 @@
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, function, uuid(df31c120-ded6-11d1-bd85-00805f8ae3f4)]
[uuid(df31c120-ded6-11d1-bd85-00805f8ae3f4)]
interface nsIDOMEventListener : nsISupports
{
/**

View File

@ -17,23 +17,13 @@ interface LegacyQueryInterface {
nsISupports QueryInterface(IID iid);
};
Attr implements LegacyQueryInterface;
BoxObject implements LegacyQueryInterface;
ChildProcessMessageManager implements LegacyQueryInterface;
ChromeMessageBroadcaster implements LegacyQueryInterface;
ChromeMessageSender implements LegacyQueryInterface;
Comment implements LegacyQueryInterface;
ContentFrameMessageManager implements LegacyQueryInterface;
ContentProcessMessageManager implements LegacyQueryInterface;
DOMParser implements LegacyQueryInterface;
Document implements LegacyQueryInterface;
DocumentFragment implements LegacyQueryInterface;
DocumentType implements LegacyQueryInterface;
Element implements LegacyQueryInterface;
Event implements LegacyQueryInterface;
ProcessingInstruction implements LegacyQueryInterface;
Selection implements LegacyQueryInterface;
Text implements LegacyQueryInterface;
TreeColumns implements LegacyQueryInterface;
TreeContentView implements LegacyQueryInterface;
Window implements LegacyQueryInterface;

View File

@ -555,7 +555,7 @@ CompositorBridgeParent::RecvWaitOnTransactionProcessed()
mozilla::ipc::IPCResult
CompositorBridgeParent::RecvFlushRendering()
{
if (mOptions.UseWebRender()) {
if (mWrBridge) {
mWrBridge->FlushRendering();
return IPC_OK();
}
@ -570,7 +570,7 @@ CompositorBridgeParent::RecvFlushRendering()
mozilla::ipc::IPCResult
CompositorBridgeParent::RecvFlushRenderingAsync()
{
if (mOptions.UseWebRender()) {
if (mWrBridge) {
mWrBridge->FlushRenderingAsync();
return IPC_OK();
}
@ -698,9 +698,9 @@ CompositorBridgeParent::PauseComposition()
if (!mPaused) {
mPaused = true;
if (!mOptions.UseWebRender()) {
if (mCompositor) {
mCompositor->Pause();
} else {
} else if (mWrBridge) {
mWrBridge->Pause();
}
TimeStamp now = TimeStamp::Now();

View File

@ -106,7 +106,8 @@ const char* const XPCJSRuntime::mStrings[] = {
"stack", // IDX_STACK
"message", // IDX_MESSAGE
"lastIndex", // IDX_LASTINDEX
"then" // IDX_THEN
"then", // IDX_THEN
"isInstance", // IDX_ISINSTANCE
};
/***************************************************************************/

View File

@ -462,6 +462,7 @@ public:
IDX_MESSAGE ,
IDX_LASTINDEX ,
IDX_THEN ,
IDX_ISINSTANCE ,
IDX_TOTAL_COUNT // just a count of the above
};

View File

@ -19,7 +19,7 @@ add_test(function test_generateQI_string_names()
var x = {
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIClassInfo,
"nsIDOMNode"
"nsIObserver"
])
};
@ -29,12 +29,12 @@ add_test(function test_generateQI_string_names()
do_throw("Should QI to nsIClassInfo");
}
try {
x.QueryInterface(Ci.nsIDOMNode);
x.QueryInterface(Ci.nsIObserver);
} catch(e) {
do_throw("Should QI to nsIDOMNode");
do_throw("Should QI to nsIObserver");
}
try {
x.QueryInterface(Ci.nsIDOMDocument);
x.QueryInterface(Ci.nsIObserverService);
do_throw("QI should not have succeeded!");
} catch(e) {}
run_next_test();

View File

@ -44,6 +44,7 @@ elif CONFIG['CPU_ARCH'] == 'x86':
ASFLAGS += [ '-I%s/media/libaom/config/win/ia32/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libaom/config/win/ia32/' ]
EXPORTS.aom += [ 'config/win/ia32/aom_config.h' ]
NO_PGO = True # Compiler OOMs, bug 1445922
else: # Android, Linux, BSDs, etc.
ASFLAGS += [ '-I%s/media/libaom/config/linux/ia32/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libaom/config/linux/ia32/' ]

View File

@ -7,7 +7,7 @@ ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
GeckoViewUtils.addLazyEventListener(this, ["click", "contextmenu"], {
handler: _ =>
Cc["@mozilla.org/prompter;1"].getService(Ci.nsIDOMEventListener),
Cc["@mozilla.org/prompter;1"].getService().wrappedJSObject,
options: {
capture: false,
mozSystemGroup: true,

View File

@ -63,7 +63,6 @@ SessionStore.prototype = {
classID: Components.ID("{8c1f07d6-cba3-4226-a315-8bd43d67d032}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsISessionStore,
Ci.nsIDOMEventListener,
Ci.nsIObserver,
Ci.nsISupportsWeakReference]),

View File

@ -22,7 +22,7 @@ PromptFactory.prototype = {
classID: Components.ID("{076ac188-23c1-4390-aa08-7ef1f78ca5d9}"),
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIDOMEventListener, Ci.nsIPromptFactory, Ci.nsIPromptService]),
Ci.nsIPromptFactory, Ci.nsIPromptService]),
handleEvent: function(aEvent) {
switch (aEvent.type) {

View File

@ -108,26 +108,20 @@ function hiddenDataCheck(bytes, uri, path)
do_throw("document failed to parse as XML");
}
// See all the .QueryInterface()s and .item()s happening here? That's because
// xpcshell sucks and doesn't have classinfo, so no automatic interface
// flattening or array-style access to items in NodeLists. Suck.
var body = doc.documentElement.getElementsByTagName("body");
Assert.equal(body.length, 1);
body = body.item(0);
body = body[0];
// header
var header = body.QueryInterface(Ci.nsIDOMElement)
.getElementsByTagName("h1");
var header = body.getElementsByTagName("h1");
Assert.equal(header.length, 1);
Assert.equal(header.item(0).QueryInterface(Ci.nsIDOMNode).textContent, path);
Assert.equal(header[0].textContent, path);
// files
var lst = body.getElementsByTagName("ol");
Assert.equal(lst.length, 1);
var items = lst.item(0).QueryInterface(Ci.nsIDOMElement)
.getElementsByTagName("li");
var items = lst[0].getElementsByTagName("li");
var ios = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
@ -140,11 +134,7 @@ function hiddenDataCheck(bytes, uri, path)
for (var i = 0; i < items.length; i++)
{
var link = items.item(i)
.childNodes
.item(0)
.QueryInterface(Ci.nsIDOMNode)
.QueryInterface(Ci.nsIDOMElement);
var link = items[i].childNodes[0];
var f = dirEntries[i];
var sep = f.isDirectory ? "/" : "";
@ -192,26 +182,20 @@ function dataCheck(bytes, uri, path, dirEntries)
do_throw("document failed to parse as XML");
}
// See all the .QueryInterface()s and .item()s happening here? That's because
// xpcshell sucks and doesn't have classinfo, so no automatic interface
// flattening or array-style access to items in NodeLists. Suck.
var body = doc.documentElement.getElementsByTagName("body");
Assert.equal(body.length, 1);
body = body.item(0);
body = body[0];
// header
var header = body.QueryInterface(Ci.nsIDOMElement)
.getElementsByTagName("h1");
var header = body.getElementsByTagName("h1");
Assert.equal(header.length, 1);
Assert.equal(header.item(0).QueryInterface(Ci.nsIDOMNode).textContent, path);
Assert.equal(header[0].textContent, path);
// files
var lst = body.getElementsByTagName("ol");
Assert.equal(lst.length, 1);
var items = lst.item(0).QueryInterface(Ci.nsIDOMElement)
.getElementsByTagName("li");
var items = lst[0].getElementsByTagName("li");
var ios = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
@ -220,11 +204,7 @@ function dataCheck(bytes, uri, path, dirEntries)
for (var i = 0; i < items.length; i++)
{
var link = items.item(i)
.childNodes
.item(0)
.QueryInterface(Ci.nsIDOMNode)
.QueryInterface(Ci.nsIDOMElement);
var link = items[i].childNodes[0];
var f = dirEntries[i];
var sep = f.isDirectory ? "/" : "";

View File

@ -392,7 +392,7 @@ function getMessageManager(target) {
if (target.frameLoader) {
return target.frameLoader.messageManager;
}
return target.QueryInterface(Ci.nsIMessageSender);
return target;
}
function flushJarCache(jarPath) {

View File

@ -48,7 +48,6 @@ var observer = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsIFormSubmitObserver,
Ci.nsIWebProgressListener,
Ci.nsIDOMEventListener,
Ci.nsISupportsWeakReference]),
// nsIFormSubmitObserver

View File

@ -161,7 +161,7 @@ function registerRunTests() {
form.appendChild(password);
var observer = SpecialPowers.wrapCallback(function(subject, topic, data) {
var formLikeRoot = subject.QueryInterface(SpecialPowers.Ci.nsIDOMNode);
var formLikeRoot = subject;
if (formLikeRoot.id !== "observerforcer")
return;
SpecialPowers.removeObserver(observer, "passwordmgr-processed-form");

View File

@ -84,7 +84,7 @@
<spacer flex="2"/>
</xbl:content>
<implementation implements="nsIDOMEventListener">
<implementation>
<constructor>
<![CDATA[
let self = this;

View File

@ -1,26 +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/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "SelectContentHelper",
"resource://gre/modules/SelectContentHelper.jsm");
addEventListener("mozshowdropdown", event => {
if (!event.isTrusted)
return;
if (!SelectContentHelper.open) {
new SelectContentHelper(event.target, {isOpenedViaTouch: false}, this);
}
});
addEventListener("mozshowdropdown-sourcetouch", event => {
if (!event.isTrusted)
return;
if (!SelectContentHelper.open) {
new SelectContentHelper(event.target, {isOpenedViaTouch: true}, this);
}
});

View File

@ -12,7 +12,7 @@
<content clickthrough="never">
<children/>
</content>
<implementation type="application/javascript" implements="nsIObserver, nsIDOMEventListener, nsIBrowser">
<implementation type="application/javascript" implements="nsIObserver, nsIBrowser">
<property name="autoscrollEnabled">
<getter>
<![CDATA[

View File

@ -261,7 +261,7 @@
<binding id="menu-button-base"
extends="chrome://global/content/bindings/button.xml#button-base">
<implementation implements="nsIDOMEventListener">
<implementation>
<constructor>
this.init();
</constructor>

View File

@ -107,7 +107,7 @@
-->
</content>
<implementation implements="nsIDOMEventListener">
<implementation>
<property name="color">
<getter><![CDATA[
return this.mSelectedCell ? this.mSelectedCell.getAttribute("color") : null;

View File

@ -11,7 +11,7 @@
<binding id="remote-browser" extends="chrome://global/content/bindings/browser.xml#browser">
<implementation type="application/javascript"
implements="nsIObserver, nsIDOMEventListener, nsIRemoteBrowser">
implements="nsIObserver, nsIRemoteBrowser">
<field name="_securityUI">null</field>

View File

@ -614,7 +614,7 @@
onmouseover="_continueScroll(1);"
onmouseout="_pauseScroll();"/>
</content>
<implementation implements="nsITimerCallback, nsIDOMEventListener">
<implementation implements="nsITimerCallback">
<constructor><![CDATA[
this._scrollDelay =
this._prefBranch.getIntPref("toolkit.scrollbox.clickToScroll.scrollDelay",

View File

@ -17,7 +17,7 @@
<binding id="tabbox"
extends="chrome://global/content/bindings/tabbox.xml#tab-base">
<implementation implements="nsIDOMEventListener">
<implementation>
<property name="handleCtrlTab">
<setter>
<![CDATA[

View File

@ -63,6 +63,7 @@ skip-if = buildapp == 'mulet'
[browser_dragdrop_incompat.js]
[browser_experiments.js]
[browser_file_xpi_no_process_switch.js]
skip-if = !debug && ((os == 'linux' && bits == '64') || (os == 'win' && os_version == '6.1')) # Bug 1449071 - disable on Linux64 and Windows 7 due to frequent failures
[browser_getmorethemes.js]
[browser_globalwarnings.js]
[browser_gmpProvider.js]