mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Merge mozilla-central to autoland. a=merge on a CLOSED TREE
This commit is contained in:
commit
8a01d542af
@ -47,6 +47,7 @@ AccessibleNode::AccessibleNode(nsINode* aNode) :
|
||||
mIntProperties(3),
|
||||
mUIntProperties(6),
|
||||
mBooleanProperties(0),
|
||||
mStringProperties(16),
|
||||
mDOMNode(aNode)
|
||||
{
|
||||
nsAccessibilityService* accService = GetOrCreateAccService();
|
||||
@ -77,7 +78,7 @@ AccessibleNode::GetParentObject() const
|
||||
}
|
||||
|
||||
void
|
||||
AccessibleNode::GetRole(nsAString& aRole)
|
||||
AccessibleNode::GetComputedRole(nsAString& aRole)
|
||||
{
|
||||
if (mIntl) {
|
||||
nsAccessibilityService* accService = GetOrCreateAccService();
|
||||
|
@ -40,12 +40,29 @@ struct ParentObject;
|
||||
SetProperty(AOM##typeName##Property::e##name, a##name); \
|
||||
} \
|
||||
|
||||
#define ANODE_STRING_FUNC(name) \
|
||||
void Get##name(nsAString& a##name) \
|
||||
{ \
|
||||
return GetProperty(AOMStringProperty::e##name, a##name); \
|
||||
} \
|
||||
\
|
||||
void Set##name(const nsAString& a##name) \
|
||||
{ \
|
||||
SetProperty(AOMStringProperty::e##name, a##name); \
|
||||
} \
|
||||
|
||||
#define ANODE_PROPS(typeName, type, ...) \
|
||||
enum class AOM##typeName##Property { \
|
||||
MOZ_FOR_EACH(ANODE_ENUM, (), (__VA_ARGS__)) \
|
||||
}; \
|
||||
MOZ_FOR_EACH(ANODE_FUNC, (typeName, type,), (__VA_ARGS__)) \
|
||||
|
||||
#define ANODE_STRING_PROPS(...) \
|
||||
enum class AOMStringProperty { \
|
||||
MOZ_FOR_EACH(ANODE_ENUM, (), (__VA_ARGS__)) \
|
||||
}; \
|
||||
MOZ_FOR_EACH(ANODE_STRING_FUNC, (), (__VA_ARGS__)) \
|
||||
|
||||
#define ANODE_ACCESSOR_MUTATOR(typeName, type, defVal) \
|
||||
nsDataHashtable<nsUint32HashKey, type> m##typeName##Properties; \
|
||||
\
|
||||
@ -80,7 +97,7 @@ public:
|
||||
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
|
||||
dom::ParentObject GetParentObject() const;
|
||||
|
||||
void GetRole(nsAString& aRole);
|
||||
void GetComputedRole(nsAString& aRole);
|
||||
void GetStates(nsTArray<nsString>& aStates);
|
||||
void GetAttributes(nsTArray<nsString>& aAttributes);
|
||||
nsINode* GetDOMNode();
|
||||
@ -93,6 +110,25 @@ public:
|
||||
|
||||
static bool IsAOMEnabled(JSContext*, JSObject*);
|
||||
|
||||
ANODE_STRING_PROPS(
|
||||
Autocomplete,
|
||||
Checked,
|
||||
Current,
|
||||
HasPopUp,
|
||||
Invalid,
|
||||
KeyShortcuts,
|
||||
Label,
|
||||
Live,
|
||||
Orientation,
|
||||
Placeholder,
|
||||
Pressed,
|
||||
Relevant,
|
||||
Role,
|
||||
RoleDescription,
|
||||
Sort,
|
||||
ValueText
|
||||
)
|
||||
|
||||
ANODE_PROPS(Boolean, bool,
|
||||
Atomic,
|
||||
Busy,
|
||||
@ -133,6 +169,23 @@ protected:
|
||||
AccessibleNode& operator=(const AccessibleNode& aCopy) = delete;
|
||||
virtual ~AccessibleNode();
|
||||
|
||||
void GetProperty(AOMStringProperty aProperty, nsAString& aRetval) {
|
||||
nsString data;
|
||||
if (!mStringProperties.Get(static_cast<int>(aProperty), &data)) {
|
||||
SetDOMStringToNull(data);
|
||||
}
|
||||
aRetval = data;
|
||||
}
|
||||
|
||||
void SetProperty(AOMStringProperty aProperty, const nsAString& aValue) {
|
||||
if (DOMStringIsNull(aValue)) {
|
||||
mStringProperties.Remove(static_cast<int>(aProperty));
|
||||
} else {
|
||||
nsString value(aValue);
|
||||
mStringProperties.Put(static_cast<int>(aProperty), value);
|
||||
}
|
||||
}
|
||||
|
||||
dom::Nullable<bool> GetProperty(AOMBooleanProperty aProperty)
|
||||
{
|
||||
int num = static_cast<int>(aProperty);
|
||||
@ -163,6 +216,7 @@ protected:
|
||||
// The 2k'th bit indicates whether the k'th boolean property is used(1) or not(0)
|
||||
// and 2k+1'th bit contains the property's value(1:true, 0:false)
|
||||
uint32_t mBooleanProperties;
|
||||
nsDataHashtable<nsUint32HashKey, nsString> mStringProperties;
|
||||
|
||||
RefPtr<a11y::Accessible> mIntl;
|
||||
RefPtr<nsINode> mDOMNode;
|
||||
|
@ -429,8 +429,7 @@ var Input = {
|
||||
let horizontal = aDetails.horizontal;
|
||||
let page = aDetails.page;
|
||||
let win = aBrowser.ownerGlobal;
|
||||
let winUtils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(
|
||||
Ci.nsIDOMWindowUtils);
|
||||
let winUtils = win.windowUtils;
|
||||
let p = AccessFu.screenToClientBounds(aDetails.bounds, win).center();
|
||||
winUtils.sendWheelEvent(p.x, p.y,
|
||||
horizontal ? page : 0, horizontal ? 0 : page, 0,
|
||||
|
@ -221,9 +221,7 @@ var Utils = { // jshint ignore:line
|
||||
|
||||
getContentResolution: function _getContentResolution(aAccessible) {
|
||||
let res = { value: 1 };
|
||||
aAccessible.document.window.QueryInterface(
|
||||
Ci.nsIInterfaceRequestor).getInterface(
|
||||
Ci.nsIDOMWindowUtils).getResolution(res);
|
||||
aAccessible.document.window.windowUtils.getResolution(res);
|
||||
return res.value;
|
||||
},
|
||||
|
||||
|
@ -200,8 +200,7 @@ async function contentSpawnMutation(browser, waitFor, func, args = null) {
|
||||
// 100ms is an arbitrary positive number to advance the clock.
|
||||
// We don't need to advance the clock for a11y mutations, but other
|
||||
// tick listeners may depend on an advancing clock with each refresh.
|
||||
content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).advanceTimeAndRefresh(100);
|
||||
content.windowUtils.advanceTimeAndRefresh(100);
|
||||
}
|
||||
|
||||
// This stops the refreh driver from doing its regular ticks, and leaves
|
||||
@ -220,8 +219,7 @@ async function contentSpawnMutation(browser, waitFor, func, args = null) {
|
||||
|
||||
// Go back to normal refresh driver ticks.
|
||||
await ContentTask.spawn(browser, null, function() {
|
||||
content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).restoreNormalRefresh();
|
||||
content.windowUtils.restoreNormalRefresh();
|
||||
});
|
||||
|
||||
return events;
|
||||
|
@ -41,6 +41,15 @@
|
||||
});
|
||||
}
|
||||
|
||||
function testStringProp(anode, prop) {
|
||||
is(anode[prop], null, `anode.${prop} should be null`);
|
||||
let text = "This is a string test";
|
||||
anode[prop] = text;
|
||||
is(anode[prop], text, `anode.${prop} was assigned "${text}"`);
|
||||
anode[prop] = null;
|
||||
is(anode[prop], null, `anode.${prop} was assigned null`);
|
||||
}
|
||||
|
||||
function testBoolProp(anode, prop) {
|
||||
is(anode[prop], null, `anode.${prop} should be null`);
|
||||
anode[prop] = true;
|
||||
@ -80,7 +89,7 @@
|
||||
let anode = ifrDoc.accessibleNode;
|
||||
ok(anode, "DOM document has accessible node");
|
||||
|
||||
is(anode.role, "document", "correct role of a document accessible node");
|
||||
is(anode.computedRole, "document", "correct role of a document accessible node");
|
||||
is(anode.DOMNode, ifrDoc, "correct DOM Node of a document accessible node");
|
||||
|
||||
// States may differ depending on the document state, for example, if it is
|
||||
@ -135,6 +144,15 @@
|
||||
`${anode.attributes[i]} attribute is expected and found`);
|
||||
}
|
||||
|
||||
const strProps = ["autocomplete", "checked", "current", "hasPopUp", "invalid",
|
||||
"keyShortcuts", "label", "live", "orientation", "placeholder",
|
||||
"pressed", "relevant", "role", "roleDescription", "sort",
|
||||
"valueText"];
|
||||
|
||||
for (const strProp of strProps) {
|
||||
testStringProp(anode, strProp);
|
||||
}
|
||||
|
||||
const boolProps = ["atomic", "busy", "disabled", "expanded", "hidden", "modal",
|
||||
"multiline", "multiselectable", "readOnly", "required", "selected"];
|
||||
|
||||
|
@ -73,9 +73,7 @@ function zoomDocument(aDocument, aZoom) {
|
||||
* On non-mobile platforms you won't see a visible change.
|
||||
*/
|
||||
function setResolution(aDocument, aZoom) {
|
||||
var windowUtils = aDocument.defaultView.
|
||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
var windowUtils = aDocument.defaultView.windowUtils;
|
||||
|
||||
windowUtils.setResolutionAndScaleTo(aZoom);
|
||||
}
|
||||
@ -270,9 +268,7 @@ function getBoundsForDOMElm(aID) {
|
||||
}
|
||||
|
||||
function CSSToDevicePixels(aWindow, aX, aY, aWidth, aHeight) {
|
||||
var winUtil = aWindow.
|
||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
var winUtil = aWindow.windowUtils;
|
||||
|
||||
var ratio = winUtil.screenPixelsPerCSSPixel;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mozilla/SafeMode.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#include "mozilla/WinHeaderOnlyUtils.h"
|
||||
#include "nsWindowsHelpers.h"
|
||||
|
||||
#include <windows.h>
|
||||
@ -193,10 +194,13 @@ LauncherMain(int argc, wchar_t* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
const DWORD timeout = ::IsDebuggerPresent() ? INFINITE :
|
||||
kWaitForInputIdleTimeoutMS;
|
||||
|
||||
// Keep the current process around until the callback process has created
|
||||
// its message queue, to avoid the launched process's windows being forced
|
||||
// into the background.
|
||||
::WaitForInputIdle(process.get(), kWaitForInputIdleTimeoutMS);
|
||||
mozilla::WaitForInputIdle(process.get(), timeout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ var FullScreen = {
|
||||
let browser = aMessage.target;
|
||||
switch (aMessage.name) {
|
||||
case "DOMFullscreen:Request": {
|
||||
this._windowUtils.remoteFrameFullscreenChanged(browser);
|
||||
window.windowUtils.remoteFrameFullscreenChanged(browser);
|
||||
break;
|
||||
}
|
||||
case "DOMFullscreen:NewOrigin": {
|
||||
@ -406,7 +406,7 @@ var FullScreen = {
|
||||
break;
|
||||
}
|
||||
case "DOMFullscreen:Exit": {
|
||||
this._windowUtils.remoteFrameFullscreenReverted();
|
||||
window.windowUtils.remoteFrameFullscreenReverted();
|
||||
break;
|
||||
}
|
||||
case "DOMFullscreen:Painted": {
|
||||
@ -492,11 +492,6 @@ var FullScreen = {
|
||||
return gMultiProcessBrowser && aBrowser.getAttribute("remote") == "true";
|
||||
},
|
||||
|
||||
get _windowUtils() {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
},
|
||||
|
||||
getMouseTargetRect() {
|
||||
return this._mouseTargetRect;
|
||||
},
|
||||
|
@ -386,13 +386,11 @@ var BrowserPageActions = {
|
||||
this.mainButtonNode.id,
|
||||
"identity-icon",
|
||||
];
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
for (let id of potentialAnchorNodeIDs) {
|
||||
if (id) {
|
||||
let node = document.getElementById(id);
|
||||
if (node && !node.hidden) {
|
||||
let bounds = dwu.getBoundsWithoutFlushing(node);
|
||||
let bounds = window.windowUtils.getBoundsWithoutFlushing(node);
|
||||
if (bounds.height > 0 && bounds.width > 0) {
|
||||
return node;
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ var LibraryUI = {
|
||||
let animatableBox = document.getElementById("library-animatable-box");
|
||||
let navBar = document.getElementById("nav-bar");
|
||||
let libraryIcon = document.getAnonymousElementByAttribute(libraryButton, "class", "toolbarbutton-icon");
|
||||
let dwu = window.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
let iconBounds = dwu.getBoundsWithoutFlushing(libraryIcon);
|
||||
let libraryBounds = dwu.getBoundsWithoutFlushing(libraryButton);
|
||||
let toolboxBounds = dwu.getBoundsWithoutFlushing(gNavToolbox);
|
||||
@ -1198,8 +1198,7 @@ var LibraryUI = {
|
||||
|
||||
let animatableBox = document.getElementById("library-animatable-box");
|
||||
let libraryIcon = document.getAnonymousElementByAttribute(libraryButton, "class", "toolbarbutton-icon");
|
||||
let dwu = window.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let iconBounds = dwu.getBoundsWithoutFlushing(libraryIcon);
|
||||
let iconBounds = window.windowUtils.getBoundsWithoutFlushing(libraryIcon);
|
||||
|
||||
// Resizing the window will only have the ability to change the X offset of the
|
||||
// library button.
|
||||
|
@ -13,8 +13,6 @@ var gWebRender = {
|
||||
* Trigger a WebRender capture of the current state into a local folder.
|
||||
*/
|
||||
capture() {
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.wrCapture();
|
||||
window.windowUtils.wrCapture();
|
||||
}
|
||||
};
|
||||
|
@ -2562,13 +2562,11 @@ async function BrowserViewSourceOfDocument(aArgsOrDocument) {
|
||||
"as a document.");
|
||||
}
|
||||
|
||||
let requestor = doc.defaultView
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor);
|
||||
let browser = requestor.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.chromeEventHandler;
|
||||
let outerWindowID = requestor.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.outerWindowID;
|
||||
let win = doc.defaultView;
|
||||
let browser = win.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell)
|
||||
.chromeEventHandler;
|
||||
let outerWindowID = win.windowUtils.outerWindowID;
|
||||
let URL = browser.currentURI.spec;
|
||||
args = { browser, outerWindowID, URL };
|
||||
} else {
|
||||
@ -3249,14 +3247,12 @@ function BrowserReloadWithFlags(reloadFlags) {
|
||||
// because we only want to reset permissions on user reload.
|
||||
SitePermissions.clearTemporaryPermissions(gBrowser.selectedBrowser);
|
||||
|
||||
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let handlingUserInput = window.windowUtils.isHandlingUserInput;
|
||||
|
||||
gBrowser.selectedBrowser
|
||||
.messageManager
|
||||
.sendAsyncMessage("Browser:Reload",
|
||||
{ flags: reloadFlags,
|
||||
handlingUserInput: windowUtils.isHandlingUserInput });
|
||||
{ flags: reloadFlags, handlingUserInput });
|
||||
}
|
||||
|
||||
function getSecurityInfo(securityInfoAsString) {
|
||||
@ -7715,7 +7711,7 @@ var MousePosTracker = {
|
||||
|
||||
get _windowUtils() {
|
||||
delete this._windowUtils;
|
||||
return this._windowUtils = window.getInterface(Ci.nsIDOMWindowUtils);
|
||||
return this._windowUtils = window.windowUtils;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -133,9 +133,7 @@ var RefreshBlocker = {
|
||||
*/
|
||||
onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {
|
||||
let win = aWebProgress.DOMWindow;
|
||||
let outerWindowID = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.outerWindowID;
|
||||
let outerWindowID = win.windowUtils.outerWindowID;
|
||||
|
||||
let data = {
|
||||
URI: aURI.spec,
|
||||
|
@ -1471,8 +1471,7 @@ nsContextMenu.prototype = {
|
||||
mediaCommand: function CM_mediaCommand(command, data) {
|
||||
let mm = this.browser.messageManager;
|
||||
let win = this.browser.ownerGlobal;
|
||||
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let windowUtils = win.windowUtils;
|
||||
mm.sendAsyncMessage("ContextMenu:MediaCommand",
|
||||
{command,
|
||||
data,
|
||||
|
@ -413,16 +413,8 @@ var DOMFullscreenHandler = {
|
||||
this.init = null;
|
||||
},
|
||||
|
||||
get _windowUtils() {
|
||||
if (!content) {
|
||||
return null;
|
||||
}
|
||||
return content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
},
|
||||
|
||||
receiveMessage(aMessage) {
|
||||
let windowUtils = this._windowUtils;
|
||||
let windowUtils = content && content.windowUtils;
|
||||
switch (aMessage.name) {
|
||||
case "DOMFullscreen:Entered": {
|
||||
this._lastTransactionId = windowUtils.lastTransactionId;
|
||||
@ -524,9 +516,7 @@ UserContextIdNotifier.init();
|
||||
Services.obs.notifyObservers(this, "tab-content-frameloader-created");
|
||||
|
||||
addMessageListener("AllowScriptsToClose", () => {
|
||||
content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.allowScriptsToClose();
|
||||
content.windowUtils.allowScriptsToClose();
|
||||
});
|
||||
|
||||
addEventListener("MozAfterPaint", function onFirstPaint() {
|
||||
|
@ -1299,8 +1299,7 @@ window._gBrowser = {
|
||||
return false;
|
||||
}
|
||||
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
let isRTL = dwu.getDirectionFromText(aLabel) == Ci.nsIDOMWindowUtils.DIRECTION_RTL;
|
||||
|
||||
aTab.setAttribute("label", aLabel);
|
||||
@ -2624,8 +2623,7 @@ window._gBrowser = {
|
||||
}
|
||||
|
||||
var isLastTab = (this.tabs.length - this._removingTabs.length == 1);
|
||||
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let windowUtils = window.windowUtils;
|
||||
// We have to sample the tab width now, since _beginRemoveTab might
|
||||
// end up modifying the DOM in such a way that aTab gets a new
|
||||
// frame created for it (for example, by updating the visually selected
|
||||
@ -2807,9 +2805,7 @@ window._gBrowser = {
|
||||
if (aTab.linkedPanel) {
|
||||
if (!aAdoptedByTab && !gMultiProcessBrowser) {
|
||||
// Prevent this tab from showing further dialogs, since we're closing it
|
||||
var windowUtils = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
windowUtils.disableDialogs();
|
||||
browser.contentWindow.windowUtils.disableDialogs();
|
||||
}
|
||||
|
||||
// Remove the tab's filter and progress listener.
|
||||
@ -3053,9 +3049,7 @@ window._gBrowser = {
|
||||
let [closeWindow] = aOtherTab._endRemoveArgs;
|
||||
if (closeWindow) {
|
||||
let win = aOtherTab.ownerGlobal;
|
||||
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
dwu.suppressAnimation(true);
|
||||
win.windowUtils.suppressAnimation(true);
|
||||
// Only suppressing window animations isn't enough to avoid
|
||||
// an empty content area being painted.
|
||||
let baseWin = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
@ -4125,9 +4119,7 @@ window._gBrowser = {
|
||||
this._uniquePanelIDCounter = 0;
|
||||
}
|
||||
|
||||
let outerID = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.outerWindowID;
|
||||
let outerID = window.windowUtils.outerWindowID;
|
||||
|
||||
// We want panel IDs to be globally unique, that's why we include the
|
||||
// window ID. We switched to a monotonic counter as Date.now() lead
|
||||
@ -4900,8 +4892,7 @@ var StatusPanel = {
|
||||
// panel's width once it has been painted, so we can do this
|
||||
// without flushing layout.
|
||||
this.panel.style.minWidth =
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
window.windowUtils
|
||||
.getBoundsWithoutFlushing(this.panel).width + "px";
|
||||
} else {
|
||||
this.panel.style.minWidth = "";
|
||||
|
@ -354,9 +354,7 @@
|
||||
// remove close buttons from background tabs so that people don't
|
||||
// accidentally close tabs by selecting them.
|
||||
let rect = ele => {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.getBoundsWithoutFlushing(ele);
|
||||
return window.windowUtils.getBoundsWithoutFlushing(ele);
|
||||
};
|
||||
let tab = this._getVisibleTabs()[gBrowser._numPinnedTabs];
|
||||
if (tab && rect(tab).width <= this._tabClipWidth) {
|
||||
@ -1171,7 +1169,7 @@
|
||||
// Until canvas is HiDPI-aware (bug 780362), we need to scale the desired
|
||||
// canvas size (in CSS pixels) to the window's backing resolution in order
|
||||
// to get a full-resolution drag image for use on HiDPI displays.
|
||||
let windowUtils = window.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let windowUtils = window.windowUtils;
|
||||
let scale = windowUtils.screenPixelsPerCSSPixel / windowUtils.fullZoom;
|
||||
let canvas = this._dndCanvas;
|
||||
if (!canvas) {
|
||||
@ -1595,7 +1593,7 @@
|
||||
onoverflow="this.setAttribute('textoverflow', 'true');"
|
||||
onunderflow="this.removeAttribute('textoverflow');"
|
||||
flex="1">
|
||||
<xul:label class="tab-text tab-label"
|
||||
<xul:label class="tab-text tab-label" anonid="tab-label"
|
||||
xbl:inherits="xbl:text=label,accesskey,fadein,pinned,selected=visuallyselected,attention"
|
||||
role="presentation"/>
|
||||
</xul:hbox>
|
||||
|
@ -254,7 +254,7 @@ add_task(async function() {
|
||||
// XXXndeakin add tests for browsers inside of panels
|
||||
|
||||
function promiseButtonShown(id) {
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
let target = document.getElementById(id);
|
||||
let bounds = dwu.getBoundsWithoutFlushing(target);
|
||||
|
@ -18,8 +18,7 @@ function test() {
|
||||
// Disable the default gestures support during the test
|
||||
gGestureSupport.init(false);
|
||||
|
||||
test_utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
test_utils = window.windowUtils;
|
||||
|
||||
// Run the tests of "simple gesture" events generally
|
||||
test_EnsureConstantsAreDisjoint();
|
||||
|
@ -44,8 +44,7 @@ function waitForTransferComplete() {
|
||||
*/
|
||||
function rightClickVideo(browser) {
|
||||
let frame_script = () => {
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
|
||||
let document = content.document;
|
||||
let video = document.getElementById("video1");
|
||||
|
@ -17,8 +17,7 @@ var clickTest = async function(tab) {
|
||||
let left = (rect.left + rect.right) / 2;
|
||||
let top = (rect.top + rect.bottom) / 2;
|
||||
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
|
@ -31,6 +31,9 @@ add_task(async function() {
|
||||
|
||||
let tabStripRect = gBrowser.tabContainer.arrowScrollbox.getBoundingClientRect();
|
||||
let firstTabRect = gBrowser.selectedTab.getBoundingClientRect();
|
||||
let firstTabLabelRect =
|
||||
document.getAnonymousElementByAttribute(gBrowser.selectedTab, "anonid", "tab-label")
|
||||
.getBoundingClientRect();
|
||||
let textBoxRect = document.getAnonymousElementByAttribute(gURLBar,
|
||||
"anonid", "textbox-input-box").getBoundingClientRect();
|
||||
let inRange = (val, min, max) => min <= val && val <= max;
|
||||
@ -83,6 +86,13 @@ add_task(async function() {
|
||||
condition: r =>
|
||||
r.x1 >= textBoxRect.left && r.x2 <= textBoxRect.right &&
|
||||
r.y1 >= textBoxRect.top && r.y2 <= textBoxRect.bottom
|
||||
},
|
||||
{name: "bug 1477966 - the name of a deselected tab should appear immediately",
|
||||
condition: r => AppConstants.platform == "macosx" &&
|
||||
r.x1 >= firstTabLabelRect.x &&
|
||||
r.x2 <= firstTabLabelRect.right &&
|
||||
r.y1 >= firstTabLabelRect.y &&
|
||||
r.y2 <= firstTabLabelRect.bottom
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -54,8 +54,7 @@ async function resizeWindow(win, width, height) {
|
||||
BrowserTestUtils.waitForEvent(win, "BookmarksToolbarVisibilityUpdated");
|
||||
let resizeEvent =
|
||||
BrowserTestUtils.waitForEvent(win, "resize");
|
||||
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = win.windowUtils;
|
||||
dwu.ensureDirtyRootFrame();
|
||||
win.resizeTo(width, height);
|
||||
await resizeEvent;
|
||||
|
@ -14,8 +14,7 @@ ChromeUtils.defineModuleGetter(this, "PlacesTestUtils",
|
||||
* The window in which the frame tree needs to be marked as dirty.
|
||||
*/
|
||||
function dirtyFrame(win) {
|
||||
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = win.windowUtils;
|
||||
try {
|
||||
dwu.ensureDirtyRootFrame();
|
||||
} catch (e) {
|
||||
@ -235,8 +234,7 @@ function forceImmediateToolbarOverflowHandling(win) {
|
||||
overflowableToolbar._lazyResizeHandler.disarm();
|
||||
// Ensure the root frame is dirty before resize so that, if we're
|
||||
// in the middle of a reflow test, we record the reflows deterministically.
|
||||
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = win.windowUtils;
|
||||
dwu.ensureDirtyRootFrame();
|
||||
overflowableToolbar._onLazyResize();
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ add_task(async function() {
|
||||
let bounds = plugin.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("contextmenu", left, top, 2, 1, 0);
|
||||
});
|
||||
|
||||
|
@ -77,8 +77,7 @@ add_task(async function() {
|
||||
let bounds = plugin.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
|
@ -38,8 +38,7 @@ add_task(async function() {
|
||||
let bounds = closeIcon.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
|
||||
@ -68,8 +67,7 @@ add_task(async function() {
|
||||
let overlayTop = (overlayBounds.left + overlayBounds.right) / 2 ;
|
||||
let closeIconLeft = (closeIconBounds.left + closeIconBounds.right) / 2;
|
||||
let closeIconTop = (closeIconBounds.top + closeIconBounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
// Simulate clicking on the close icon.
|
||||
utils.sendMouseEvent("mousedown", closeIconLeft, closeIconTop, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", closeIconLeft, closeIconTop, 0, 1, 0, false, 0, 0);
|
||||
|
@ -37,8 +37,7 @@ add_task(async function() {
|
||||
let bounds = closeIcon.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = doc.defaultView.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
Assert.ok(!overlay.classList.contains("visible"),
|
||||
|
@ -73,8 +73,7 @@ add_task(async function() {
|
||||
let bounds = updateLink.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
@ -188,8 +187,7 @@ add_task(async function() {
|
||||
let bounds = plugin.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
|
@ -41,8 +41,7 @@ add_task(async function() {
|
||||
let bounds = plugin.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
|
@ -93,8 +93,7 @@ add_task(async function() {
|
||||
let bounds = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
@ -235,8 +234,7 @@ add_task(async function() {
|
||||
let bounds = icon.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
@ -265,8 +263,7 @@ add_task(async function() {
|
||||
let bounds = text.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
@ -290,8 +287,7 @@ add_task(async function() {
|
||||
"Test 19e, Doorhanger should start out dismissed");
|
||||
|
||||
await ContentTask.spawn(gTestBrowser, null, async function() {
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", 50, 50, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", 50, 50, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
@ -372,8 +368,7 @@ add_task(async function() {
|
||||
let bounds = plugin.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
let top = (bounds.top + bounds.bottom) / 2;
|
||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = content.windowUtils;
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
});
|
||||
|
@ -89,8 +89,7 @@ async function play(tab, expectPlaying = true) {
|
||||
}
|
||||
|
||||
function disable_non_test_mouse(disable) {
|
||||
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = window.windowUtils;
|
||||
utils.disableNonTestMouseEvents(disable);
|
||||
}
|
||||
|
||||
|
@ -598,8 +598,7 @@ add_task(async function sendToDevice_inUrlbar() {
|
||||
Assert.notEqual(deviceMenuItem, null);
|
||||
|
||||
// For good measure, wait until it's visible.
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
let bounds = dwu.getBoundsWithoutFlushing(deviceMenuItem);
|
||||
return bounds.height > 0 && bounds.width > 0;
|
||||
|
@ -177,8 +177,7 @@ function promiseAutocompleteResultPopup(inputText,
|
||||
}
|
||||
|
||||
function promisePageActionPanelOpen() {
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
// Wait for the main page action button to become visible. It's hidden for
|
||||
// some URIs, so depending on when this is called, it may not yet be quite
|
||||
@ -284,8 +283,7 @@ function promisePageActionViewChildrenVisible(panelViewNode) {
|
||||
|
||||
function promiseNodeVisible(node) {
|
||||
info(`promiseNodeVisible waiting, node.id=${node.id} node.localeName=${node.localName}\n`);
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
let bounds = dwu.getBoundsWithoutFlushing(node);
|
||||
if (bounds.width > 0 && bounds.height > 0) {
|
||||
|
@ -171,8 +171,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
]]></destructor>
|
||||
|
||||
<field name="DOMWindowUtils">
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
window.windowUtils;
|
||||
</field>
|
||||
|
||||
<field name="scheme" readonly="true">
|
||||
@ -1821,9 +1820,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
.supportsSelectionClipboard())
|
||||
return;
|
||||
|
||||
if (!window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.isHandlingUserInput)
|
||||
if (!window.windowUtils.isHandlingUserInput)
|
||||
return;
|
||||
|
||||
var val = this._getSelectedValueForClipboard();
|
||||
@ -1893,8 +1890,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
<field name="textRunsMaxLen">255</field>
|
||||
|
||||
<field name="DOMWindowUtils">
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
window.windowUtils;
|
||||
</field>
|
||||
|
||||
<field name="_maxResults">0</field>
|
||||
|
@ -4522,7 +4522,7 @@ OverflowableToolbar.prototype = {
|
||||
|
||||
if (!shouldMoveAllItems && minSize) {
|
||||
if (!targetWidth) {
|
||||
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = win.windowUtils;
|
||||
targetWidth = Math.floor(dwu.getBoundsWithoutFlushing(this._target).width);
|
||||
}
|
||||
if (targetWidth <= minSize) {
|
||||
|
@ -1647,7 +1647,7 @@ CustomizeMode.prototype = {
|
||||
|
||||
get _dwu() {
|
||||
if (!this.__dwu) {
|
||||
this.__dwu = this.window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
this.__dwu = this.window.windowUtils;
|
||||
}
|
||||
return this.__dwu;
|
||||
},
|
||||
|
@ -178,8 +178,7 @@ var AssociatedToNode = class {
|
||||
get _dwu() {
|
||||
if (this.__dwu)
|
||||
return this.__dwu;
|
||||
return this.__dwu = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
return this.__dwu = this.window.windowUtils;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,8 +38,7 @@ var ScrollbarSampler = {
|
||||
hdoc.appendChild(iframe);
|
||||
|
||||
let cwindow = iframe.contentWindow;
|
||||
let utils = cwindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = cwindow.windowUtils;
|
||||
|
||||
return new Promise(resolve => {
|
||||
cwindow.addEventListener("load", function(aEvent) {
|
||||
|
@ -19,8 +19,7 @@ async function ensureVisible(node) {
|
||||
if (isInPalette) {
|
||||
node.scrollIntoView();
|
||||
}
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor);
|
||||
let dwu = window.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
let nodeBounds = dwu.getBoundsWithoutFlushing(node);
|
||||
if (isInPalette) {
|
||||
|
@ -178,8 +178,7 @@ function simulateItemDrag(aToDrag, aTarget, aEvent = {}) {
|
||||
let ev = aEvent;
|
||||
if (ev == "end" || ev == "start") {
|
||||
let win = aTarget.ownerGlobal;
|
||||
win.QueryInterface(Ci.nsIInterfaceRequestor);
|
||||
const dwu = win.getInterface(Ci.nsIDOMWindowUtils);
|
||||
const dwu = win.windowUtils;
|
||||
let bounds = dwu.getBoundsWithoutFlushing(aTarget);
|
||||
if (ev == "end") {
|
||||
ev = {clientX: bounds.right - 2, clientY: bounds.bottom - 2};
|
||||
@ -478,7 +477,7 @@ function waitForOverflowButtonShown(win = window) {
|
||||
}
|
||||
function waitForElementShown(element) {
|
||||
let win = element.ownerGlobal;
|
||||
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = win.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
info("Waiting for overflow button to have non-0 size");
|
||||
let bounds = dwu.getBoundsWithoutFlushing(element);
|
||||
|
@ -265,8 +265,7 @@ DownloadsPlacesView.prototype = {
|
||||
}
|
||||
|
||||
let rlbRect = this._richlistbox.getBoundingClientRect();
|
||||
let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let winUtils = window.windowUtils;
|
||||
let nodes = winUtils.nodesFromRect(rlbRect.left, rlbRect.top,
|
||||
0, rlbRect.width, rlbRect.height, 0,
|
||||
true, false);
|
||||
|
@ -177,7 +177,7 @@ function openLibrary(aLeftPaneRoot) {
|
||||
* Waits for a given button to become visible.
|
||||
*/
|
||||
function promiseButtonShown(id) {
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
let target = document.getElementById(id);
|
||||
let bounds = dwu.getBoundsWithoutFlushing(target);
|
||||
|
@ -4,8 +4,6 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_policy_hardware_acceleration() {
|
||||
let winUtils = Services.wm.getMostRecentWindow("").
|
||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
let winUtils = Services.wm.getMostRecentWindow("").windowUtils;
|
||||
is(winUtils.layerManagerType, "Basic", "Hardware acceleration disabled");
|
||||
});
|
||||
|
@ -165,7 +165,7 @@ add_task(async function browseraction_contextmenu_manage_extension() {
|
||||
|
||||
function waitForElementShown(element) {
|
||||
let win = element.ownerGlobal;
|
||||
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = win.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
info("Waiting for overflow button to have non-0 size");
|
||||
let bounds = dwu.getBoundsWithoutFlushing(element);
|
||||
|
@ -151,7 +151,7 @@ add_task(async function sidebar_isOpen() {
|
||||
await sendMessage(extension2, "isOpen", {result: false});
|
||||
|
||||
info("Test passing a windowId parameter");
|
||||
let windowId = window.getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
let windowId = window.windowUtils.outerWindowID;
|
||||
let WINDOW_ID_CURRENT = -2;
|
||||
await sendMessage(extension1, "isOpen", {arg: {windowId}, result: true});
|
||||
await sendMessage(extension2, "isOpen", {arg: {windowId}, result: false});
|
||||
|
@ -33,9 +33,7 @@ ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
// Hide the titlebar if the actual browser window will draw in it.
|
||||
if (Services.prefs.getBoolPref("browser.tabs.drawInTitlebar")) {
|
||||
win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.setChromeMargin(0, 2, 2, 2);
|
||||
win.windowUtils.setChromeMargin(0, 2, 2, 2);
|
||||
}
|
||||
|
||||
if (AppConstants.platform != "macosx") {
|
||||
|
@ -86,9 +86,7 @@ var PaymentTestUtils = {
|
||||
const rq = new content.PaymentRequest(methodData, details, options);
|
||||
content.rq = rq; // assign it so we can retrieve it later
|
||||
|
||||
const handle = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.setHandlingUserInput(true);
|
||||
const handle = content.windowUtils.setHandlingUserInput(true);
|
||||
content.showPromise = rq.show();
|
||||
|
||||
handle.destruct();
|
||||
|
@ -1280,8 +1280,7 @@ PlacesToolbar.prototype = {
|
||||
}
|
||||
this._updatingNodesVisibility = true;
|
||||
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
|
||||
let scrollRect =
|
||||
await window.promiseDocumentFlushed(() => dwu.getBoundsWithoutFlushing(this._rootElt));
|
||||
|
@ -248,9 +248,7 @@ var openContextMenuForContentSelector = async function(browser, selector) {
|
||||
dump(`openContextMenuForContentSelector: found ${elt}\n`);
|
||||
|
||||
/* Open context menu so chrome can access the element */
|
||||
const domWindowUtils =
|
||||
content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
const domWindowUtils = content.windowUtils;
|
||||
let rect = elt.getBoundingClientRect();
|
||||
let left = rect.left + rect.width / 2;
|
||||
let top = rect.top + rect.height / 2;
|
||||
|
@ -991,8 +991,7 @@
|
||||
<handler event="popupshowing"><![CDATA[
|
||||
// Force the panel to have the width of the searchbar rather than
|
||||
// the width of the textfield.
|
||||
let DOMUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let DOMUtils = window.windowUtils;
|
||||
let textboxRect = DOMUtils.getBoundsWithoutFlushing(this.mInput);
|
||||
let inputRect = DOMUtils.getBoundsWithoutFlushing(this.mInput.inputField);
|
||||
|
||||
@ -1442,8 +1441,7 @@
|
||||
if (this._textbox) {
|
||||
// We can't get a reliable value for the popup width without flushing,
|
||||
// but the popup width won't change if the textbox width doesn't.
|
||||
let DOMUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let DOMUtils = window.windowUtils;
|
||||
let textboxWidth =
|
||||
DOMUtils.getBoundsWithoutFlushing(this._textbox).width;
|
||||
// We can return early if neither the list of engines nor the panel
|
||||
@ -1482,9 +1480,7 @@
|
||||
// This is likely because the clientWidth getter rounds the value, but
|
||||
// the panel's border width is not an integer.
|
||||
// As a workaround, decrement the width if the scale is not an integer.
|
||||
let scale = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.screenPixelsPerCSSPixel;
|
||||
let scale = window.windowUtils.screenPixelsPerCSSPixel;
|
||||
if (Math.floor(scale) != scale) {
|
||||
--panelWidth;
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ function getHeaderText() {
|
||||
}
|
||||
|
||||
const msg = isMac ? 5 : 1;
|
||||
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
const utils = window.windowUtils;
|
||||
const scale = utils.screenPixelsPerCSSPixel;
|
||||
function synthesizeNativeMouseMove(aElement) {
|
||||
let rect = aElement.getBoundingClientRect();
|
||||
|
@ -12,8 +12,7 @@ const kValues = ["long text", "long text 2", "long text 3"];
|
||||
const isWindows = Services.appinfo.OS == "WINNT";
|
||||
const mouseDown = isWindows ? 2 : 1;
|
||||
const mouseUp = isWindows ? 4 : 2;
|
||||
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
const utils = window.windowUtils;
|
||||
const scale = utils.screenPixelsPerCSSPixel;
|
||||
|
||||
function synthesizeNativeMouseClick(aElement) {
|
||||
|
@ -516,9 +516,7 @@ class SessionStorageListener extends Handler {
|
||||
let {content} = this.mm;
|
||||
|
||||
// How much data does DOMSessionStorage contain?
|
||||
let usage = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.getStorageUsage(event.storageArea);
|
||||
let usage = content.windowUtils.getStorageUsage(event.storageArea);
|
||||
|
||||
// Don't store any data if we exceed the limit. Wipe any data we previously
|
||||
// collected so that we don't confuse websites with partial state.
|
||||
|
@ -196,9 +196,7 @@ var SessionStorageInternal = {
|
||||
}
|
||||
|
||||
// If the DOMSessionStorage contains too much data, ignore it.
|
||||
let usage = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.getStorageUsage(storage);
|
||||
let usage = window.windowUtils.getStorageUsage(storage);
|
||||
if (usage > Services.prefs.getIntPref(DOM_STORAGE_LIMIT_PREF)) {
|
||||
return hostData;
|
||||
}
|
||||
|
@ -4147,8 +4147,7 @@ var SessionStoreInternal = {
|
||||
var _this = this;
|
||||
function win_(aName) { return _this._getWindowDimension(win, aName); }
|
||||
|
||||
const dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
const dwu = win.windowUtils;
|
||||
// find available space on the screen where this window is being placed
|
||||
let screen = gScreenManager.screenForRect(aLeft, aTop, aWidth, aHeight);
|
||||
if (screen) {
|
||||
|
@ -25,8 +25,7 @@ const lameMultiWindowState = { windows: [
|
||||
|
||||
|
||||
function getOuterWindowID(aWindow) {
|
||||
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
return aWindow.windowUtils.outerWindowID;
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
@ -38,9 +38,7 @@ this.TranslationDocument.prototype = {
|
||||
* @param document The document to be translated
|
||||
*/
|
||||
_init(document) {
|
||||
let window = document.defaultView;
|
||||
let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let winUtils = document.defaultView.windowUtils;
|
||||
|
||||
// Get all the translation nodes in the document's body:
|
||||
// a translation node is a node from the document which
|
||||
|
@ -896,8 +896,7 @@ class FormAutofillHandler {
|
||||
/**
|
||||
* A WindowUtils reference of which Window the form belongs
|
||||
*/
|
||||
this.winUtils = this.form.rootElement.ownerGlobal.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
this.winUtils = this.form.rootElement.ownerGlobal.windowUtils;
|
||||
|
||||
/**
|
||||
* Time in milliseconds since epoch when a user started filling in the form.
|
||||
|
@ -1,5 +1,5 @@
|
||||
This is the PDF.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 2.0.688
|
||||
Current extension version is: 2.0.694
|
||||
|
||||
Taken from upstream commit: 61db85ab
|
||||
Taken from upstream commit: 1aaeaf33
|
||||
|
@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
"use strict";
|
||||
|
||||
|
||||
var pdfjsVersion = '2.0.688';
|
||||
var pdfjsBuild = '61db85ab';
|
||||
var pdfjsVersion = '2.0.694';
|
||||
var pdfjsBuild = '1aaeaf33';
|
||||
var pdfjsSharedUtil = __w_pdfjs_require__(1);
|
||||
var pdfjsDisplayAPI = __w_pdfjs_require__(7);
|
||||
var pdfjsDisplayTextLayer = __w_pdfjs_require__(19);
|
||||
@ -4223,7 +4223,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
||||
}
|
||||
return worker.messageHandler.sendWithPromise('GetDocRequest', {
|
||||
docId,
|
||||
apiVersion: '2.0.688',
|
||||
apiVersion: '2.0.694',
|
||||
source: {
|
||||
data: source.data,
|
||||
url: source.url,
|
||||
@ -5563,8 +5563,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
|
||||
}();
|
||||
var version, build;
|
||||
{
|
||||
exports.version = version = '2.0.688';
|
||||
exports.build = build = '61db85ab';
|
||||
exports.version = version = '2.0.694';
|
||||
exports.build = build = '1aaeaf33';
|
||||
}
|
||||
exports.getDocument = getDocument;
|
||||
exports.LoopbackPort = LoopbackPort;
|
||||
@ -8941,6 +8941,9 @@ class SimpleXMLParser extends XMLParserBase {
|
||||
return undefined;
|
||||
}
|
||||
const [documentElement] = this._currentFragment;
|
||||
if (!documentElement) {
|
||||
return undefined;
|
||||
}
|
||||
return { documentElement };
|
||||
}
|
||||
onResolveEntity(name) {
|
||||
|
@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
"use strict";
|
||||
|
||||
|
||||
var pdfjsVersion = '2.0.688';
|
||||
var pdfjsBuild = '61db85ab';
|
||||
var pdfjsVersion = '2.0.694';
|
||||
var pdfjsBuild = '1aaeaf33';
|
||||
var pdfjsCoreWorker = __w_pdfjs_require__(1);
|
||||
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
|
||||
|
||||
@ -327,7 +327,7 @@ var WorkerMessageHandler = {
|
||||
var cancelXHRs = null;
|
||||
var WorkerTasks = [];
|
||||
let apiVersion = docParams.apiVersion;
|
||||
let workerVersion = '2.0.688';
|
||||
let workerVersion = '2.0.694';
|
||||
if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||
}
|
||||
|
@ -1946,10 +1946,6 @@ exports.PDFPrintServiceFactory = PDFPrintServiceFactory;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.moveToEndOfArray = exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.getPageSizeInches = exports.roundToDivide = exports.getVisibleElements = exports.backtrackBeforeAllVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.isPortraitOrientation = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
|
||||
|
||||
var _pdfjsLib = __webpack_require__(3);
|
||||
|
||||
const CSS_UNITS = 96.0 / 72.0;
|
||||
const DEFAULT_SCALE_VALUE = 'auto';
|
||||
const DEFAULT_SCALE = 1.0;
|
||||
@ -2303,30 +2299,30 @@ const WaitOnType = {
|
||||
TIMEOUT: 'timeout'
|
||||
};
|
||||
function waitOnEventOrTimeout({ target, name, delay = 0 }) {
|
||||
if (typeof target !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) {
|
||||
return Promise.reject(new Error('waitOnEventOrTimeout - invalid parameters.'));
|
||||
}
|
||||
let capability = (0, _pdfjsLib.createPromiseCapability)();
|
||||
function handler(type) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (typeof target !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) {
|
||||
throw new Error('waitOnEventOrTimeout - invalid parameters.');
|
||||
}
|
||||
function handler(type) {
|
||||
if (target instanceof EventBus) {
|
||||
target.off(name, eventHandler);
|
||||
} else {
|
||||
target.removeEventListener(name, eventHandler);
|
||||
}
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
resolve(type);
|
||||
}
|
||||
const eventHandler = handler.bind(null, WaitOnType.EVENT);
|
||||
if (target instanceof EventBus) {
|
||||
target.off(name, eventHandler);
|
||||
target.on(name, eventHandler);
|
||||
} else {
|
||||
target.removeEventListener(name, eventHandler);
|
||||
target.addEventListener(name, eventHandler);
|
||||
}
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
capability.resolve(type);
|
||||
}
|
||||
let eventHandler = handler.bind(null, WaitOnType.EVENT);
|
||||
if (target instanceof EventBus) {
|
||||
target.on(name, eventHandler);
|
||||
} else {
|
||||
target.addEventListener(name, eventHandler);
|
||||
}
|
||||
let timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
|
||||
let timeout = setTimeout(timeoutHandler, delay);
|
||||
return capability.promise;
|
||||
const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
|
||||
let timeout = setTimeout(timeoutHandler, delay);
|
||||
});
|
||||
}
|
||||
let animationStarted = new Promise(function (resolve) {
|
||||
window.requestAnimationFrame(resolve);
|
||||
|
4
browser/extensions/pocket/bootstrap.js
vendored
4
browser/extensions/pocket/bootstrap.js
vendored
@ -478,12 +478,12 @@ var PocketOverlay = {
|
||||
},
|
||||
|
||||
addStyles(win) {
|
||||
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = win.windowUtils;
|
||||
utils.addSheet(this._cachedSheet, this._sheetType);
|
||||
},
|
||||
|
||||
removeStyles(win) {
|
||||
let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
let utils = win.windowUtils;
|
||||
utils.removeSheet(gPocketStyleURI, this._sheetType);
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,7 @@ async function togglePageActionPanel() {
|
||||
}
|
||||
|
||||
function promiseOpenPageActionPanel() {
|
||||
const dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
const dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
// Wait for the main page action button to become visible. It's hidden for
|
||||
// some URIs, so depending on when this is called, it may not yet be quite
|
||||
@ -55,8 +54,7 @@ function promisePageActionPanelEvent(eventType) {
|
||||
|
||||
function promisePageActionViewChildrenVisible(panelViewNode) {
|
||||
info("promisePageActionViewChildrenVisible waiting for a child node to be visible");
|
||||
const dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
const dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
const bodyNode = panelViewNode.firstChild;
|
||||
for (const childNode of bodyNode.childNodes) {
|
||||
|
@ -17,8 +17,7 @@ function isURLButtonEnabled() {
|
||||
}
|
||||
|
||||
function openPageActions() {
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
// Wait for the main page action button to become visible. It's hidden for
|
||||
// some URIs, so depending on when this is called, it may not yet be quite
|
||||
@ -55,8 +54,7 @@ function promisePageActionPanelShown() {
|
||||
|
||||
function promisePageActionViewChildrenVisible(panelViewNode) {
|
||||
info("promisePageActionViewChildrenVisible waiting for a child node to be visible");
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
let bodyNode = panelViewNode.firstChild;
|
||||
for (let childNode of bodyNode.childNodes) {
|
||||
|
@ -415,9 +415,7 @@ function getTabStateForContentWindow(aContentWindow) {
|
||||
}
|
||||
|
||||
function getInnerWindowIDForWindow(aContentWindow) {
|
||||
return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.currentInnerWindowID;
|
||||
return aContentWindow.windowUtils.currentInnerWindowID;
|
||||
}
|
||||
|
||||
function getMessageManagerForWindow(aContentWindow) {
|
||||
|
@ -203,7 +203,7 @@ FormSubmitObserver.prototype =
|
||||
} else {
|
||||
offset = parseInt(style.paddingLeft) + parseInt(style.borderLeftWidth);
|
||||
}
|
||||
let zoomFactor = this._getWindowUtils().fullZoom;
|
||||
let zoomFactor = this._content.windowUtils.fullZoom;
|
||||
panelData.offset = Math.round(offset * zoomFactor);
|
||||
panelData.position = "after_start";
|
||||
}
|
||||
@ -214,10 +214,6 @@ FormSubmitObserver.prototype =
|
||||
this._mm.sendAsyncMessage("FormValidation:HidePopup", {});
|
||||
},
|
||||
|
||||
_getWindowUtils() {
|
||||
return this._content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
},
|
||||
|
||||
_isRootDocumentEvent(aEvent) {
|
||||
if (this._content == null) {
|
||||
return true;
|
||||
|
@ -324,8 +324,7 @@ PluginContent.prototype = {
|
||||
[centerX, centerY]];
|
||||
|
||||
let contentWindow = plugin.ownerGlobal;
|
||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let cwu = contentWindow.windowUtils;
|
||||
|
||||
for (let [x, y] of points) {
|
||||
if (x < 0 || y < 0) {
|
||||
@ -657,8 +656,7 @@ PluginContent.prototype = {
|
||||
|
||||
reshowClickToPlayNotification() {
|
||||
let contentWindow = this.global.content;
|
||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let cwu = contentWindow.windowUtils;
|
||||
let plugins = cwu.plugins;
|
||||
for (let plugin of plugins) {
|
||||
let overlay = this.getPluginUI(plugin, "main");
|
||||
@ -676,8 +674,7 @@ PluginContent.prototype = {
|
||||
*/
|
||||
activatePlugins(pluginInfo, newState) {
|
||||
let contentWindow = this.global.content;
|
||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let cwu = contentWindow.windowUtils;
|
||||
let plugins = cwu.plugins;
|
||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
|
||||
@ -722,8 +719,7 @@ PluginContent.prototype = {
|
||||
// plugins, and we need to collect all the plugins.
|
||||
if (plugin === null) {
|
||||
let contentWindow = this.content;
|
||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let cwu = contentWindow.windowUtils;
|
||||
// cwu.plugins may contain non-plugin <object>s, filter them out
|
||||
plugins = cwu.plugins.filter((p) =>
|
||||
p.getContentTypeForMIMEType(p.actualType) == Ci.nsIObjectLoadingContent.TYPE_PLUGIN);
|
||||
@ -819,8 +815,7 @@ PluginContent.prototype = {
|
||||
}
|
||||
|
||||
// Remove plugins that are already active, or large enough to show an overlay.
|
||||
let cwu = this.content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let cwu = this.content.windowUtils;
|
||||
for (let plugin of cwu.plugins) {
|
||||
let info = this._getPluginInfo(plugin);
|
||||
if (!actions.has(info.permissionString)) {
|
||||
@ -967,8 +962,7 @@ PluginContent.prototype = {
|
||||
[pluginName], 1);
|
||||
|
||||
let contentWindow = this.global.content;
|
||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let cwu = contentWindow.windowUtils;
|
||||
let plugins = cwu.plugins;
|
||||
|
||||
for (let plugin of plugins) {
|
||||
@ -1053,8 +1047,7 @@ PluginContent.prototype = {
|
||||
|
||||
// Notify others that the crash reporter UI is now ready.
|
||||
// Currently, this event is only used by tests.
|
||||
let winUtils = this.content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let winUtils = this.content.windowUtils;
|
||||
let event = new this.content.CustomEvent("PluginCrashReporterDisplayed", {bubbles: true});
|
||||
winUtils.dispatchEventToChromeOnly(plugin, event);
|
||||
} else if (!doc.mozNoPluginCrashedNotification) {
|
||||
@ -1072,8 +1065,7 @@ PluginContent.prototype = {
|
||||
NPAPIPluginCrashReportSubmitted({ runID, state }) {
|
||||
this.pluginCrashData.delete(runID);
|
||||
let contentWindow = this.global.content;
|
||||
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let cwu = contentWindow.windowUtils;
|
||||
let plugins = cwu.plugins;
|
||||
|
||||
for (let plugin of plugins) {
|
||||
|
@ -195,7 +195,7 @@ PreviewController.prototype = {
|
||||
|
||||
get screenPixelsPerCSSPixel() {
|
||||
let chromeWin = this.tab.ownerGlobal;
|
||||
let windowUtils = chromeWin.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let windowUtils = chromeWin.windowUtils;
|
||||
return windowUtils.screenPixelsPerCSSPixel;
|
||||
},
|
||||
|
||||
|
@ -1677,8 +1677,7 @@ function assertActivatedPageActionPanelHidden() {
|
||||
}
|
||||
|
||||
function promiseOpenPageActionPanel() {
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
// Wait for the main page action button to become visible. It's hidden for
|
||||
// some URIs, so depending on when this is called, it may not yet be quite
|
||||
@ -1748,8 +1747,7 @@ function promisePageActionViewShown() {
|
||||
|
||||
function promisePageActionViewChildrenVisible(panelViewNode) {
|
||||
info("promisePageActionViewChildrenVisible waiting for a child node to be visible");
|
||||
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let dwu = window.windowUtils;
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
let bodyNode = panelViewNode.firstChild;
|
||||
for (let childNode of bodyNode.childNodes) {
|
||||
|
@ -42,8 +42,7 @@ async function compareImages(window, expected, test) {
|
||||
is(testCanvas.width, expectedCanvas.width, "The test and expected images must be the same size");
|
||||
is(testCanvas.height, expectedCanvas.height, "The test and expected images must be the same size");
|
||||
|
||||
const nsIDOMWindowUtils = window.getInterface(Ci.nsIDOMWindowUtils);
|
||||
return nsIDOMWindowUtils.compareCanvases(expectedCanvas, testCanvas, {});
|
||||
return window.windowUtils.compareCanvases(expectedCanvas, testCanvas, {});
|
||||
}
|
||||
|
||||
async function cropAndCompare(window, src, expected, test, region, subregions) {
|
||||
|
@ -10,12 +10,7 @@ Library('elfhack_inject')
|
||||
|
||||
DIST_INSTALL = False
|
||||
|
||||
if CONFIG['TARGET_CPU'].endswith('86'):
|
||||
cpu = 'x86'
|
||||
elif CONFIG['TARGET_CPU'].startswith('arm'):
|
||||
cpu = 'arm'
|
||||
else:
|
||||
cpu = CONFIG['TARGET_CPU']
|
||||
cpu = CONFIG['CPU_ARCH']
|
||||
|
||||
gen_src = '%s.c' % cpu
|
||||
GENERATED_FILES += [
|
||||
|
@ -14,12 +14,12 @@
|
||||
|
||||
#include "ExpandedPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "mozilla/ContentPrincipal.h"
|
||||
#include "mozilla/NullPrincipal.h"
|
||||
#include "mozilla/dom/BlobURLProtocolHandler.h"
|
||||
#include "mozilla/dom/ChromeUtils.h"
|
||||
#include "mozilla/dom/CSPDictionariesBinding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
@ -411,15 +411,12 @@ BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI,
|
||||
}
|
||||
|
||||
// Check whether the URI knows what its principal is supposed to be.
|
||||
nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(aURI);
|
||||
if (uriPrinc) {
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
uriPrinc->GetPrincipal(getter_AddRefs(principal));
|
||||
if (!principal) {
|
||||
return NullPrincipal::Create(aAttrs);
|
||||
}
|
||||
RefPtr<BasePrincipal> concrete = Cast(principal);
|
||||
return concrete.forget();
|
||||
nsCOMPtr<nsIPrincipal> blobPrincipal;
|
||||
if (dom::BlobURLProtocolHandler::GetBlobURLPrincipal(aURI,
|
||||
getter_AddRefs(blobPrincipal))) {
|
||||
MOZ_ASSERT(blobPrincipal);
|
||||
RefPtr<BasePrincipal> principal = Cast(blobPrincipal);
|
||||
return principal.forget();
|
||||
}
|
||||
|
||||
// Mint a codebase principal.
|
||||
@ -439,7 +436,7 @@ BasePrincipal::CreateCodebasePrincipal(const nsACString& aOrigin)
|
||||
"CreateCodebasePrincipal does not support NullPrincipal");
|
||||
|
||||
nsAutoCString originNoSuffix;
|
||||
mozilla::OriginAttributes attrs;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromOrigin(aOrigin, originNoSuffix)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "ContentPrincipal.h"
|
||||
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nscore.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsString.h"
|
||||
@ -15,7 +16,6 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIStandardURL.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
@ -27,6 +27,7 @@
|
||||
#include "nsNetCID.h"
|
||||
#include "js/Wrapper.h"
|
||||
|
||||
#include "mozilla/dom/BlobURLProtocolHandler.h"
|
||||
#include "mozilla/dom/nsCSPContext.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
@ -164,15 +165,11 @@ ContentPrincipal::GenerateOriginNoSuffixFromURI(nsIURI* aURI,
|
||||
|
||||
// This URL can be a blobURL. In this case, we should use the 'parent'
|
||||
// principal instead.
|
||||
nsCOMPtr<nsIURIWithPrincipal> uriWithPrincipal = do_QueryInterface(origin);
|
||||
if (uriWithPrincipal) {
|
||||
nsCOMPtr<nsIPrincipal> uriPrincipal;
|
||||
rv = uriWithPrincipal->GetPrincipal(getter_AddRefs(uriPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (uriPrincipal) {
|
||||
return uriPrincipal->GetOriginNoSuffix(aOriginNoSuffix);
|
||||
}
|
||||
nsCOMPtr<nsIPrincipal> blobPrincipal;
|
||||
if (dom::BlobURLProtocolHandler::GetBlobURLPrincipal(origin,
|
||||
getter_AddRefs(blobPrincipal))) {
|
||||
MOZ_ASSERT(blobPrincipal);
|
||||
return blobPrincipal->GetOriginNoSuffix(aOriginNoSuffix);
|
||||
}
|
||||
|
||||
// If we reached this branch, we can only create an origin if we have a
|
||||
@ -271,15 +268,13 @@ ContentPrincipal::GetURI(nsIURI** aURI)
|
||||
bool
|
||||
ContentPrincipal::MayLoadInternal(nsIURI* aURI)
|
||||
{
|
||||
// See if aURI is something like a Blob URI that is actually associated with
|
||||
// a principal.
|
||||
nsCOMPtr<nsIURIWithPrincipal> uriWithPrin = do_QueryInterface(aURI);
|
||||
nsCOMPtr<nsIPrincipal> uriPrin;
|
||||
if (uriWithPrin) {
|
||||
uriWithPrin->GetPrincipal(getter_AddRefs(uriPrin));
|
||||
}
|
||||
if (uriPrin) {
|
||||
return nsIPrincipal::Subsumes(uriPrin);
|
||||
MOZ_ASSERT(aURI);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> blobPrincipal;
|
||||
if (dom::BlobURLProtocolHandler::GetBlobURLPrincipal(aURI,
|
||||
getter_AddRefs(blobPrincipal))) {
|
||||
MOZ_ASSERT(blobPrincipal);
|
||||
return nsIPrincipal::Subsumes(blobPrincipal);
|
||||
}
|
||||
|
||||
// If this principal is associated with an addon, check whether that addon
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "NullPrincipal.h"
|
||||
#include "NullPrincipalURI.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsError.h"
|
||||
@ -185,14 +184,10 @@ bool
|
||||
NullPrincipal::MayLoadInternal(nsIURI* aURI)
|
||||
{
|
||||
// Also allow the load if we are the principal of the URI being checked.
|
||||
nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(aURI);
|
||||
if (uriPrinc) {
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
uriPrinc->GetPrincipal(getter_AddRefs(principal));
|
||||
|
||||
if (principal == this) {
|
||||
return true;
|
||||
}
|
||||
nsCOMPtr<nsIPrincipal> blobPrincipal;
|
||||
if (dom::BlobURLProtocolHandler::GetBlobURLPrincipal(aURI,
|
||||
getter_AddRefs(blobPrincipal))) {
|
||||
return blobPrincipal == this;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/BlobURLProtocolHandler.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsURLHelper.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -86,18 +86,15 @@ OriginAttributes::SetFirstPartyDomain(const bool aIsTopLevelDocument,
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (scheme.EqualsLiteral("about")) {
|
||||
mFirstPartyDomain.AssignLiteral(ABOUT_URI_FIRST_PARTY_DOMAIN);
|
||||
} else if (scheme.EqualsLiteral("blob")) {
|
||||
nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(aURI);
|
||||
if (uriPrinc) {
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv = uriPrinc->GetPrincipal(getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(principal, "blob URI but no principal.");
|
||||
if (principal) {
|
||||
mFirstPartyDomain = principal->OriginAttributesRef().mFirstPartyDomain;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIPrincipal> blobPrincipal;
|
||||
if (dom::BlobURLProtocolHandler::GetBlobURLPrincipal(aURI,
|
||||
getter_AddRefs(blobPrincipal))) {
|
||||
MOZ_ASSERT(blobPrincipal);
|
||||
mFirstPartyDomain = blobPrincipal->OriginAttributesRef().mFirstPartyDomain;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=995943
|
||||
|
||||
var gGoCount = 0;
|
||||
function go() {
|
||||
debug("Invoking go for window with id: " + window.getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID);
|
||||
debug("Invoking go for window with id: " + window.windowUtils.currentInnerWindowID);
|
||||
is(++gGoCount, 1, "Should only call go once!");
|
||||
checkLoadFileURI('http://example.com', false).then(
|
||||
pushPrefs.bind(null, [['capability.policy.policynames', ' somepolicy '],
|
||||
|
2
config/external/ffi/moz.build
vendored
2
config/external/ffi/moz.build
vendored
@ -110,7 +110,7 @@ else:
|
||||
SOURCES += ['!win64.asm']
|
||||
elif CONFIG['FFI_TARGET'] == 'X86_DARWIN':
|
||||
DEFINES['FFI_MMAP_EXEC_WRIT'] = True
|
||||
if CONFIG['OS_TEST'] != 'x86_64':
|
||||
if CONFIG['CPU_ARCH'] == 'x86':
|
||||
ffi_srcs = ('ffi.c', 'darwin.S', 'ffi64.c', 'darwin64.S',
|
||||
'win32.S')
|
||||
DEFINES['SYMBOL_UNDERSCORE'] = True
|
||||
|
@ -37,7 +37,5 @@ function whenDelayedStartupFinished(aWindow, aCallback) {
|
||||
* Bug 774619 is an example.
|
||||
*/
|
||||
registerCleanupFunction(function tearDown() {
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.garbageCollect();
|
||||
window.windowUtils.garbageCollect();
|
||||
});
|
||||
|
@ -1,9 +1,9 @@
|
||||
This is the debugger.html project output.
|
||||
See https://github.com/devtools-html/debugger.html
|
||||
|
||||
Version 73
|
||||
Version 74
|
||||
|
||||
Comparison: https://github.com/devtools-html/debugger.html/compare/release-72...release-73
|
||||
Comparison: https://github.com/devtools-html/debugger.html/compare/release-73...release-74
|
||||
|
||||
Packages:
|
||||
- babel-plugin-transform-es2015-modules-commonjs @6.26.2
|
||||
|
28
devtools/client/debugger/new/dist/debugger.css
vendored
28
devtools/client/debugger/new/dist/debugger.css
vendored
@ -1288,6 +1288,22 @@ html .toggle-button.end.vertical svg {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
.container {
|
||||
background-color: lightgrey;
|
||||
border: 1px solid darkgrey;
|
||||
cursor: pointer;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
.container[aria-selected=true] {
|
||||
background-color: white;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 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/>. */
|
||||
@ -1353,6 +1369,7 @@ html .toggle-button.end.vertical svg {
|
||||
flex: 1;
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sources-list {
|
||||
@ -1420,7 +1437,7 @@ html .toggle-button.end.vertical svg {
|
||||
|
||||
.sources-panel .outline {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tree-indent {
|
||||
@ -1436,6 +1453,8 @@ html .toggle-button.end.vertical svg {
|
||||
user-select: none;
|
||||
box-sizing: border-box;
|
||||
height: 30px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.source-outline-tabs .tab {
|
||||
@ -1474,6 +1493,10 @@ html .toggle-button.end.vertical svg {
|
||||
fill: var(--theme-body-color);
|
||||
}
|
||||
|
||||
.source-outline-panel {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sources-list .managed-tree .tree .node img.blackBox {
|
||||
mask: url("chrome://devtools/skin/images/debugger/blackBox.svg") no-repeat;
|
||||
mask-size: 100%;
|
||||
@ -2438,12 +2461,9 @@ button.jump-definition {
|
||||
.popover .preview-popup {
|
||||
background: var(--theme-body-background);
|
||||
width: 350px;
|
||||
min-height: 80px;
|
||||
border: 1px solid var(--theme-splitter-color);
|
||||
padding: 10px;
|
||||
height: auto;
|
||||
min-height: inherit;
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
box-shadow: 1px 2px 3px var(--popup-shadow-color);
|
||||
}
|
||||
|
296
devtools/client/debugger/new/dist/parser-worker.js
vendored
296
devtools/client/debugger/new/dist/parser-worker.js
vendored
@ -762,212 +762,6 @@ function overArg(func, transform) {
|
||||
module.exports = overArg;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1363:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
const networkRequest = __webpack_require__(1367);
|
||||
const workerUtils = __webpack_require__(1368);
|
||||
|
||||
module.exports = {
|
||||
networkRequest,
|
||||
workerUtils
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1367:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
return fetch(url, {
|
||||
cache: opts.loadFromCache ? "default" : "no-cache"
|
||||
}).then(res => {
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
return res.text().then(text => ({ content: text }));
|
||||
}
|
||||
return Promise.reject(`request failed with status ${res.status}`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = networkRequest;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1368:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
function WorkerDispatcher() {
|
||||
this.msgId = 1;
|
||||
this.worker = null;
|
||||
} /* 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/. */
|
||||
|
||||
WorkerDispatcher.prototype = {
|
||||
start(url) {
|
||||
this.worker = new Worker(url);
|
||||
this.worker.onerror = () => {
|
||||
console.error(`Error in worker ${url}`);
|
||||
};
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
},
|
||||
|
||||
task(method, { queue = false } = {}) {
|
||||
const calls = [];
|
||||
const push = args => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (queue && calls.length === 0) {
|
||||
Promise.resolve().then(flush);
|
||||
}
|
||||
|
||||
calls.push([args, resolve, reject]);
|
||||
|
||||
if (!queue) {
|
||||
flush();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const items = calls.slice();
|
||||
calls.length = 0;
|
||||
|
||||
const id = this.msgId++;
|
||||
this.worker.postMessage({ id, method, calls: items.map(item => item[0]) });
|
||||
|
||||
const listener = ({ data: result }) => {
|
||||
if (result.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.removeEventListener("message", listener);
|
||||
|
||||
result.results.forEach((resultData, i) => {
|
||||
const [, resolve, reject] = items[i];
|
||||
|
||||
if (resultData.error) {
|
||||
reject(resultData.error);
|
||||
} else {
|
||||
resolve(resultData.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.worker.addEventListener("message", listener);
|
||||
};
|
||||
|
||||
return (...args) => push(args);
|
||||
}
|
||||
};
|
||||
|
||||
function workerHandler(publicInterface) {
|
||||
return function (msg) {
|
||||
const { id, method, calls } = msg.data;
|
||||
|
||||
Promise.all(calls.map(args => {
|
||||
try {
|
||||
const response = publicInterface[method].apply(undefined, args);
|
||||
if (response instanceof Promise) {
|
||||
return response.then(val => ({ response: val }),
|
||||
// Error can't be sent via postMessage, so be sure to
|
||||
// convert to string.
|
||||
err => ({ error: err.toString() }));
|
||||
} else {
|
||||
return { response };
|
||||
}
|
||||
} catch (error) {
|
||||
// Error can't be sent via postMessage, so be sure to convert to
|
||||
// string.
|
||||
return { error: error.toString() };
|
||||
}
|
||||
})).then(results => {
|
||||
self.postMessage({ id, results });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
|
||||
let streamingWorker = (() => {
|
||||
var _ref = _asyncToGenerator(function* (id, tasks) {
|
||||
let isWorking = true;
|
||||
|
||||
const intervalId = setTimeout(function () {
|
||||
isWorking = false;
|
||||
}, timeout);
|
||||
|
||||
const results = [];
|
||||
while (tasks.length !== 0 && isWorking) {
|
||||
const { callback, context, args } = tasks.shift();
|
||||
const result = yield callback.call(context, args);
|
||||
results.push(result);
|
||||
}
|
||||
worker.postMessage({ id, status: "pending", data: results });
|
||||
clearInterval(intervalId);
|
||||
|
||||
if (tasks.length !== 0) {
|
||||
yield streamingWorker(id, tasks);
|
||||
}
|
||||
});
|
||||
|
||||
return function streamingWorker(_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
return (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (msg) {
|
||||
const { id, method, args } = msg.data;
|
||||
const workerMethod = publicInterface[method];
|
||||
if (!workerMethod) {
|
||||
console.error(`Could not find ${method} defined in worker.`);
|
||||
}
|
||||
worker.postMessage({ id, status: "start" });
|
||||
|
||||
try {
|
||||
const tasks = workerMethod(args);
|
||||
yield streamingWorker(id, tasks);
|
||||
worker.postMessage({ id, status: "done" });
|
||||
} catch (error) {
|
||||
worker.postMessage({ id, status: "error", error });
|
||||
}
|
||||
});
|
||||
|
||||
return function (_x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
WorkerDispatcher,
|
||||
workerHandler,
|
||||
streamingWorkerHandler
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1375:
|
||||
@ -1947,7 +1741,7 @@ var _mapExpression = __webpack_require__(3755);
|
||||
|
||||
var _mapExpression2 = _interopRequireDefault(_mapExpression);
|
||||
|
||||
var _devtoolsUtils = __webpack_require__(1363);
|
||||
var _devtoolsUtils = __webpack_require__(3651);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -24708,6 +24502,10 @@ class SimplePath {
|
||||
return node[key];
|
||||
}
|
||||
|
||||
get key() {
|
||||
return this._ancestor.key;
|
||||
}
|
||||
|
||||
set node(replacement) {
|
||||
if (this.type !== "Identifier") {
|
||||
throw new Error("Replacing anything other than leaf nodes is undefined behavior " + "in t.traverse()");
|
||||
@ -24821,7 +24619,7 @@ const isImport = node => t.isImport(node) || t.isImportDeclaration(node);
|
||||
const isReturn = node => t.isReturnStatement(node);
|
||||
const isCall = node => t.isCallExpression(node) || t.isJSXElement(node);
|
||||
|
||||
const inStepExpression = parent => t.isArrayExpression(parent) || t.isObjectProperty(parent) || t.isCallExpression(parent) || t.isJSXElement(parent);
|
||||
const inStepExpression = parent => t.isArrayExpression(parent) || t.isObjectProperty(parent) || t.isCallExpression(parent) || t.isJSXElement(parent) || t.isSequenceExpression(parent);
|
||||
|
||||
const inExpression = (parent, grandParent) => inStepExpression(parent) || t.isJSXAttribute(grandParent) || t.isTemplateLiteral(parent);
|
||||
|
||||
@ -24831,6 +24629,52 @@ function getStartLine(node) {
|
||||
return node.loc.start.line;
|
||||
}
|
||||
|
||||
// Finds the first call item in a step expression so that we can step
|
||||
// to the beginning of the list and either step in or over. e.g. [], x(), { }
|
||||
function isFirstCall(node, parentNode, grandParentNode) {
|
||||
let children = [];
|
||||
if (t.isArrayExpression(parentNode)) {
|
||||
children = parentNode.elements;
|
||||
}
|
||||
|
||||
if (t.isObjectProperty(parentNode)) {
|
||||
children = grandParentNode.properties.map(({ value }) => value);
|
||||
}
|
||||
|
||||
if (t.isSequenceExpression(parentNode)) {
|
||||
children = parentNode.expressions;
|
||||
}
|
||||
|
||||
if (t.isCallExpression(parentNode)) {
|
||||
children = parentNode.arguments;
|
||||
}
|
||||
|
||||
return children.find(child => isCall(child)) === node;
|
||||
}
|
||||
|
||||
// Check to see if the node is a step expression and if any of its children
|
||||
// expressions include calls. e.g. [ a() ], { a: a() }
|
||||
function hasCall(node) {
|
||||
let children = [];
|
||||
if (t.isArrayExpression(node)) {
|
||||
children = node.elements;
|
||||
}
|
||||
|
||||
if (t.isObjectExpression(node)) {
|
||||
children = node.properties.map(({ value }) => value);
|
||||
}
|
||||
|
||||
if (t.isSequenceExpression(node)) {
|
||||
children = node.expressions;
|
||||
}
|
||||
|
||||
if (t.isCallExpression(node)) {
|
||||
children = node.arguments;
|
||||
}
|
||||
|
||||
return children.find(child => isCall(child));
|
||||
}
|
||||
|
||||
function getPausePoints(sourceId) {
|
||||
const state = {};
|
||||
(0, _ast.traverseAst)(sourceId, { enter: onEnter }, state);
|
||||
@ -24842,18 +24686,15 @@ function onEnter(node, ancestors, state) {
|
||||
const parent = ancestors[ancestors.length - 1];
|
||||
const parentNode = parent && parent.node;
|
||||
const grandParent = ancestors[ancestors.length - 2];
|
||||
const grandParentNode = grandParent && grandParent.node;
|
||||
const startLocation = node.loc.start;
|
||||
|
||||
if (isImport(node) || t.isClassDeclaration(node) || isExport(node) || t.isDebuggerStatement(node) || t.isThrowStatement(node) || t.isExpressionStatement(node) || t.isBreakStatement(node) || t.isContinueStatement(node)) {
|
||||
if (isImport(node) || t.isClassDeclaration(node) || isExport(node) || t.isDebuggerStatement(node) || t.isThrowStatement(node) || t.isBreakStatement(node) || t.isContinueStatement(node)) {
|
||||
return addStopPoint(state, startLocation);
|
||||
}
|
||||
|
||||
if (isControlFlow(node)) {
|
||||
if (isForStatement(node)) {
|
||||
addStopPoint(state, startLocation);
|
||||
} else {
|
||||
addEmptyPoint(state, startLocation);
|
||||
}
|
||||
addPoint(state, startLocation, isForStatement(node));
|
||||
|
||||
const test = node.test || node.discriminant;
|
||||
if (test) {
|
||||
@ -24862,28 +24703,25 @@ function onEnter(node, ancestors, state) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.isBlockStatement(node)) {
|
||||
if (t.isBlockStatement(node) || t.isArrayExpression(node)) {
|
||||
return addEmptyPoint(state, startLocation);
|
||||
}
|
||||
|
||||
if (isReturn(node)) {
|
||||
// We do not want to pause at the return if the
|
||||
// argument is a call on the same line e.g. return foo()
|
||||
if (isCall(node.argument) && getStartLine(node) == getStartLine(node.argument)) {
|
||||
return addEmptyPoint(state, startLocation);
|
||||
}
|
||||
|
||||
return addStopPoint(state, startLocation);
|
||||
return addPoint(state, startLocation, !isCall(node.argument) || getStartLine(node) != getStartLine(node.argument));
|
||||
}
|
||||
|
||||
if (isAssignment(node)) {
|
||||
// We only want to pause at literal assignments `var a = foo()`
|
||||
// step at assignments unless the right side is a call or default assignment
|
||||
// e.g. `var a = b()`, `a = b(c = 2)`, `a = [ b() ]`
|
||||
const value = node.right || node.init;
|
||||
const defaultAssignment = t.isFunction(parentNode) && parent.key === "params";
|
||||
const includesCall = isCall(value) || hasCall(value);
|
||||
|
||||
if (isCall(value) || t.isFunction(parentNode)) {
|
||||
return addEmptyPoint(state, startLocation);
|
||||
}
|
||||
return addStopPoint(state, startLocation);
|
||||
return addPoint(state, startLocation, !includesCall && !defaultAssignment);
|
||||
}
|
||||
|
||||
if (isCall(node)) {
|
||||
@ -24895,13 +24733,15 @@ function onEnter(node, ancestors, state) {
|
||||
location = node.callee.property.loc.start;
|
||||
}
|
||||
|
||||
// NOTE: we do not want to land inside an expression e.g. [], {}, call
|
||||
const step = !inExpression(parent.node, grandParent && grandParent.node);
|
||||
// NOTE: We want to skip all nested calls in expressions except for the
|
||||
// first call in arrays and objects expression e.g. [], {}, call
|
||||
const step = isFirstCall(node, parentNode, grandParentNode) || !inExpression(parentNode, grandParentNode);
|
||||
|
||||
// NOTE: we add a point at the beginning of the expression
|
||||
// and each of the calls because the engine does not support
|
||||
// column-based member expression calls.
|
||||
addPoint(state, startLocation, { break: true, step });
|
||||
|
||||
if (location && !(0, _isEqual2.default)(location, startLocation)) {
|
||||
addPoint(state, location, { break: true, step });
|
||||
}
|
||||
@ -24929,6 +24769,10 @@ function hasPoint(state, { line, column }) {
|
||||
}
|
||||
|
||||
function addPoint(state, { line, column }, types) {
|
||||
if (typeof types === "boolean") {
|
||||
types = { step: types, break: types };
|
||||
}
|
||||
|
||||
if (!state[line]) {
|
||||
state[line] = {};
|
||||
}
|
||||
|
@ -81,212 +81,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
module.exports = __webpack_require__(1630);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1363:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
const networkRequest = __webpack_require__(1367);
|
||||
const workerUtils = __webpack_require__(1368);
|
||||
|
||||
module.exports = {
|
||||
networkRequest,
|
||||
workerUtils
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1367:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
return fetch(url, {
|
||||
cache: opts.loadFromCache ? "default" : "no-cache"
|
||||
}).then(res => {
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
return res.text().then(text => ({ content: text }));
|
||||
}
|
||||
return Promise.reject(`request failed with status ${res.status}`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = networkRequest;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1368:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
function WorkerDispatcher() {
|
||||
this.msgId = 1;
|
||||
this.worker = null;
|
||||
} /* 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/. */
|
||||
|
||||
WorkerDispatcher.prototype = {
|
||||
start(url) {
|
||||
this.worker = new Worker(url);
|
||||
this.worker.onerror = () => {
|
||||
console.error(`Error in worker ${url}`);
|
||||
};
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
},
|
||||
|
||||
task(method, { queue = false } = {}) {
|
||||
const calls = [];
|
||||
const push = args => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (queue && calls.length === 0) {
|
||||
Promise.resolve().then(flush);
|
||||
}
|
||||
|
||||
calls.push([args, resolve, reject]);
|
||||
|
||||
if (!queue) {
|
||||
flush();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const items = calls.slice();
|
||||
calls.length = 0;
|
||||
|
||||
const id = this.msgId++;
|
||||
this.worker.postMessage({ id, method, calls: items.map(item => item[0]) });
|
||||
|
||||
const listener = ({ data: result }) => {
|
||||
if (result.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.removeEventListener("message", listener);
|
||||
|
||||
result.results.forEach((resultData, i) => {
|
||||
const [, resolve, reject] = items[i];
|
||||
|
||||
if (resultData.error) {
|
||||
reject(resultData.error);
|
||||
} else {
|
||||
resolve(resultData.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.worker.addEventListener("message", listener);
|
||||
};
|
||||
|
||||
return (...args) => push(args);
|
||||
}
|
||||
};
|
||||
|
||||
function workerHandler(publicInterface) {
|
||||
return function (msg) {
|
||||
const { id, method, calls } = msg.data;
|
||||
|
||||
Promise.all(calls.map(args => {
|
||||
try {
|
||||
const response = publicInterface[method].apply(undefined, args);
|
||||
if (response instanceof Promise) {
|
||||
return response.then(val => ({ response: val }),
|
||||
// Error can't be sent via postMessage, so be sure to
|
||||
// convert to string.
|
||||
err => ({ error: err.toString() }));
|
||||
} else {
|
||||
return { response };
|
||||
}
|
||||
} catch (error) {
|
||||
// Error can't be sent via postMessage, so be sure to convert to
|
||||
// string.
|
||||
return { error: error.toString() };
|
||||
}
|
||||
})).then(results => {
|
||||
self.postMessage({ id, results });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
|
||||
let streamingWorker = (() => {
|
||||
var _ref = _asyncToGenerator(function* (id, tasks) {
|
||||
let isWorking = true;
|
||||
|
||||
const intervalId = setTimeout(function () {
|
||||
isWorking = false;
|
||||
}, timeout);
|
||||
|
||||
const results = [];
|
||||
while (tasks.length !== 0 && isWorking) {
|
||||
const { callback, context, args } = tasks.shift();
|
||||
const result = yield callback.call(context, args);
|
||||
results.push(result);
|
||||
}
|
||||
worker.postMessage({ id, status: "pending", data: results });
|
||||
clearInterval(intervalId);
|
||||
|
||||
if (tasks.length !== 0) {
|
||||
yield streamingWorker(id, tasks);
|
||||
}
|
||||
});
|
||||
|
||||
return function streamingWorker(_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
return (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (msg) {
|
||||
const { id, method, args } = msg.data;
|
||||
const workerMethod = publicInterface[method];
|
||||
if (!workerMethod) {
|
||||
console.error(`Could not find ${method} defined in worker.`);
|
||||
}
|
||||
worker.postMessage({ id, status: "start" });
|
||||
|
||||
try {
|
||||
const tasks = workerMethod(args);
|
||||
yield streamingWorker(id, tasks);
|
||||
worker.postMessage({ id, status: "done" });
|
||||
} catch (error) {
|
||||
worker.postMessage({ id, status: "error", error });
|
||||
}
|
||||
});
|
||||
|
||||
return function (_x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
WorkerDispatcher,
|
||||
workerHandler,
|
||||
streamingWorkerHandler
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1630:
|
||||
@ -299,7 +93,7 @@ var _prettyFast = __webpack_require__(802);
|
||||
|
||||
var _prettyFast2 = _interopRequireDefault(_prettyFast);
|
||||
|
||||
var _devtoolsUtils = __webpack_require__(1363);
|
||||
var _devtoolsUtils = __webpack_require__(3651);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -345,6 +139,219 @@ self.onmessage = workerHandler({ prettyPrint });
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3651:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
const networkRequest = __webpack_require__(3653);
|
||||
const workerUtils = __webpack_require__(3654);
|
||||
|
||||
module.exports = {
|
||||
networkRequest,
|
||||
workerUtils
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3653:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/* 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/>. */
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
return fetch(url, {
|
||||
cache: opts.loadFromCache ? "default" : "no-cache"
|
||||
}).then(res => {
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
return res.text().then(text => ({ content: text }));
|
||||
}
|
||||
return Promise.reject(`request failed with status ${res.status}`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = networkRequest;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3654:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
function WorkerDispatcher() {
|
||||
this.msgId = 1;
|
||||
this.worker = null;
|
||||
} /* 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/>. */
|
||||
|
||||
WorkerDispatcher.prototype = {
|
||||
start(url) {
|
||||
this.worker = new Worker(url);
|
||||
this.worker.onerror = () => {
|
||||
console.error(`Error in worker ${url}`);
|
||||
};
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
},
|
||||
|
||||
task(method, { queue = false } = {}) {
|
||||
const calls = [];
|
||||
const push = args => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (queue && calls.length === 0) {
|
||||
Promise.resolve().then(flush);
|
||||
}
|
||||
|
||||
calls.push([args, resolve, reject]);
|
||||
|
||||
if (!queue) {
|
||||
flush();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const items = calls.slice();
|
||||
calls.length = 0;
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = this.msgId++;
|
||||
this.worker.postMessage({
|
||||
id,
|
||||
method,
|
||||
calls: items.map(item => item[0])
|
||||
});
|
||||
|
||||
const listener = ({ data: result }) => {
|
||||
if (result.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.removeEventListener("message", listener);
|
||||
|
||||
result.results.forEach((resultData, i) => {
|
||||
const [, resolve, reject] = items[i];
|
||||
|
||||
if (resultData.error) {
|
||||
reject(resultData.error);
|
||||
} else {
|
||||
resolve(resultData.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.worker.addEventListener("message", listener);
|
||||
};
|
||||
|
||||
return (...args) => push(args);
|
||||
}
|
||||
};
|
||||
|
||||
function workerHandler(publicInterface) {
|
||||
return function (msg) {
|
||||
const { id, method, calls } = msg.data;
|
||||
|
||||
Promise.all(calls.map(args => {
|
||||
try {
|
||||
const response = publicInterface[method].apply(undefined, args);
|
||||
if (response instanceof Promise) {
|
||||
return response.then(val => ({ response: val }),
|
||||
// Error can't be sent via postMessage, so be sure to
|
||||
// convert to string.
|
||||
err => ({ error: err.toString() }));
|
||||
}
|
||||
return { response };
|
||||
} catch (error) {
|
||||
// Error can't be sent via postMessage, so be sure to convert to
|
||||
// string.
|
||||
return { error: error.toString() };
|
||||
}
|
||||
})).then(results => {
|
||||
self.postMessage({ id, results });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
|
||||
let streamingWorker = (() => {
|
||||
var _ref = _asyncToGenerator(function* (id, tasks) {
|
||||
let isWorking = true;
|
||||
|
||||
const timeoutId = setTimeout(function () {
|
||||
isWorking = false;
|
||||
}, timeout);
|
||||
|
||||
const results = [];
|
||||
while (tasks.length !== 0 && isWorking) {
|
||||
const { callback, context, args } = tasks.shift();
|
||||
const result = yield callback.call(context, args);
|
||||
results.push(result);
|
||||
}
|
||||
worker.postMessage({ id, status: "pending", data: results });
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (tasks.length !== 0) {
|
||||
yield streamingWorker(id, tasks);
|
||||
}
|
||||
});
|
||||
|
||||
return function streamingWorker(_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
return (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (msg) {
|
||||
const { id, method, args } = msg.data;
|
||||
const workerMethod = publicInterface[method];
|
||||
if (!workerMethod) {
|
||||
console.error(`Could not find ${method} defined in worker.`);
|
||||
}
|
||||
worker.postMessage({ id, status: "start" });
|
||||
|
||||
try {
|
||||
const tasks = workerMethod(args);
|
||||
yield streamingWorker(id, tasks);
|
||||
worker.postMessage({ id, status: "done" });
|
||||
} catch (error) {
|
||||
worker.postMessage({ id, status: "error", error });
|
||||
}
|
||||
});
|
||||
|
||||
return function (_x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
WorkerDispatcher,
|
||||
workerHandler,
|
||||
streamingWorkerHandler
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 381:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
|
587
devtools/client/debugger/new/dist/search-worker.js
vendored
587
devtools/client/debugger/new/dist/search-worker.js
vendored
@ -270,212 +270,6 @@ module.exports = arrayMap;
|
||||
module.exports = __webpack_require__(1631);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1363:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
const networkRequest = __webpack_require__(1367);
|
||||
const workerUtils = __webpack_require__(1368);
|
||||
|
||||
module.exports = {
|
||||
networkRequest,
|
||||
workerUtils
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1367:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
return fetch(url, {
|
||||
cache: opts.loadFromCache ? "default" : "no-cache"
|
||||
}).then(res => {
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
return res.text().then(text => ({ content: text }));
|
||||
}
|
||||
return Promise.reject(`request failed with status ${res.status}`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = networkRequest;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1368:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
function WorkerDispatcher() {
|
||||
this.msgId = 1;
|
||||
this.worker = null;
|
||||
} /* 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/. */
|
||||
|
||||
WorkerDispatcher.prototype = {
|
||||
start(url) {
|
||||
this.worker = new Worker(url);
|
||||
this.worker.onerror = () => {
|
||||
console.error(`Error in worker ${url}`);
|
||||
};
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
},
|
||||
|
||||
task(method, { queue = false } = {}) {
|
||||
const calls = [];
|
||||
const push = args => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (queue && calls.length === 0) {
|
||||
Promise.resolve().then(flush);
|
||||
}
|
||||
|
||||
calls.push([args, resolve, reject]);
|
||||
|
||||
if (!queue) {
|
||||
flush();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const items = calls.slice();
|
||||
calls.length = 0;
|
||||
|
||||
const id = this.msgId++;
|
||||
this.worker.postMessage({ id, method, calls: items.map(item => item[0]) });
|
||||
|
||||
const listener = ({ data: result }) => {
|
||||
if (result.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.removeEventListener("message", listener);
|
||||
|
||||
result.results.forEach((resultData, i) => {
|
||||
const [, resolve, reject] = items[i];
|
||||
|
||||
if (resultData.error) {
|
||||
reject(resultData.error);
|
||||
} else {
|
||||
resolve(resultData.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.worker.addEventListener("message", listener);
|
||||
};
|
||||
|
||||
return (...args) => push(args);
|
||||
}
|
||||
};
|
||||
|
||||
function workerHandler(publicInterface) {
|
||||
return function (msg) {
|
||||
const { id, method, calls } = msg.data;
|
||||
|
||||
Promise.all(calls.map(args => {
|
||||
try {
|
||||
const response = publicInterface[method].apply(undefined, args);
|
||||
if (response instanceof Promise) {
|
||||
return response.then(val => ({ response: val }),
|
||||
// Error can't be sent via postMessage, so be sure to
|
||||
// convert to string.
|
||||
err => ({ error: err.toString() }));
|
||||
} else {
|
||||
return { response };
|
||||
}
|
||||
} catch (error) {
|
||||
// Error can't be sent via postMessage, so be sure to convert to
|
||||
// string.
|
||||
return { error: error.toString() };
|
||||
}
|
||||
})).then(results => {
|
||||
self.postMessage({ id, results });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
|
||||
let streamingWorker = (() => {
|
||||
var _ref = _asyncToGenerator(function* (id, tasks) {
|
||||
let isWorking = true;
|
||||
|
||||
const intervalId = setTimeout(function () {
|
||||
isWorking = false;
|
||||
}, timeout);
|
||||
|
||||
const results = [];
|
||||
while (tasks.length !== 0 && isWorking) {
|
||||
const { callback, context, args } = tasks.shift();
|
||||
const result = yield callback.call(context, args);
|
||||
results.push(result);
|
||||
}
|
||||
worker.postMessage({ id, status: "pending", data: results });
|
||||
clearInterval(intervalId);
|
||||
|
||||
if (tasks.length !== 0) {
|
||||
yield streamingWorker(id, tasks);
|
||||
}
|
||||
});
|
||||
|
||||
return function streamingWorker(_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
return (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (msg) {
|
||||
const { id, method, args } = msg.data;
|
||||
const workerMethod = publicInterface[method];
|
||||
if (!workerMethod) {
|
||||
console.error(`Could not find ${method} defined in worker.`);
|
||||
}
|
||||
worker.postMessage({ id, status: "start" });
|
||||
|
||||
try {
|
||||
const tasks = workerMethod(args);
|
||||
yield streamingWorker(id, tasks);
|
||||
worker.postMessage({ id, status: "done" });
|
||||
} catch (error) {
|
||||
worker.postMessage({ id, status: "error", error });
|
||||
}
|
||||
});
|
||||
|
||||
return function (_x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
WorkerDispatcher,
|
||||
workerHandler,
|
||||
streamingWorkerHandler
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 14:
|
||||
@ -512,88 +306,6 @@ function isObjectLike(value) {
|
||||
module.exports = isObjectLike;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1402:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = buildQuery;
|
||||
|
||||
var _escapeRegExp = __webpack_require__(259);
|
||||
|
||||
var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Ignore doing outline matches for less than 3 whitespaces
|
||||
*
|
||||
* @memberof utils/source-search
|
||||
* @static
|
||||
*/
|
||||
function ignoreWhiteSpace(str) {
|
||||
return (/^\s{0,2}$/.test(str) ? "(?!\\s*.*)" : str
|
||||
);
|
||||
} /* 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/>. */
|
||||
|
||||
function wholeMatch(query, wholeWord) {
|
||||
if (query === "" || !wholeWord) {
|
||||
return query;
|
||||
}
|
||||
|
||||
return `\\b${query}\\b`;
|
||||
}
|
||||
|
||||
function buildFlags(caseSensitive, isGlobal) {
|
||||
if (caseSensitive && isGlobal) {
|
||||
return "g";
|
||||
}
|
||||
|
||||
if (!caseSensitive && isGlobal) {
|
||||
return "gi";
|
||||
}
|
||||
|
||||
if (!caseSensitive && !isGlobal) {
|
||||
return "i";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function buildQuery(originalQuery, modifiers, { isGlobal = false, ignoreSpaces = false }) {
|
||||
const { caseSensitive, regexMatch, wholeWord } = modifiers;
|
||||
|
||||
if (originalQuery === "") {
|
||||
return new RegExp(originalQuery);
|
||||
}
|
||||
|
||||
let query = originalQuery;
|
||||
if (ignoreSpaces) {
|
||||
query = ignoreWhiteSpace(query);
|
||||
}
|
||||
|
||||
if (!regexMatch) {
|
||||
query = (0, _escapeRegExp2.default)(query);
|
||||
}
|
||||
|
||||
query = wholeMatch(query, wholeWord);
|
||||
const flags = buildFlags(caseSensitive, isGlobal);
|
||||
|
||||
if (flags) {
|
||||
return new RegExp(query, flags);
|
||||
}
|
||||
|
||||
return new RegExp(query);
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1631:
|
||||
@ -608,7 +320,7 @@ var _getMatches2 = _interopRequireDefault(_getMatches);
|
||||
|
||||
var _projectSearch = __webpack_require__(1633);
|
||||
|
||||
var _devtoolsUtils = __webpack_require__(1363);
|
||||
var _devtoolsUtils = __webpack_require__(3651);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -631,7 +343,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = getMatches;
|
||||
|
||||
var _buildQuery = __webpack_require__(1402);
|
||||
var _buildQuery = __webpack_require__(3761);
|
||||
|
||||
var _buildQuery2 = _interopRequireDefault(_buildQuery);
|
||||
|
||||
@ -744,6 +456,301 @@ function escapeRegExp(string) {
|
||||
module.exports = escapeRegExp;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3651:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
const networkRequest = __webpack_require__(3653);
|
||||
const workerUtils = __webpack_require__(3654);
|
||||
|
||||
module.exports = {
|
||||
networkRequest,
|
||||
workerUtils
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3653:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/* 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/>. */
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
return fetch(url, {
|
||||
cache: opts.loadFromCache ? "default" : "no-cache"
|
||||
}).then(res => {
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
return res.text().then(text => ({ content: text }));
|
||||
}
|
||||
return Promise.reject(`request failed with status ${res.status}`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = networkRequest;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3654:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
function WorkerDispatcher() {
|
||||
this.msgId = 1;
|
||||
this.worker = null;
|
||||
} /* 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/>. */
|
||||
|
||||
WorkerDispatcher.prototype = {
|
||||
start(url) {
|
||||
this.worker = new Worker(url);
|
||||
this.worker.onerror = () => {
|
||||
console.error(`Error in worker ${url}`);
|
||||
};
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
},
|
||||
|
||||
task(method, { queue = false } = {}) {
|
||||
const calls = [];
|
||||
const push = args => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (queue && calls.length === 0) {
|
||||
Promise.resolve().then(flush);
|
||||
}
|
||||
|
||||
calls.push([args, resolve, reject]);
|
||||
|
||||
if (!queue) {
|
||||
flush();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const items = calls.slice();
|
||||
calls.length = 0;
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = this.msgId++;
|
||||
this.worker.postMessage({
|
||||
id,
|
||||
method,
|
||||
calls: items.map(item => item[0])
|
||||
});
|
||||
|
||||
const listener = ({ data: result }) => {
|
||||
if (result.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.removeEventListener("message", listener);
|
||||
|
||||
result.results.forEach((resultData, i) => {
|
||||
const [, resolve, reject] = items[i];
|
||||
|
||||
if (resultData.error) {
|
||||
reject(resultData.error);
|
||||
} else {
|
||||
resolve(resultData.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.worker.addEventListener("message", listener);
|
||||
};
|
||||
|
||||
return (...args) => push(args);
|
||||
}
|
||||
};
|
||||
|
||||
function workerHandler(publicInterface) {
|
||||
return function (msg) {
|
||||
const { id, method, calls } = msg.data;
|
||||
|
||||
Promise.all(calls.map(args => {
|
||||
try {
|
||||
const response = publicInterface[method].apply(undefined, args);
|
||||
if (response instanceof Promise) {
|
||||
return response.then(val => ({ response: val }),
|
||||
// Error can't be sent via postMessage, so be sure to
|
||||
// convert to string.
|
||||
err => ({ error: err.toString() }));
|
||||
}
|
||||
return { response };
|
||||
} catch (error) {
|
||||
// Error can't be sent via postMessage, so be sure to convert to
|
||||
// string.
|
||||
return { error: error.toString() };
|
||||
}
|
||||
})).then(results => {
|
||||
self.postMessage({ id, results });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
|
||||
let streamingWorker = (() => {
|
||||
var _ref = _asyncToGenerator(function* (id, tasks) {
|
||||
let isWorking = true;
|
||||
|
||||
const timeoutId = setTimeout(function () {
|
||||
isWorking = false;
|
||||
}, timeout);
|
||||
|
||||
const results = [];
|
||||
while (tasks.length !== 0 && isWorking) {
|
||||
const { callback, context, args } = tasks.shift();
|
||||
const result = yield callback.call(context, args);
|
||||
results.push(result);
|
||||
}
|
||||
worker.postMessage({ id, status: "pending", data: results });
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (tasks.length !== 0) {
|
||||
yield streamingWorker(id, tasks);
|
||||
}
|
||||
});
|
||||
|
||||
return function streamingWorker(_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
return (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (msg) {
|
||||
const { id, method, args } = msg.data;
|
||||
const workerMethod = publicInterface[method];
|
||||
if (!workerMethod) {
|
||||
console.error(`Could not find ${method} defined in worker.`);
|
||||
}
|
||||
worker.postMessage({ id, status: "start" });
|
||||
|
||||
try {
|
||||
const tasks = workerMethod(args);
|
||||
yield streamingWorker(id, tasks);
|
||||
worker.postMessage({ id, status: "done" });
|
||||
} catch (error) {
|
||||
worker.postMessage({ id, status: "error", error });
|
||||
}
|
||||
});
|
||||
|
||||
return function (_x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
WorkerDispatcher,
|
||||
workerHandler,
|
||||
streamingWorkerHandler
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3761:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = buildQuery;
|
||||
|
||||
var _escapeRegExp = __webpack_require__(259);
|
||||
|
||||
var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Ignore doing outline matches for less than 3 whitespaces
|
||||
*
|
||||
* @memberof utils/source-search
|
||||
* @static
|
||||
*/
|
||||
function ignoreWhiteSpace(str) {
|
||||
return (/^\s{0,2}$/.test(str) ? "(?!\\s*.*)" : str
|
||||
);
|
||||
} /* 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/>. */
|
||||
|
||||
function wholeMatch(query, wholeWord) {
|
||||
if (query === "" || !wholeWord) {
|
||||
return query;
|
||||
}
|
||||
|
||||
return `\\b${query}\\b`;
|
||||
}
|
||||
|
||||
function buildFlags(caseSensitive, isGlobal) {
|
||||
if (caseSensitive && isGlobal) {
|
||||
return "g";
|
||||
}
|
||||
|
||||
if (!caseSensitive && isGlobal) {
|
||||
return "gi";
|
||||
}
|
||||
|
||||
if (!caseSensitive && !isGlobal) {
|
||||
return "i";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function buildQuery(originalQuery, modifiers, { isGlobal = false, ignoreSpaces = false }) {
|
||||
const { caseSensitive, regexMatch, wholeWord } = modifiers;
|
||||
|
||||
if (originalQuery === "") {
|
||||
return new RegExp(originalQuery);
|
||||
}
|
||||
|
||||
let query = originalQuery;
|
||||
if (ignoreSpaces) {
|
||||
query = ignoreWhiteSpace(query);
|
||||
}
|
||||
|
||||
if (!regexMatch) {
|
||||
query = (0, _escapeRegExp2.default)(query);
|
||||
}
|
||||
|
||||
query = wholeMatch(query, wholeWord);
|
||||
const flags = buildFlags(caseSensitive, isGlobal);
|
||||
|
||||
if (flags) {
|
||||
return new RegExp(query, flags);
|
||||
}
|
||||
|
||||
return new RegExp(query);
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6:
|
||||
|
16
devtools/client/debugger/new/dist/vendors.css
vendored
16
devtools/client/debugger/new/dist/vendors.css
vendored
@ -372,6 +372,22 @@ html[dir="rtl"] .tree-node img.arrow {
|
||||
.tree-node.focused img.arrow {
|
||||
background-color: currentColor;
|
||||
}
|
||||
.container {
|
||||
background-color: lightgrey;
|
||||
border: 1px solid darkgrey;
|
||||
cursor: pointer;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
.container[aria-selected=true] {
|
||||
background-color: white;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 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/. */
|
||||
|
886
devtools/client/debugger/new/dist/vendors.js
vendored
886
devtools/client/debugger/new/dist/vendors.js
vendored
@ -876,212 +876,6 @@ exports.default = _Svg2.default;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1363:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
const networkRequest = __webpack_require__(1367);
|
||||
const workerUtils = __webpack_require__(1368);
|
||||
|
||||
module.exports = {
|
||||
networkRequest,
|
||||
workerUtils
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1367:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
return fetch(url, {
|
||||
cache: opts.loadFromCache ? "default" : "no-cache"
|
||||
}).then(res => {
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
return res.text().then(text => ({ content: text }));
|
||||
}
|
||||
return Promise.reject(`request failed with status ${res.status}`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = networkRequest;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1368:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
function WorkerDispatcher() {
|
||||
this.msgId = 1;
|
||||
this.worker = null;
|
||||
} /* 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/. */
|
||||
|
||||
WorkerDispatcher.prototype = {
|
||||
start(url) {
|
||||
this.worker = new Worker(url);
|
||||
this.worker.onerror = () => {
|
||||
console.error(`Error in worker ${url}`);
|
||||
};
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
},
|
||||
|
||||
task(method, { queue = false } = {}) {
|
||||
const calls = [];
|
||||
const push = args => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (queue && calls.length === 0) {
|
||||
Promise.resolve().then(flush);
|
||||
}
|
||||
|
||||
calls.push([args, resolve, reject]);
|
||||
|
||||
if (!queue) {
|
||||
flush();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const items = calls.slice();
|
||||
calls.length = 0;
|
||||
|
||||
const id = this.msgId++;
|
||||
this.worker.postMessage({ id, method, calls: items.map(item => item[0]) });
|
||||
|
||||
const listener = ({ data: result }) => {
|
||||
if (result.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.removeEventListener("message", listener);
|
||||
|
||||
result.results.forEach((resultData, i) => {
|
||||
const [, resolve, reject] = items[i];
|
||||
|
||||
if (resultData.error) {
|
||||
reject(resultData.error);
|
||||
} else {
|
||||
resolve(resultData.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.worker.addEventListener("message", listener);
|
||||
};
|
||||
|
||||
return (...args) => push(args);
|
||||
}
|
||||
};
|
||||
|
||||
function workerHandler(publicInterface) {
|
||||
return function (msg) {
|
||||
const { id, method, calls } = msg.data;
|
||||
|
||||
Promise.all(calls.map(args => {
|
||||
try {
|
||||
const response = publicInterface[method].apply(undefined, args);
|
||||
if (response instanceof Promise) {
|
||||
return response.then(val => ({ response: val }),
|
||||
// Error can't be sent via postMessage, so be sure to
|
||||
// convert to string.
|
||||
err => ({ error: err.toString() }));
|
||||
} else {
|
||||
return { response };
|
||||
}
|
||||
} catch (error) {
|
||||
// Error can't be sent via postMessage, so be sure to convert to
|
||||
// string.
|
||||
return { error: error.toString() };
|
||||
}
|
||||
})).then(results => {
|
||||
self.postMessage({ id, results });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
|
||||
let streamingWorker = (() => {
|
||||
var _ref = _asyncToGenerator(function* (id, tasks) {
|
||||
let isWorking = true;
|
||||
|
||||
const intervalId = setTimeout(function () {
|
||||
isWorking = false;
|
||||
}, timeout);
|
||||
|
||||
const results = [];
|
||||
while (tasks.length !== 0 && isWorking) {
|
||||
const { callback, context, args } = tasks.shift();
|
||||
const result = yield callback.call(context, args);
|
||||
results.push(result);
|
||||
}
|
||||
worker.postMessage({ id, status: "pending", data: results });
|
||||
clearInterval(intervalId);
|
||||
|
||||
if (tasks.length !== 0) {
|
||||
yield streamingWorker(id, tasks);
|
||||
}
|
||||
});
|
||||
|
||||
return function streamingWorker(_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
return (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (msg) {
|
||||
const { id, method, args } = msg.data;
|
||||
const workerMethod = publicInterface[method];
|
||||
if (!workerMethod) {
|
||||
console.error(`Could not find ${method} defined in worker.`);
|
||||
}
|
||||
worker.postMessage({ id, status: "start" });
|
||||
|
||||
try {
|
||||
const tasks = workerMethod(args);
|
||||
yield streamingWorker(id, tasks);
|
||||
worker.postMessage({ id, status: "done" });
|
||||
} catch (error) {
|
||||
worker.postMessage({ id, status: "error", error });
|
||||
}
|
||||
});
|
||||
|
||||
return function (_x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
WorkerDispatcher,
|
||||
workerHandler,
|
||||
streamingWorkerHandler
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1376:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
@ -7370,6 +7164,219 @@ module.exports = "<!-- This Source Code Form is subject to the terms of the Mozi
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3651:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* 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/. */
|
||||
|
||||
const networkRequest = __webpack_require__(3653);
|
||||
const workerUtils = __webpack_require__(3654);
|
||||
|
||||
module.exports = {
|
||||
networkRequest,
|
||||
workerUtils
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3653:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/* 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/>. */
|
||||
|
||||
function networkRequest(url, opts) {
|
||||
return fetch(url, {
|
||||
cache: opts.loadFromCache ? "default" : "no-cache"
|
||||
}).then(res => {
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
return res.text().then(text => ({ content: text }));
|
||||
}
|
||||
return Promise.reject(`request failed with status ${res.status}`);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = networkRequest;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3654:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
function WorkerDispatcher() {
|
||||
this.msgId = 1;
|
||||
this.worker = null;
|
||||
} /* 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/>. */
|
||||
|
||||
WorkerDispatcher.prototype = {
|
||||
start(url) {
|
||||
this.worker = new Worker(url);
|
||||
this.worker.onerror = () => {
|
||||
console.error(`Error in worker ${url}`);
|
||||
};
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
},
|
||||
|
||||
task(method, { queue = false } = {}) {
|
||||
const calls = [];
|
||||
const push = args => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (queue && calls.length === 0) {
|
||||
Promise.resolve().then(flush);
|
||||
}
|
||||
|
||||
calls.push([args, resolve, reject]);
|
||||
|
||||
if (!queue) {
|
||||
flush();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const flush = () => {
|
||||
const items = calls.slice();
|
||||
calls.length = 0;
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = this.msgId++;
|
||||
this.worker.postMessage({
|
||||
id,
|
||||
method,
|
||||
calls: items.map(item => item[0])
|
||||
});
|
||||
|
||||
const listener = ({ data: result }) => {
|
||||
if (result.id !== id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.worker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.worker.removeEventListener("message", listener);
|
||||
|
||||
result.results.forEach((resultData, i) => {
|
||||
const [, resolve, reject] = items[i];
|
||||
|
||||
if (resultData.error) {
|
||||
reject(resultData.error);
|
||||
} else {
|
||||
resolve(resultData.response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.worker.addEventListener("message", listener);
|
||||
};
|
||||
|
||||
return (...args) => push(args);
|
||||
}
|
||||
};
|
||||
|
||||
function workerHandler(publicInterface) {
|
||||
return function (msg) {
|
||||
const { id, method, calls } = msg.data;
|
||||
|
||||
Promise.all(calls.map(args => {
|
||||
try {
|
||||
const response = publicInterface[method].apply(undefined, args);
|
||||
if (response instanceof Promise) {
|
||||
return response.then(val => ({ response: val }),
|
||||
// Error can't be sent via postMessage, so be sure to
|
||||
// convert to string.
|
||||
err => ({ error: err.toString() }));
|
||||
}
|
||||
return { response };
|
||||
} catch (error) {
|
||||
// Error can't be sent via postMessage, so be sure to convert to
|
||||
// string.
|
||||
return { error: error.toString() };
|
||||
}
|
||||
})).then(results => {
|
||||
self.postMessage({ id, results });
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
|
||||
let streamingWorker = (() => {
|
||||
var _ref = _asyncToGenerator(function* (id, tasks) {
|
||||
let isWorking = true;
|
||||
|
||||
const timeoutId = setTimeout(function () {
|
||||
isWorking = false;
|
||||
}, timeout);
|
||||
|
||||
const results = [];
|
||||
while (tasks.length !== 0 && isWorking) {
|
||||
const { callback, context, args } = tasks.shift();
|
||||
const result = yield callback.call(context, args);
|
||||
results.push(result);
|
||||
}
|
||||
worker.postMessage({ id, status: "pending", data: results });
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (tasks.length !== 0) {
|
||||
yield streamingWorker(id, tasks);
|
||||
}
|
||||
});
|
||||
|
||||
return function streamingWorker(_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
||||
return (() => {
|
||||
var _ref2 = _asyncToGenerator(function* (msg) {
|
||||
const { id, method, args } = msg.data;
|
||||
const workerMethod = publicInterface[method];
|
||||
if (!workerMethod) {
|
||||
console.error(`Could not find ${method} defined in worker.`);
|
||||
}
|
||||
worker.postMessage({ id, status: "start" });
|
||||
|
||||
try {
|
||||
const tasks = workerMethod(args);
|
||||
yield streamingWorker(id, tasks);
|
||||
worker.postMessage({ id, status: "done" });
|
||||
} catch (error) {
|
||||
worker.postMessage({ id, status: "error", error });
|
||||
}
|
||||
});
|
||||
|
||||
return function (_x3) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
WorkerDispatcher,
|
||||
workerHandler,
|
||||
streamingWorkerHandler
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 366:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
@ -8364,7 +8371,7 @@ var _devtoolsModules = __webpack_require__(1376);
|
||||
|
||||
var devtoolsModules = _interopRequireWildcard(_devtoolsModules);
|
||||
|
||||
var _devtoolsUtils = __webpack_require__(1363);
|
||||
var _devtoolsUtils = __webpack_require__(3651);
|
||||
|
||||
var devtoolsUtils = _interopRequireWildcard(_devtoolsUtils);
|
||||
|
||||
@ -8376,6 +8383,10 @@ var _Transition = __webpack_require__(333);
|
||||
|
||||
var transition = _interopRequireWildcard(_Transition);
|
||||
|
||||
var _tabs = __webpack_require__(3762);
|
||||
|
||||
var reactAriaComponentsTabs = _interopRequireWildcard(_tabs);
|
||||
|
||||
var _reselect = __webpack_require__(993);
|
||||
|
||||
var reselect = _interopRequireWildcard(_reselect);
|
||||
@ -8411,9 +8422,27 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
||||
|
||||
|
||||
// Modules imported without destructuring
|
||||
/* 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/>. */
|
||||
const vendored = exports.vendored = {
|
||||
classnames: _classnames2.default,
|
||||
"devtools-components": devtoolsComponents,
|
||||
"devtools-config": devtoolsConfig,
|
||||
"devtools-contextmenu": devtoolsContextmenu,
|
||||
"devtools-environment": devtoolsEnvironment,
|
||||
"devtools-modules": devtoolsModules,
|
||||
"devtools-splitter": _devtoolsSplitter2.default,
|
||||
"devtools-utils": devtoolsUtils,
|
||||
"fuzzaldrin-plus": fuzzaldrinPlus,
|
||||
"lodash-move": _lodashMove2.default,
|
||||
"react-aria-components/src/tabs": reactAriaComponentsTabs,
|
||||
"react-transition-group/Transition": transition,
|
||||
reselect,
|
||||
// Svg is required via relative paths, so the key is not imported path.
|
||||
// See .babel/transform-mc.js
|
||||
Svg: _Svg2.default,
|
||||
url
|
||||
}; /* 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/>. */
|
||||
|
||||
/**
|
||||
* Vendors.js is a file used to bundle and expose all dependencies needed to run
|
||||
@ -8428,24 +8457,6 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
||||
*/
|
||||
|
||||
// Modules imported with destructuring
|
||||
const vendored = exports.vendored = {
|
||||
classnames: _classnames2.default,
|
||||
"devtools-components": devtoolsComponents,
|
||||
"devtools-config": devtoolsConfig,
|
||||
"devtools-contextmenu": devtoolsContextmenu,
|
||||
"devtools-environment": devtoolsEnvironment,
|
||||
"devtools-modules": devtoolsModules,
|
||||
"devtools-splitter": _devtoolsSplitter2.default,
|
||||
"devtools-utils": devtoolsUtils,
|
||||
"fuzzaldrin-plus": fuzzaldrinPlus,
|
||||
"lodash-move": _lodashMove2.default,
|
||||
"react-transition-group/Transition": transition,
|
||||
reselect,
|
||||
// Svg is required via relative paths, so the key is not imported path.
|
||||
// See .babel/transform-mc.js
|
||||
Svg: _Svg2.default,
|
||||
url
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -9257,6 +9268,425 @@ module.exports = {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3758:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _propTypes = __webpack_require__(3642);
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _react = __webpack_require__(0);
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _tab = __webpack_require__(3759);
|
||||
|
||||
var _tab2 = _interopRequireDefault(_tab);
|
||||
|
||||
var _tabList = __webpack_require__(3764);
|
||||
|
||||
var _tabList2 = _interopRequireDefault(_tabList);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class TabList extends _react2.default.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleKeyPress = this.handleKeyPress.bind(this);
|
||||
this.tabRefs = new Array(_react2.default.Children.count(props.children)).fill(0).map(_ => _react2.default.createRef());
|
||||
this.handlers = this.getHandlers(props.vertical);
|
||||
}
|
||||
|
||||
getHandlers(vertical) {
|
||||
if (vertical) {
|
||||
return {
|
||||
ArrowDown: this.next.bind(this),
|
||||
ArrowUp: this.previous.bind(this)
|
||||
};
|
||||
}
|
||||
return {
|
||||
ArrowLeft: this.previous.bind(this),
|
||||
ArrowRight: this.next.bind(this)
|
||||
};
|
||||
}
|
||||
|
||||
wrapIndex(index) {
|
||||
const count = _react2.default.Children.count(this.props.children);
|
||||
return (index + count) % count;
|
||||
}
|
||||
|
||||
handleKeyPress(event) {
|
||||
const handler = this.handlers[event.key];
|
||||
if (handler) {
|
||||
handler();
|
||||
}
|
||||
}
|
||||
|
||||
previous() {
|
||||
const newIndex = this.wrapIndex(this.props.activeIndex - 1);
|
||||
this.props.onActivateTab(newIndex);
|
||||
}
|
||||
|
||||
next() {
|
||||
const newIndex = this.wrapIndex(this.props.activeIndex + 1);
|
||||
this.props.onActivateTab(newIndex);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (prevProps.activeIndex !== this.props.activeIndex) {
|
||||
this.tabRefs[this.props.activeIndex].current.focus();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
var _props = this.props;
|
||||
const accessibleId = _props.accessibleId,
|
||||
activeIndex = _props.activeIndex,
|
||||
children = _props.children,
|
||||
className = _props.className,
|
||||
onActivateTab = _props.onActivateTab;
|
||||
|
||||
|
||||
return _react2.default.createElement(
|
||||
'ul',
|
||||
{ className: className, onKeyUp: this.handleKeyPress, role: 'tablist' },
|
||||
_react2.default.Children.map(children, (child, index) => {
|
||||
if (child.type !== _tab2.default) {
|
||||
throw new Error('Direct children of a <TabList> must be a <Tab>');
|
||||
}
|
||||
|
||||
const active = index === activeIndex;
|
||||
const tabRef = this.tabRefs[index];
|
||||
|
||||
return _react2.default.cloneElement(child, {
|
||||
accessibleId: active ? accessibleId : undefined,
|
||||
active,
|
||||
tabRef,
|
||||
onActivate: () => this.props.onActivateTab(index)
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = TabList;
|
||||
TabList.propTypes = {
|
||||
accessibleId: _propTypes2.default.string,
|
||||
activeIndex: _propTypes2.default.number,
|
||||
children: _propTypes2.default.node,
|
||||
className: _propTypes2.default.string,
|
||||
onActivateTab: _propTypes2.default.func,
|
||||
vertical: _propTypes2.default.bool
|
||||
};
|
||||
|
||||
TabList.defaultProps = {
|
||||
accessibleId: undefined,
|
||||
activeIndex: 0,
|
||||
children: null,
|
||||
className: _tabList2.default.container,
|
||||
onActivateTab: () => {},
|
||||
vertical: false
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3759:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = Tab;
|
||||
|
||||
var _propTypes = __webpack_require__(3642);
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _react = __webpack_require__(0);
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _tab = __webpack_require__(3763);
|
||||
|
||||
var _tab2 = _interopRequireDefault(_tab);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function Tab({
|
||||
accessibleId,
|
||||
active,
|
||||
children,
|
||||
className,
|
||||
onActivate,
|
||||
tabRef
|
||||
}) {
|
||||
return _react2.default.createElement(
|
||||
'li',
|
||||
{
|
||||
'aria-selected': active,
|
||||
className: className,
|
||||
id: accessibleId,
|
||||
onClick: onActivate,
|
||||
ref: tabRef,
|
||||
role: 'tab',
|
||||
tabIndex: active ? 0 : undefined
|
||||
},
|
||||
children
|
||||
);
|
||||
}
|
||||
|
||||
Tab.propTypes = {
|
||||
accessibleId: _propTypes2.default.string,
|
||||
active: _propTypes2.default.bool,
|
||||
children: _propTypes2.default.node,
|
||||
className: _propTypes2.default.string,
|
||||
onActivate: _propTypes2.default.func,
|
||||
tabRef: _propTypes2.default.object
|
||||
};
|
||||
|
||||
Tab.defaultProps = {
|
||||
accessibleId: undefined,
|
||||
active: false,
|
||||
className: _tab2.default.container,
|
||||
onActivate: undefined,
|
||||
tabRef: undefined
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3760:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = TabPanels;
|
||||
|
||||
var _propTypes = __webpack_require__(3642);
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _react = __webpack_require__(0);
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function TabPanels({
|
||||
accessibleId,
|
||||
activeIndex,
|
||||
children,
|
||||
className,
|
||||
hasFocusableContent
|
||||
}) {
|
||||
return _react2.default.createElement(
|
||||
'div',
|
||||
{
|
||||
'aria-labelledby': accessibleId,
|
||||
role: 'tabpanel',
|
||||
className: className,
|
||||
tabIndex: hasFocusableContent ? undefined : 0
|
||||
},
|
||||
_react2.default.Children.toArray(children)[activeIndex]
|
||||
);
|
||||
}
|
||||
|
||||
TabPanels.propTypes = {
|
||||
accessibleId: _propTypes2.default.string,
|
||||
activeIndex: _propTypes2.default.number,
|
||||
children: _propTypes2.default.node,
|
||||
className: _propTypes2.default.string,
|
||||
hasFocusableContent: _propTypes2.default.bool.isRequired
|
||||
};
|
||||
|
||||
TabPanels.defaultProps = {
|
||||
accessibleId: undefined,
|
||||
activeIndex: 0,
|
||||
className: null
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3762:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _tabList = __webpack_require__(3758);
|
||||
|
||||
Object.defineProperty(exports, 'TabList', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_tabList).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _tabPanels = __webpack_require__(3760);
|
||||
|
||||
Object.defineProperty(exports, 'TabPanels', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_tabPanels).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _tab = __webpack_require__(3759);
|
||||
|
||||
Object.defineProperty(exports, 'Tab', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_tab).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _tabs = __webpack_require__(3765);
|
||||
|
||||
Object.defineProperty(exports, 'Tabs', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_tabs).default;
|
||||
}
|
||||
});
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3763:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// removed by extract-text-webpack-plugin
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3764:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// removed by extract-text-webpack-plugin
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3765:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _propTypes = __webpack_require__(3642);
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _react = __webpack_require__(0);
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _uniqueId = __webpack_require__(3766);
|
||||
|
||||
var _uniqueId2 = _interopRequireDefault(_uniqueId);
|
||||
|
||||
var _tabList = __webpack_require__(3758);
|
||||
|
||||
var _tabList2 = _interopRequireDefault(_tabList);
|
||||
|
||||
var _tabPanels = __webpack_require__(3760);
|
||||
|
||||
var _tabPanels2 = _interopRequireDefault(_tabPanels);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class Tabs extends _react2.default.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.accessibleId = (0, _uniqueId2.default)();
|
||||
}
|
||||
|
||||
render() {
|
||||
var _props = this.props;
|
||||
const activeIndex = _props.activeIndex,
|
||||
children = _props.children,
|
||||
className = _props.className,
|
||||
onActivateTab = _props.onActivateTab;
|
||||
|
||||
const accessibleId = this.accessibleId;
|
||||
|
||||
return _react2.default.createElement(
|
||||
'div',
|
||||
{ className: className },
|
||||
_react2.default.Children.map(children, child => {
|
||||
if (!child) {
|
||||
return child;
|
||||
}
|
||||
|
||||
switch (child.type) {
|
||||
case _tabList2.default:
|
||||
return _react2.default.cloneElement(child, { accessibleId, activeIndex, onActivateTab });
|
||||
case _tabPanels2.default:
|
||||
return _react2.default.cloneElement(child, { accessibleId, activeIndex });
|
||||
default:
|
||||
return child;
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = Tabs;
|
||||
Tabs.propTypes = {
|
||||
activeIndex: _propTypes2.default.number.isRequired,
|
||||
children: _propTypes2.default.node,
|
||||
className: _propTypes2.default.string,
|
||||
onActivateTab: _propTypes2.default.func
|
||||
};
|
||||
|
||||
Tabs.defaultProps = {
|
||||
children: null,
|
||||
className: undefined,
|
||||
onActivateTab: () => {}
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3766:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = uniqueId;
|
||||
let counter = 0;
|
||||
|
||||
function uniqueId() {
|
||||
counter++;
|
||||
return `$rac$${counter}`;
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
|
@ -3,10 +3,14 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = addBreakpoint;
|
||||
exports.addHiddenBreakpoint = addHiddenBreakpoint;
|
||||
exports.enableBreakpoint = enableBreakpoint;
|
||||
exports.addBreakpoint = addBreakpoint;
|
||||
|
||||
var _breakpoint = require("../../utils/breakpoint/index");
|
||||
|
||||
var _promise = require("../utils/middleware/promise");
|
||||
|
||||
var _selectors = require("../../selectors/index");
|
||||
|
||||
var _sourceMaps = require("../../utils/source-maps");
|
||||
@ -16,7 +20,7 @@ var _source = require("../../utils/source");
|
||||
/* 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/>. */
|
||||
async function addBreakpoint(getState, client, sourceMaps, breakpoint) {
|
||||
async function addBreakpointPromise(getState, client, sourceMaps, breakpoint) {
|
||||
const state = getState();
|
||||
const source = (0, _selectors.getSource)(state, breakpoint.location.sourceId);
|
||||
const location = { ...breakpoint.location,
|
||||
@ -68,4 +72,87 @@ async function addBreakpoint(getState, client, sourceMaps, breakpoint) {
|
||||
breakpoint: newBreakpoint,
|
||||
previousLocation
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Add a new hidden breakpoint
|
||||
*
|
||||
* @memberOf actions/breakpoints
|
||||
* @param location
|
||||
* @return {function(ThunkArgs)}
|
||||
*/
|
||||
|
||||
|
||||
function addHiddenBreakpoint(location) {
|
||||
return ({
|
||||
dispatch
|
||||
}) => {
|
||||
return dispatch(addBreakpoint(location, {
|
||||
hidden: true
|
||||
}));
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Enabling a breakpoint
|
||||
* will reuse the existing breakpoint information that is stored.
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
* @param {Location} $1.location Location value
|
||||
*/
|
||||
|
||||
|
||||
function enableBreakpoint(location) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const breakpoint = (0, _selectors.getBreakpoint)(getState(), location);
|
||||
|
||||
if (!breakpoint || breakpoint.loading) {
|
||||
return;
|
||||
} // To instantly reflect in the UI, we optimistically enable the breakpoint
|
||||
|
||||
|
||||
const enabledBreakpoint = { ...breakpoint,
|
||||
disabled: false
|
||||
};
|
||||
return dispatch({
|
||||
type: "ENABLE_BREAKPOINT",
|
||||
breakpoint: enabledBreakpoint,
|
||||
[_promise.PROMISE]: addBreakpointPromise(getState, client, sourceMaps, breakpoint)
|
||||
});
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Add a new breakpoint
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
* @param {String} $1.condition Conditional breakpoint condition value
|
||||
* @param {Boolean} $1.disabled Disable value for breakpoint value
|
||||
*/
|
||||
|
||||
|
||||
function addBreakpoint(location, {
|
||||
condition,
|
||||
hidden
|
||||
} = {}) {
|
||||
const breakpoint = (0, _breakpoint.createBreakpoint)(location, {
|
||||
condition,
|
||||
hidden
|
||||
});
|
||||
return ({
|
||||
dispatch,
|
||||
getState,
|
||||
sourceMaps,
|
||||
client
|
||||
}) => {
|
||||
return dispatch({
|
||||
type: "ADD_BREAKPOINT",
|
||||
breakpoint,
|
||||
[_promise.PROMISE]: addBreakpointPromise(getState, client, sourceMaps, breakpoint)
|
||||
});
|
||||
};
|
||||
}
|
415
devtools/client/debugger/new/src/actions/breakpoints/index.js
Normal file
415
devtools/client/debugger/new/src/actions/breakpoints/index.js
Normal file
@ -0,0 +1,415 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.syncBreakpoint = exports.enableBreakpoint = exports.addHiddenBreakpoint = exports.addBreakpoint = undefined;
|
||||
exports.removeBreakpoint = removeBreakpoint;
|
||||
exports.disableBreakpoint = disableBreakpoint;
|
||||
exports.toggleAllBreakpoints = toggleAllBreakpoints;
|
||||
exports.toggleBreakpoints = toggleBreakpoints;
|
||||
exports.removeAllBreakpoints = removeAllBreakpoints;
|
||||
exports.removeBreakpoints = removeBreakpoints;
|
||||
exports.remapBreakpoints = remapBreakpoints;
|
||||
exports.setBreakpointCondition = setBreakpointCondition;
|
||||
exports.toggleBreakpoint = toggleBreakpoint;
|
||||
exports.toggleBreakpointsAtLine = toggleBreakpointsAtLine;
|
||||
exports.addOrToggleDisabledBreakpoint = addOrToggleDisabledBreakpoint;
|
||||
exports.toggleDisabledBreakpoint = toggleDisabledBreakpoint;
|
||||
|
||||
var _promise = require("../utils/middleware/promise");
|
||||
|
||||
var _selectors = require("../../selectors/index");
|
||||
|
||||
var _breakpoint = require("../../utils/breakpoint/index");
|
||||
|
||||
var _addBreakpoint = require("./addBreakpoint");
|
||||
|
||||
var _remapLocations = require("./remapLocations");
|
||||
|
||||
var _remapLocations2 = _interopRequireDefault(_remapLocations);
|
||||
|
||||
var _syncBreakpoint = require("./syncBreakpoint");
|
||||
|
||||
var _ast = require("../../reducers/ast");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/* 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/>. */
|
||||
|
||||
/**
|
||||
* Redux actions for breakpoints
|
||||
* @module actions/breakpoints
|
||||
*/
|
||||
|
||||
/**
|
||||
* Remove a single breakpoint
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
*/
|
||||
function removeBreakpoint(location) {
|
||||
return ({
|
||||
dispatch,
|
||||
getState,
|
||||
client
|
||||
}) => {
|
||||
const bp = (0, _selectors.getBreakpoint)(getState(), location);
|
||||
|
||||
if (!bp || bp.loading) {
|
||||
return;
|
||||
} // If the breakpoint is already disabled, we don't need to communicate
|
||||
// with the server. We just need to dispatch an action
|
||||
// simulating a successful server request
|
||||
|
||||
|
||||
if (bp.disabled) {
|
||||
return dispatch({
|
||||
type: "REMOVE_BREAKPOINT",
|
||||
breakpoint: bp,
|
||||
status: "done"
|
||||
});
|
||||
}
|
||||
|
||||
return dispatch({
|
||||
type: "REMOVE_BREAKPOINT",
|
||||
breakpoint: bp,
|
||||
disabled: false,
|
||||
[_promise.PROMISE]: client.removeBreakpoint(bp.generatedLocation)
|
||||
});
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Disable a single breakpoint
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
*/
|
||||
|
||||
|
||||
function disableBreakpoint(location) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
client
|
||||
}) => {
|
||||
const bp = (0, _selectors.getBreakpoint)(getState(), location);
|
||||
|
||||
if (!bp || bp.loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
await client.removeBreakpoint(bp.generatedLocation);
|
||||
const newBreakpoint = { ...bp,
|
||||
disabled: true
|
||||
};
|
||||
return dispatch({
|
||||
type: "DISABLE_BREAKPOINT",
|
||||
breakpoint: newBreakpoint
|
||||
});
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Toggle All Breakpoints
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
*/
|
||||
|
||||
|
||||
function toggleAllBreakpoints(shouldDisableBreakpoints) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
client
|
||||
}) => {
|
||||
const breakpoints = (0, _selectors.getBreakpoints)(getState());
|
||||
const modifiedBreakpoints = [];
|
||||
|
||||
for (const [, breakpoint] of breakpoints) {
|
||||
if (shouldDisableBreakpoints) {
|
||||
await client.removeBreakpoint(breakpoint.generatedLocation);
|
||||
const newBreakpoint = { ...breakpoint,
|
||||
disabled: true
|
||||
};
|
||||
modifiedBreakpoints.push(newBreakpoint);
|
||||
} else {
|
||||
const newBreakpoint = { ...breakpoint,
|
||||
disabled: false
|
||||
};
|
||||
modifiedBreakpoints.push(newBreakpoint);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldDisableBreakpoints) {
|
||||
return dispatch({
|
||||
type: "DISABLE_ALL_BREAKPOINTS",
|
||||
breakpoints: modifiedBreakpoints
|
||||
});
|
||||
}
|
||||
|
||||
return dispatch({
|
||||
type: "ENABLE_ALL_BREAKPOINTS",
|
||||
breakpoints: modifiedBreakpoints
|
||||
});
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Toggle Breakpoints
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
*/
|
||||
|
||||
|
||||
function toggleBreakpoints(shouldDisableBreakpoints, breakpoints) {
|
||||
return async ({
|
||||
dispatch
|
||||
}) => {
|
||||
const promises = breakpoints.valueSeq().toJS().map(([, breakpoint]) => shouldDisableBreakpoints ? dispatch(disableBreakpoint(breakpoint.location)) : dispatch((0, _addBreakpoint.enableBreakpoint)(breakpoint.location)));
|
||||
await Promise.all(promises);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Removes all breakpoints
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
*/
|
||||
|
||||
|
||||
function removeAllBreakpoints() {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState
|
||||
}) => {
|
||||
const breakpointList = (0, _selectors.getBreakpoints)(getState()).valueSeq().toJS();
|
||||
return Promise.all(breakpointList.map(bp => dispatch(removeBreakpoint(bp.location))));
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Removes breakpoints
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
*/
|
||||
|
||||
|
||||
function removeBreakpoints(breakpoints) {
|
||||
return async ({
|
||||
dispatch
|
||||
}) => {
|
||||
const breakpointList = breakpoints.valueSeq().toJS();
|
||||
return Promise.all(breakpointList.map(bp => dispatch(removeBreakpoint(bp.location))));
|
||||
};
|
||||
}
|
||||
|
||||
function remapBreakpoints(sourceId) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const breakpoints = (0, _selectors.getBreakpoints)(getState());
|
||||
const newBreakpoints = await (0, _remapLocations2.default)(breakpoints, sourceId, sourceMaps);
|
||||
return dispatch({
|
||||
type: "REMAP_BREAKPOINTS",
|
||||
breakpoints: newBreakpoints
|
||||
});
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Update the condition of a breakpoint.
|
||||
*
|
||||
* @throws {Error} "not implemented"
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
* @param {Location} location
|
||||
* @see DebuggerController.Breakpoints.addBreakpoint
|
||||
* @param {string} condition
|
||||
* The condition to set on the breakpoint
|
||||
* @param {Boolean} $1.disabled Disable value for breakpoint value
|
||||
*/
|
||||
|
||||
|
||||
function setBreakpointCondition(location, {
|
||||
condition
|
||||
} = {}) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const bp = (0, _selectors.getBreakpoint)(getState(), location);
|
||||
|
||||
if (!bp) {
|
||||
return dispatch((0, _addBreakpoint.addBreakpoint)(location, {
|
||||
condition
|
||||
}));
|
||||
}
|
||||
|
||||
if (bp.loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bp.disabled) {
|
||||
await dispatch((0, _addBreakpoint.enableBreakpoint)(location));
|
||||
bp.disabled = !bp.disabled;
|
||||
}
|
||||
|
||||
await client.setBreakpointCondition(bp.id, location, condition, sourceMaps.isOriginalId(bp.location.sourceId));
|
||||
const newBreakpoint = { ...bp,
|
||||
condition
|
||||
};
|
||||
(0, _breakpoint.assertBreakpoint)(newBreakpoint);
|
||||
return dispatch({
|
||||
type: "SET_BREAKPOINT_CONDITION",
|
||||
breakpoint: newBreakpoint
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function toggleBreakpoint(line, column) {
|
||||
return ({
|
||||
dispatch,
|
||||
getState,
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const state = getState();
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(state);
|
||||
|
||||
if (!line || !selectedSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bp = (0, _selectors.getBreakpointAtLocation)(state, {
|
||||
line,
|
||||
column
|
||||
});
|
||||
const isEmptyLine = (0, _ast.isEmptyLineInSource)(state, line, selectedSource.id);
|
||||
|
||||
if (!bp && isEmptyLine || bp && bp.loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bp) {
|
||||
// NOTE: it's possible the breakpoint has slid to a column
|
||||
return dispatch(removeBreakpoint({
|
||||
sourceId: bp.location.sourceId,
|
||||
sourceUrl: bp.location.sourceUrl,
|
||||
line: bp.location.line,
|
||||
column: column || bp.location.column
|
||||
}));
|
||||
}
|
||||
|
||||
return dispatch((0, _addBreakpoint.addBreakpoint)({
|
||||
sourceId: selectedSource.id,
|
||||
sourceUrl: selectedSource.url,
|
||||
line: line,
|
||||
column: column
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
function toggleBreakpointsAtLine(line, column) {
|
||||
return ({
|
||||
dispatch,
|
||||
getState,
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const state = getState();
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(state);
|
||||
|
||||
if (!line || !selectedSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bps = (0, _selectors.getBreakpointsAtLine)(state, line);
|
||||
const isEmptyLine = (0, _ast.isEmptyLineInSource)(state, line, selectedSource.id);
|
||||
|
||||
if (isEmptyLine) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bps.size === 0) {
|
||||
return dispatch((0, _addBreakpoint.addBreakpoint)({
|
||||
sourceId: selectedSource.id,
|
||||
sourceUrl: selectedSource.url,
|
||||
line,
|
||||
column
|
||||
}));
|
||||
}
|
||||
|
||||
return Promise.all(bps.map(bp => dispatch(removeBreakpoint(bp.location))));
|
||||
};
|
||||
}
|
||||
|
||||
function addOrToggleDisabledBreakpoint(line, column) {
|
||||
return ({
|
||||
dispatch,
|
||||
getState,
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(getState());
|
||||
|
||||
if (!line || !selectedSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bp = (0, _selectors.getBreakpointAtLocation)(getState(), {
|
||||
line,
|
||||
column
|
||||
});
|
||||
|
||||
if (bp && bp.loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bp) {
|
||||
// NOTE: it's possible the breakpoint has slid to a column
|
||||
return dispatch(toggleDisabledBreakpoint(line, column || bp.location.column));
|
||||
}
|
||||
|
||||
return dispatch((0, _addBreakpoint.addBreakpoint)({
|
||||
sourceId: selectedSource.id,
|
||||
sourceUrl: selectedSource.url,
|
||||
line: line,
|
||||
column: column
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
function toggleDisabledBreakpoint(line, column) {
|
||||
return ({
|
||||
dispatch,
|
||||
getState,
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const bp = (0, _selectors.getBreakpointAtLocation)(getState(), {
|
||||
line,
|
||||
column
|
||||
});
|
||||
|
||||
if (!bp || bp.loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bp.disabled) {
|
||||
return dispatch(disableBreakpoint(bp.location));
|
||||
}
|
||||
|
||||
return dispatch((0, _addBreakpoint.enableBreakpoint)(bp.location));
|
||||
};
|
||||
}
|
||||
|
||||
exports.addBreakpoint = _addBreakpoint.addBreakpoint;
|
||||
exports.addHiddenBreakpoint = _addBreakpoint.addHiddenBreakpoint;
|
||||
exports.enableBreakpoint = _addBreakpoint.enableBreakpoint;
|
||||
exports.syncBreakpoint = _syncBreakpoint.syncBreakpoint;
|
@ -9,6 +9,7 @@ DIRS += [
|
||||
|
||||
DevToolsModules(
|
||||
'addBreakpoint.js',
|
||||
'index.js',
|
||||
'remapLocations.js',
|
||||
'syncBreakpoint.js',
|
||||
)
|
||||
|
@ -3,7 +3,8 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.syncClientBreakpoint = syncClientBreakpoint;
|
||||
exports.syncBreakpointPromise = syncBreakpointPromise;
|
||||
exports.syncBreakpoint = syncBreakpoint;
|
||||
|
||||
var _breakpoint = require("../../utils/breakpoint/index");
|
||||
|
||||
@ -52,7 +53,7 @@ function createSyncData(id, pendingBreakpoint, location, generatedLocation, prev
|
||||
// and adding a new breakpoint
|
||||
|
||||
|
||||
async function syncClientBreakpoint(getState, client, sourceMaps, sourceId, pendingBreakpoint) {
|
||||
async function syncBreakpointPromise(getState, client, sourceMaps, sourceId, pendingBreakpoint) {
|
||||
(0, _breakpoint.assertPendingBreakpoint)(pendingBreakpoint);
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const generatedSourceId = sourceMaps.isOriginalId(sourceId) ? (0, _devtoolsSourceMap.originalToGeneratedId)(sourceId) : sourceId;
|
||||
@ -116,4 +117,39 @@ async function syncClientBreakpoint(getState, client, sourceMaps, sourceId, pend
|
||||
const originalText = (0, _source.getTextAtPosition)(source, newLocation);
|
||||
const text = (0, _source.getTextAtPosition)(generatedSource, newGeneratedLocation);
|
||||
return createSyncData(id, pendingBreakpoint, newLocation, newGeneratedLocation, previousLocation, text, originalText);
|
||||
}
|
||||
/**
|
||||
* Syncing a breakpoint add breakpoint information that is stored, and
|
||||
* contact the server for more data.
|
||||
*
|
||||
* @memberof actions/breakpoints
|
||||
* @static
|
||||
* @param {String} $1.sourceId String value
|
||||
* @param {PendingBreakpoint} $1.location PendingBreakpoint value
|
||||
*/
|
||||
|
||||
|
||||
function syncBreakpoint(sourceId, pendingBreakpoint) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const response = await syncBreakpointPromise(getState, client, sourceMaps, sourceId, pendingBreakpoint);
|
||||
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
breakpoint,
|
||||
previousLocation
|
||||
} = response;
|
||||
return dispatch({
|
||||
type: "SYNC_BREAKPOINT",
|
||||
breakpoint,
|
||||
previousLocation
|
||||
});
|
||||
};
|
||||
}
|
@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _breakpoints = require("./breakpoints");
|
||||
var _breakpoints = require("./breakpoints/index");
|
||||
|
||||
var breakpoints = _interopRequireWildcard(_breakpoints);
|
||||
|
||||
|
@ -13,7 +13,6 @@ DIRS += [
|
||||
|
||||
DevToolsModules(
|
||||
'ast.js',
|
||||
'breakpoints.js',
|
||||
'coverage.js',
|
||||
'debuggee.js',
|
||||
'event-listeners.js',
|
||||
|
@ -20,7 +20,7 @@ var _promise = require("../utils/middleware/promise");
|
||||
|
||||
var _parser = require("../../workers/parser/index");
|
||||
|
||||
var _breakpoints = require("../breakpoints");
|
||||
var _breakpoints = require("../breakpoints/index");
|
||||
|
||||
var _prefs = require("../../utils/prefs");
|
||||
|
||||
|
@ -7,7 +7,7 @@ exports.continueToHere = continueToHere;
|
||||
|
||||
var _selectors = require("../../selectors/index");
|
||||
|
||||
var _breakpoints = require("../breakpoints");
|
||||
var _breakpoints = require("../breakpoints/index");
|
||||
|
||||
var _commands = require("./commands");
|
||||
|
||||
|
@ -11,7 +11,7 @@ var _selectors = require("../../selectors/index");
|
||||
|
||||
var _ = require("./index");
|
||||
|
||||
var _breakpoints = require("../breakpoints");
|
||||
var _breakpoints = require("../breakpoints/index");
|
||||
|
||||
var _expressions = require("../expressions");
|
||||
|
||||
@ -56,7 +56,7 @@ function paused(pauseInfo) {
|
||||
why,
|
||||
loadedObjects
|
||||
} = pauseInfo;
|
||||
const topFrame = frames.length > 0 ? frames[0] : null;
|
||||
const topFrame = frames.length > 0 ? frames[0] : null; // NOTE: do not step when leaving a frame or paused at a debugger statement
|
||||
|
||||
if (topFrame && !why.frameFinished && why.type == "resumeLimit") {
|
||||
const mappedFrame = await (0, _mapFrames.updateFrameLocation)(topFrame, sourceMaps);
|
||||
|
@ -12,7 +12,7 @@ var _lodash = require("devtools/client/shared/vendor/lodash");
|
||||
|
||||
var _blackbox = require("./blackbox");
|
||||
|
||||
var _breakpoints = require("../breakpoints");
|
||||
var _breakpoints = require("../breakpoints/index");
|
||||
|
||||
var _loadSourceText = require("./loadSourceText");
|
||||
|
||||
|
@ -10,7 +10,7 @@ var _assert = require("../../utils/assert");
|
||||
|
||||
var _assert2 = _interopRequireDefault(_assert);
|
||||
|
||||
var _breakpoints = require("../breakpoints");
|
||||
var _breakpoints = require("../breakpoints/index");
|
||||
|
||||
var _ast = require("../ast");
|
||||
|
||||
|
@ -108,7 +108,9 @@ function selectSource(sourceId) {
|
||||
*/
|
||||
|
||||
|
||||
function selectLocation(location) {
|
||||
function selectLocation(location, {
|
||||
checkPrettyPrint = true
|
||||
} = {}) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
@ -145,7 +147,7 @@ function selectLocation(location) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_prefs.prefs.autoPrettyPrint && !(0, _selectors.getPrettySource)(getState(), loadedSource.id) && (0, _source.shouldPrettyPrint)(loadedSource) && (0, _source.isMinified)(loadedSource)) {
|
||||
if (checkPrettyPrint && _prefs.prefs.autoPrettyPrint && !(0, _selectors.getPrettySource)(getState(), loadedSource.id) && (0, _source.shouldPrettyPrint)(loadedSource) && (0, _source.isMinified)(loadedSource)) {
|
||||
await dispatch((0, _prettyPrint.togglePrettyPrint)(loadedSource.id));
|
||||
dispatch((0, _tabs.closeTab)(loadedSource.url));
|
||||
}
|
||||
@ -167,51 +169,9 @@ function selectLocation(location) {
|
||||
|
||||
|
||||
function selectSpecificLocation(location) {
|
||||
return async ({
|
||||
dispatch,
|
||||
getState,
|
||||
client
|
||||
}) => {
|
||||
const currentSource = (0, _selectors.getSelectedSource)(getState());
|
||||
|
||||
if (!client) {
|
||||
// No connection, do nothing. This happens when the debugger is
|
||||
// shut down too fast and it tries to display a default source.
|
||||
return;
|
||||
}
|
||||
|
||||
const source = (0, _selectors.getSource)(getState(), location.sourceId);
|
||||
|
||||
if (!source) {
|
||||
// If there is no source we deselect the current selected source
|
||||
return dispatch(clearSelectedLocation());
|
||||
}
|
||||
|
||||
const activeSearch = (0, _selectors.getActiveSearch)(getState());
|
||||
|
||||
if (activeSearch !== "file") {
|
||||
dispatch((0, _ui.closeActiveSearch)());
|
||||
}
|
||||
|
||||
dispatch((0, _tabs.addTab)(source.url, 0));
|
||||
dispatch(setSelectedLocation(source, location));
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(source));
|
||||
const loadedSource = (0, _selectors.getSource)(getState(), source.id);
|
||||
|
||||
if (!loadedSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceId = loadedSource.id;
|
||||
dispatch((0, _ast.setSymbols)(sourceId));
|
||||
dispatch((0, _ast.setOutOfScopeLocations)()); // If a new source is selected update the file search results
|
||||
|
||||
const newSource = (0, _selectors.getSelectedSource)(getState());
|
||||
|
||||
if (currentSource && currentSource !== newSource) {
|
||||
dispatch((0, _ui.updateActiveFileSearch)());
|
||||
}
|
||||
};
|
||||
return selectLocation(location, {
|
||||
checkPrettyPrint: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @memberof actions/sources
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user