author | Bogdan Tara <btara@mozilla.com> |
Sat, 17 Mar 2018 12:29:57 +0200 | |
changeset 462199 | 97160a734959af73cc97af0bf8d198e301ebedae |
parent 462120 | 29dcc9cb77c372c97681a47496488ec6c623915d (current diff) |
parent 462198 | b73a2face8c8ff11d6bfe12f109bb00a79e83b66 (diff) |
child 462200 | 5d035e99ca38146fbb65e1da2f858e19bd7efbca |
child 462216 | 219284d1520f662f5a60604f1b59c3f8ac57a39d |
child 462219 | 4c52361ab381233976673dd2c519e43d9543c2fc |
push id | 9165 |
push user | asasaki@mozilla.com |
push date | Thu, 26 Apr 2018 21:04:54 +0000 |
treeherder | mozilla-beta@064c3804de2e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | merge |
milestone | 61.0a1 |
first release with | nightly linux32
97160a734959
/
61.0a1
/
20180317111042
/
files
nightly linux64
97160a734959
/
61.0a1
/
20180317111042
/
files
nightly mac
97160a734959
/
61.0a1
/
20180317111042
/
files
nightly win32
97160a734959
/
61.0a1
/
20180317111042
/
files
nightly win64
97160a734959
/
61.0a1
/
20180317111042
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
61.0a1
/
20180317111042
/
pushlog to previous
nightly linux64
61.0a1
/
20180317111042
/
pushlog to previous
nightly mac
61.0a1
/
20180317111042
/
pushlog to previous
nightly win32
61.0a1
/
20180317111042
/
pushlog to previous
nightly win64
61.0a1
/
20180317111042
/
pushlog to previous
|
--- a/accessible/tests/browser/.eslintrc.js +++ b/accessible/tests/browser/.eslintrc.js @@ -4,17 +4,16 @@ module.exports = { "extends": [ "plugin:mozilla/browser-test" ], "globals": { "gBrowser": false }, "rules": { "mozilla/no-aArgs": "error", - "mozilla/no-cpows-in-tests": "error", "mozilla/reject-importGlobalProperties": "error", "mozilla/var-only-at-top-level": "error", "block-scoped-var": "error", "camelcase": "error", "comma-dangle": ["error", "never"], "complexity": ["error", 20], "consistent-this": "off",
--- a/accessible/tests/mochitest/.eslintrc.js +++ b/accessible/tests/mochitest/.eslintrc.js @@ -1,16 +1,15 @@ "use strict"; module.exports = { "extends": [ "plugin:mozilla/mochitest-test" ], "rules": { - "mozilla/no-cpows-in-tests": "error", "mozilla/reject-importGlobalProperties": "error", // XXX These are rules that are enabled in the recommended configuration, but // disabled here due to failures when initially implemented. They should be // removed (and hence enabled) at some stage. "no-nested-ternary": "off", "no-undef": "off", }
--- a/browser/base/content/browser-tabsintitlebar.js +++ b/browser/base/content/browser-tabsintitlebar.js @@ -3,19 +3,16 @@ * 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/. */ // Note: the file browser-tabsintitlebar-stub.js is used instead of // this one on platforms which don't have CAN_DRAW_IN_TITLEBAR defined. var TabsInTitlebar = { init() { - if (this._initialized) { - return; - } this._readPref(); Services.prefs.addObserver(this._prefName, this); // Always disable on unsupported GTK versions. if (AppConstants.MOZ_WIDGET_TOOLKIT == "gtk3") { this.allowedBy("gtk", window.matchMedia("(-moz-gtk-csd-available)")); } @@ -40,23 +37,17 @@ var TabsInTitlebar = { this.onWidgetAdded = this.onWidgetRemoved = function(aWidgetId, aArea) { if (aArea == CustomizableUI.AREA_TABSTRIP || aArea == CustomizableUI.AREA_MENUBAR) this._update(true); }; CustomizableUI.addListener(this); addEventListener("resolutionchange", this, false); - this._initialized = true; - if (this._updateOnInit) { - // We don't need to call this with 'true', even if original calls - // (before init()) did, because this will be the first call and so - // we will update anyway. - this._update(); - } + this._update(true, true); }, allowedBy(condition, allow) { if (allow) { if (condition in this._disallowed) { delete this._disallowed[condition]; this._update(true); } @@ -80,49 +71,54 @@ var TabsInTitlebar = { }, handleEvent(aEvent) { if (aEvent.type == "resolutionchange" && aEvent.target == window) { this._update(true); } }, + onDOMContentLoaded() { + this._domLoaded = true; + this._update(true); + }, + _onMenuMutate(aMutations) { for (let mutation of aMutations) { if (mutation.attributeName == "inactive" || mutation.attributeName == "autohide") { TabsInTitlebar._update(true); return; } } }, - _initialized: false, - _updateOnInit: false, _disallowed: {}, _prefName: "browser.tabs.drawInTitlebar", _lastSizeMode: null, + _domLoaded: false, _readPref() { this.allowedBy("pref", Services.prefs.getBoolPref(this._prefName)); }, - _update(aForce = false) { + _update(aForce = false, aFromInit = false) { let $ = id => document.getElementById(id); let rect = ele => ele.getBoundingClientRect(); let verticalMargins = cstyle => parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop); if (window.fullScreen) return; - // In some edgecases it is possible for this to fire before we've initialized. - // Don't run now, but don't forget to run it when we do initialize. - if (!this._initialized) { - this._updateOnInit = true; + // We want to do this from initialization anyway, so that the + // "chromemargin" attributes are all correctly setup, but we don't want to + // do this before the DOM loads again, to prevent spurious reflows that + // will be superseded by the one on onDOMContentLoaded. + if (!this._domLoaded && !aFromInit) { return; } if (!aForce) { // _update is called on resize events, because the window is not ready // after sizemode events. However, we only care about the event when the // sizemode is different from the last time we updated the appearance of // the tabs in the titlebar. @@ -272,17 +268,16 @@ var TabsInTitlebar = { }, _sizePlaceholder(type, width) { Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='" + type + "']"), function(node) { node.style.width = width + "px"; }); }, uninit() { - this._initialized = false; removeEventListener("resolutionchange", this); Services.prefs.removeObserver(this._prefName, this); this._menuObserver.disconnect(); CustomizableUI.removeListener(this); } }; function updateTitlebarDisplay() {
--- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1185,29 +1185,59 @@ function RedirectLoad({ target: browser, } }; Services.obs.addObserver(delayedStartupFinished, "browser-delayed-startup-finished"); } } if (document.documentElement.getAttribute("windowtype") == "navigator:browser") { - addEventListener("DOMContentLoaded", function() { + window.addEventListener("MozBeforeInitialXULLayout", () => { + gBrowserInit.onBeforeInitialXULLayout(); + }, { once: true }); + // The listener of DOMContentLoaded must be set on window, rather than + // document, because the window can go away before the event is fired. + // In that case, we don't want to initialize anything, otherwise we + // may be leaking things because they will never be destroyed after. + window.addEventListener("DOMContentLoaded", () => { gBrowserInit.onDOMContentLoaded(); }, { once: true }); } let _resolveDelayedStartup; var delayedStartupPromise = new Promise(resolve => { _resolveDelayedStartup = resolve; }); var gBrowserInit = { delayedStartupFinished: false, + onBeforeInitialXULLayout() { + // Set a sane starting width/height for all resolutions on new profiles. + if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) { + // When the fingerprinting resistance is enabled, making sure that we don't + // have a maximum window to interfere with generating rounded window dimensions. + document.documentElement.setAttribute("sizemode", "normal"); + } else if (!document.documentElement.hasAttribute("width")) { + const TARGET_WIDTH = 1280; + const TARGET_HEIGHT = 1040; + let width = Math.min(screen.availWidth * .9, TARGET_WIDTH); + let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT); + + document.documentElement.setAttribute("width", width); + document.documentElement.setAttribute("height", height); + + if (width < TARGET_WIDTH && height < TARGET_HEIGHT) { + document.documentElement.setAttribute("sizemode", "maximized"); + } + } + + TabsInTitlebar.init(); + }, + onDOMContentLoaded() { gBrowser = window._gBrowser; delete window._gBrowser; gBrowser.init(); window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner @@ -1241,35 +1271,16 @@ var gBrowserInit = { if (linkedBrowser) { remoteType = linkedBrowser.remoteType; isRemote = remoteType != E10SUtils.NOT_REMOTE; sameProcessAsFrameLoader = linkedBrowser.frameLoader; } initBrowser.removeAttribute("blank"); } - // Set a sane starting width/height for all resolutions on new profiles. - if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) { - // When the fingerprinting resistance is enabled, making sure that we don't - // have a maximum window to interfere with generating rounded window dimensions. - document.documentElement.setAttribute("sizemode", "normal"); - } else if (!document.documentElement.hasAttribute("width")) { - const TARGET_WIDTH = 1280; - const TARGET_HEIGHT = 1040; - let width = Math.min(screen.availWidth * .9, TARGET_WIDTH); - let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT); - - document.documentElement.setAttribute("width", width); - document.documentElement.setAttribute("height", height); - - if (width < TARGET_WIDTH && height < TARGET_HEIGHT) { - document.documentElement.setAttribute("sizemode", "maximized"); - } - } - gBrowser.updateBrowserRemoteness(initBrowser, isRemote, { remoteType, sameProcessAsFrameLoader }); gUIDensity.init(); if (AppConstants.CAN_DRAW_IN_TITLEBAR) { gDragSpaceObserver.init(); @@ -1281,16 +1292,19 @@ var gBrowserInit = { if (uriToLoad == "about:home") { gBrowser.setIcon(gBrowser.selectedTab, "chrome://branding/content/icon32.png"); } else if (uriToLoad == "about:privatebrowsing") { gBrowser.setIcon(gBrowser.selectedTab, "chrome://browser/skin/privatebrowsing/favicon.svg"); } }); this._setInitialFocus(); + + gBrowser.tabContainer.updateVisibility(); + TabsInTitlebar.onDOMContentLoaded(); }, onLoad() { gBrowser.addEventListener("DOMUpdateBlockedPopups", gPopupBlockerObserver); Services.obs.addObserver(gPluginHandler.NPAPIPluginCrashed, "plugin-crashed"); window.addEventListener("AppCommand", HandleAppCommandEvent, true);
--- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -122,17 +122,17 @@ window._gBrowser = { * properties are accessed by consumers, `_insertBrowser` is called and * the browser is inserted to ensure that things don't break. This list * provides the names of properties that may be called while the browser * is in its unbound (lazy) state. */ _browserBindingProperties: [ "canGoBack", "canGoForward", "goBack", "goForward", "permitUnload", "reload", "reloadWithFlags", "stop", "loadURI", "loadURIWithFlags", - "goHome", "homePage", "gotoIndex", "currentURI", "documentURI", + "gotoIndex", "currentURI", "documentURI", "preferences", "imageDocument", "isRemoteBrowser", "messageManager", "getTabBrowser", "finder", "fastFind", "sessionHistory", "contentTitle", "characterSet", "fullZoom", "textZoom", "webProgress", "addProgressListener", "removeProgressListener", "audioPlaybackStarted", "audioPlaybackStopped", "pauseMedia", "stopMedia", "resumeMedia", "mute", "unmute", "blockedPopups", "lastURI", "purgeSessionHistory", "stopScroll", "startScroll", "userTypedValue", "userTypedClear", "mediaBlocked", @@ -363,33 +363,20 @@ window._gBrowser = { // Note - the callee understands both: // (a) loadURIWithFlags(aURI, aFlags, ...) // (b) loadURIWithFlags(aURI, { flags: aFlags, ... }) // Forwarding it as (a) here actually supports both (a) and (b), // so you can call us either way too. return this.selectedBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData); }, - goHome() { - return this.selectedBrowser.goHome(); - }, - gotoIndex(aIndex) { return this.selectedBrowser.gotoIndex(aIndex); }, - set homePage(val) { - this.selectedBrowser.homePage = val; - return val; - }, - - get homePage() { - return this.selectedBrowser.homePage; - }, - get currentURI() { return this.selectedBrowser.currentURI; }, get finder() { return this.selectedBrowser.finder; },
--- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -119,17 +119,16 @@ "emptyPrivateTabTitle" : "emptyTabTitle"; this.emptyTabTitle = gTabBrowserBundle.GetStringFromName("tabs." + strId); var tab = this.firstChild; tab.label = this.emptyTabTitle; tab.setAttribute("onerror", "this.removeAttribute('image');"); window.addEventListener("resize", this); - window.addEventListener("DOMContentLoaded", this); Services.prefs.addObserver("privacy.userContext", this); this.observe(null, "nsPref:changed", "privacy.userContext.enabled"); XPCOMUtils.defineLazyPreferenceGetter(this, "_tabMinWidthPref", "browser.tabs.tabMinWidth", null, (pref, prevValue, newValue) => this._tabMinWidth = newValue, newValue => { @@ -749,20 +748,16 @@ this._handleTabSelect(); ]]></body> </method> <method name="handleEvent"> <parameter name="aEvent"/> <body><![CDATA[ switch (aEvent.type) { - case "DOMContentLoaded": - this.updateVisibility(); - TabsInTitlebar.init(); - break; case "resize": if (aEvent.target != window) break; TabsInTitlebar.updateAppearance(); this._updateCloseButtons(); this._handleTabSelect(true); this.updateSessionRestoreVisibility();
--- a/browser/base/content/test/general/browser_bug423833.js +++ b/browser/base/content/test/general/browser_bug423833.js @@ -79,26 +79,24 @@ function test2Setup() { ok(test2tab, "openFrameInTab() opened a tab"); gBrowser.selectedTab = test2tab; intervalID = setInterval(testOpenFrameInTab, 3000); } function testOpenFrameInTab() { - /* eslint-disable mozilla/no-cpows-in-tests */ if (gBrowser.contentDocument.location.href == "about:blank") // Wait another cycle return; clearInterval(intervalID); // We should now have the error page in a new, active tab. is(gBrowser.contentDocument.location.href, invalidPage, "New tab should have page url, not about:neterror"); - /* eslint-enable mozilla/no-cpows-in-tests */ // Clear up the new tab, and punt to test 3 gBrowser.removeCurrentTab(); test3Setup(); } function test3Setup() {
--- a/browser/base/content/test/general/browser_bug575561.js +++ b/browser/base/content/test/general/browser_bug575561.js @@ -69,17 +69,16 @@ async function testLink(aLinkIndexOrFunc }); } else { promise = BrowserTestUtils.browserLoaded(browser, testSubFrame); } let href; if (typeof aLinkIndexOrFunction === "function") { ok(!browser.isRemoteBrowser, "don't pass a function for a remote browser"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let link = aLinkIndexOrFunction(browser.contentDocument); info("Clicking " + link.textContent); link.click(); href = link.href; } else { href = await ContentTask.spawn(browser, [ testSubFrame, aLinkIndexOrFunction ], function([ subFrame, index ]) { let doc = subFrame ? content.document.querySelector("iframe").contentDocument : content.document; let link = doc.querySelectorAll("a")[index];
--- a/browser/base/content/test/general/browser_bug678392.js +++ b/browser/base/content/test/general/browser_bug678392.js @@ -31,17 +31,16 @@ function test() { "was successfully initialized when supported."); cleanupArray(); load(gBrowser.selectedTab, HTTPROOT + "browser_bug678392-2.html", test0); } function load(aTab, aUrl, aCallback) { aTab.linkedBrowser.addEventListener("load", function(aEvent) { - // eslint-disable-next-line mozilla/no-cpows-in-tests waitForFocus(aCallback, content); }, {capture: true, once: true}); aTab.linkedBrowser.loadURI(aUrl); } function cleanupArray() { let arr = gHistorySwipeAnimation._trackedSnapshots; while (arr.length > 0) {
--- a/browser/base/content/test/general/browser_bug767836_perwindowpb.js +++ b/browser/base/content/test/general/browser_bug767836_perwindowpb.js @@ -70,17 +70,16 @@ function test() { }); } function openNewTab(aWindow, aCallback) { // Open a new tab aWindow.BrowserOpenTab(); let browser = aWindow.gBrowser.selectedBrowser; - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocumentAsCPOW; if (doc && doc.readyState === "complete") { executeSoon(aCallback); return; } BrowserTestUtils.browserLoaded(browser).then(() => { executeSoon(aCallback);
--- a/browser/base/content/test/general/browser_e10s_about_page_triggeringprincipal.js +++ b/browser/base/content/test/general/browser_e10s_about_page_triggeringprincipal.js @@ -11,17 +11,16 @@ const kAboutPagesRegistered = Promise.al registerCleanupFunction, "test-about-principal-parent", kParentPage, Ci.nsIAboutModule.ALLOW_SCRIPT) ]); add_task(async function test_principal_click() { await kAboutPagesRegistered; await BrowserTestUtils.withNewTab("about:test-about-principal-parent", async function(browser) { let loadPromise = BrowserTestUtils.browserLoaded(browser, false, "about:test-about-principal-child"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let myLink = browser.contentDocument.getElementById("aboutchildprincipal"); myLink.click(); await loadPromise; await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() { let channel = content.document.docShell.currentDocumentChannel; is(channel.originalURI.asciiSpec, "about:test-about-principal-child",
--- a/browser/base/content/test/general/browser_keywordSearch_postData.js +++ b/browser/base/content/test/general/browser_keywordSearch_postData.js @@ -62,17 +62,16 @@ function nextTest() { finish(); } } function doTest() { info("Running test: " + gCurrTest.name); waitForLoad(function() { - // eslint-disable-next-line mozilla/no-cpows-in-tests let loadedText = gBrowser.contentDocumentAsCPOW.body.textContent; ok(loadedText, "search page loaded"); let needle = "searchterms=" + gCurrTest.expectText; is(loadedText, needle, "The query POST data should be returned in the response"); nextTest(); }); // Simulate a user entering search terms
--- a/browser/base/content/test/general/browser_tabfocus.js +++ b/browser/base/content/test/general/browser_tabfocus.js @@ -83,17 +83,16 @@ function focusInChild() { addEventListener("focus", eventListener, true); addEventListener("blur", eventListener, true); addMessageListener("Browser:ChangeFocus", function changeFocus(message) { content.document.getElementById(message.data.id)[message.data.type](); }); - /* eslint-disable mozilla/no-cpows-in-tests */ addMessageListener("Browser:GetFocusedElement", function getFocusedElement(message) { var focusedWindow = {}; var node = Services.focus.getFocusedElementForWindow(content, false, focusedWindow); var details = "Focus is " + (node ? node.id : "<none>"); /* Check focus manager properties. Add an error onto the string if they are not what is expected which will cause matching to fail in the parent process. */ let doc = content.document; @@ -121,17 +120,16 @@ function focusElementInChild(elementid, let browser = (elementid.includes("1")) ? browser1 : browser2; if (gMultiProcessBrowser) { browser.messageManager.sendAsyncMessage("Browser:ChangeFocus", { id: elementid, type }); } else { browser.contentDocument.getElementById(elementid)[type](); } } -/* eslint-enable mozilla/no-cpows-in-tests */ add_task(async function() { tab1 = BrowserTestUtils.addTab(gBrowser); browser1 = gBrowser.getBrowserForTab(tab1); tab2 = BrowserTestUtils.addTab(gBrowser); browser2 = gBrowser.getBrowserForTab(tab2);
--- a/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js @@ -20,17 +20,16 @@ const URI = function test() { waitForExplicitFinish(); gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); let uriToWaitFor = URI.replace(/ /g, "%20"); BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, uriToWaitFor).then(function() { - // eslint-disable-next-line mozilla/no-cpows-in-tests var doc = gBrowser.contentDocumentAsCPOW; var testImg = doc.getElementById("test-image"); var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec, "mediaTab", getImageInfo(testImg)); pageInfo.addEventListener("load", function() { pageInfo.onFinished.push(function() { var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
--- a/browser/base/content/test/performance/browser_startup_flicker.js +++ b/browser/base/content/test/performance/browser_startup_flicker.js @@ -17,26 +17,26 @@ add_task(async function() { let frames = Cu.cloneInto(startupRecorder.data.frames, {}); let unexpectedRects = 0; let alreadyFocused = false; for (let i = 1; i < frames.length; ++i) { let frame = frames[i], previousFrame = frames[i - 1]; let rects = compareFrames(frame, previousFrame); - // The first screenshot we get shows an unfocused browser window for some - // reason. This is likely due to the test harness, so we want to ignore it. + // The first screenshot we get in OSX / Windows shows an unfocused browser + // window for some reason. See bug 1445161. + // // We'll assume the changes we are seeing are due to this focus change if // there are at least 5 areas that changed near the top of the screen, but // will only ignore this once (hence the alreadyFocused variable). if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) { alreadyFocused = true; - // This is likely an issue caused by the test harness, but log it anyway. todo(false, - "the window should be focused at first paint, " + rects.toSource()); + "bug 1445161 - the window should be focused at first paint, " + rects.toSource()); continue; } rects = rects.filter(rect => { let width = frame.width; let exceptions = [ /**
--- a/browser/base/content/test/performance/browser_startup_images.js +++ b/browser/base/content/test/performance/browser_startup_images.js @@ -56,16 +56,17 @@ const whitelist = [ file: "resource://gre-resources/broken-image.png", platforms: ["win", "macosx"], intermittentNotLoaded: ["win", "macosx"], }, { file: "chrome://browser/skin/chevron.svg", platforms: ["win", "linux", "macosx"], + intermittentShown: ["win"], }, { file: "chrome://global/skin/icons/resizer.png", platforms: ["win"], }, {
--- a/browser/base/content/test/performance/browser_windowopen_flicker.js +++ b/browser/base/content/test/performance/browser_windowopen_flicker.js @@ -66,27 +66,35 @@ add_task(async function() { Services.tm.idleDispatchToMainThread(() => { waitForIdle(count - 1); }); })(); }); win.removeEventListener("MozAfterPaint", afterPaintListener); let unexpectedRects = 0; - let ignoreTinyPaint = true; + let alreadyFocused = false; for (let i = 1; i < frames.length; ++i) { let frame = frames[i], previousFrame = frames[i - 1]; - if (ignoreTinyPaint && - previousFrame.width == 1 && previousFrame.height == 1) { - todo(false, "shouldn't initially paint a 1x1px window"); + let rects = compareFrames(frame, previousFrame); + + // The first screenshot we get in OSX / Windows shows an unfocused browser + // window for some reason. See bug 1445161. + // + // We'll assume the changes we are seeing are due to this focus change if + // there are at least 5 areas that changed near the top of the screen, but + // will only ignore this once (hence the alreadyFocused variable). + if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) { + alreadyFocused = true; + todo(false, + "bug 1445161 - the window should be focused at first paint, " + rects.toSource()); continue; } - ignoreTinyPaint = false; - let rects = compareFrames(frame, previousFrame).filter(rect => { + rects = rects.filter(rect => { let inRange = (val, min, max) => min <= val && val <= max; let width = frame.width; let exceptions = [ {name: "bug 1421463 - reload toolbar icon shouldn't flicker", condition: r => r.h == 13 && inRange(r.w, 14, 16) && // icon size inRange(r.y1, 40, 80) && // in the toolbar // near the left side of the screen
--- a/browser/base/content/test/performance/browser_windowopen_reflows.js +++ b/browser/base/content/test/performance/browser_windowopen_reflows.js @@ -19,32 +19,32 @@ const EXPECTED_REFLOWS = [ ]; if (Services.appinfo.OS == "WINNT") { EXPECTED_REFLOWS.push( { stack: [ "verticalMargins@chrome://browser/content/browser-tabsintitlebar.js", "_update@chrome://browser/content/browser-tabsintitlebar.js", - "init@chrome://browser/content/browser-tabsintitlebar.js", - "handleEvent@chrome://browser/content/tabbrowser.xml", + "onDOMContentLoaded@chrome://browser/content/browser-tabsintitlebar.js", + "onDOMContentLoaded@chrome://browser/content/browser.js", ], maxCount: 2, // This number should only ever go down - never up. }, ); } if (Services.appinfo.OS == "WINNT" || Services.appinfo.OS == "Darwin") { EXPECTED_REFLOWS.push( { stack: [ "rect@chrome://browser/content/browser-tabsintitlebar.js", "_update@chrome://browser/content/browser-tabsintitlebar.js", - "init@chrome://browser/content/browser-tabsintitlebar.js", - "handleEvent@chrome://browser/content/tabbrowser.xml", + "onDOMContentLoaded@chrome://browser/content/browser-tabsintitlebar.js", + "onDOMContentLoaded@chrome://browser/content/browser.js", ], // These numbers should only ever go down - never up. maxCount: Services.appinfo.OS == "WINNT" ? 5 : 4, }, ); } /* @@ -57,19 +57,15 @@ add_task(async function() { // opened in previous tests. Services.obs.notifyObservers(null, "startupcache-invalidate"); Services.obs.notifyObservers(null, "chrome-flush-skin-caches"); Services.obs.notifyObservers(null, "chrome-flush-caches"); let win = OpenBrowserWindow(); await withReflowObserver(async function() { - let resizeEvent = BrowserTestUtils.waitForEvent(win, "resize"); - let delayedStartup = - TestUtils.topicObserved("browser-delayed-startup-finished", - subject => subject == win); - await resizeEvent; - await delayedStartup; + await TestUtils.topicObserved("browser-delayed-startup-finished", + subject => subject == win); }, EXPECTED_REFLOWS, win); await BrowserTestUtils.closeWindow(win); });
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js @@ -187,17 +187,16 @@ var tests = [ await opened; // Check that the focused element in the chrome window // is either the browser in case we're running on e10s // or the input field in case of non-e10s. if (gMultiProcessBrowser) { is(Services.focus.focusedElement, browser); } else { - // eslint-disable-next-line mozilla/no-cpows-in-tests is(Services.focus.focusedElement, browser.contentDocument.getElementById("test-input")); } // Check that the input field is still focused inside the browser. await ContentTask.spawn(browser, {}, function() { is(content.document.activeElement, content.document.getElementById("test-input")); });
--- a/browser/base/content/test/sidebar/browser_bug409481.js +++ b/browser/base/content/test/sidebar/browser_bug409481.js @@ -32,21 +32,19 @@ function delayedRunTest() { setTimeout(runTest, 100); } function runTest(event) { var sidebar = document.getElementById("sidebar"); sidebar.contentDocument.removeEventListener("load", delayedRunTest, true); var browser = sidebar.contentDocument.getElementById("web-panels-browser"); - // eslint-disable-next-line mozilla/no-cpows-in-tests var div = browser && browser.contentDocument.getElementById("test_bug409481"); ok(div && div.textContent == "Content!", "Sidebar content loaded"); - // eslint-disable-next-line mozilla/no-cpows-in-tests var link = browser && browser.contentDocument.getElementById("link"); sidebar.contentDocument.addEventListener("popupshown", contextMenuOpened); EventUtils.synthesizeMouseAtCenter(link, { type: "contextmenu", button: 2 }, browser.contentWindow); } function contextMenuOpened() { var sidebar = document.getElementById("sidebar"); @@ -57,17 +55,16 @@ function contextMenuOpened() { copyLinkCommand.doCommand(); } function copyLinkCommandExecuted(event) { event.target.removeEventListener("command", copyLinkCommandExecuted); var sidebar = document.getElementById("sidebar"); var browser = sidebar.contentDocument.getElementById("web-panels-browser"); - // eslint-disable-next-line mozilla/no-cpows-in-tests var textbox = browser && browser.contentDocument.getElementById("textbox"); textbox.focus(); document.commandDispatcher.getControllerForCommand("cmd_paste").doCommand("cmd_paste"); is(textbox.value, "http://www.example.com/ctest", "copy link command"); sidebar.contentDocument.addEventListener("popuphidden", contextMenuClosed); event.target.parentNode.hidePopup(); }
--- a/browser/base/content/test/siteIdentity/browser_bug906190.js +++ b/browser/base/content/test/siteIdentity/browser_bug906190.js @@ -29,28 +29,25 @@ async function doTest(parentTabSpec, chi }); // Disable the Mixed Content Blocker for the page, which reloads it. let promiseReloaded = BrowserTestUtils.browserLoaded(browser); gIdentityHandler.disableMixedContentProtection(); await promiseReloaded; // Wait for the script in the page to update the contents of the test div. - // eslint-disable-next-line mozilla/no-cpows-in-tests let testDiv = gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv"); await BrowserTestUtils.waitForCondition( () => testDiv.innerHTML == "Mixed Content Blocker disabled"); // Add the link for the child tab to the page. - // eslint-disable-next-line mozilla/no-cpows-in-tests let mainDiv = gBrowser.contentDocumentAsCPOW.createElement("div"); // eslint-disable-next-line no-unsanitized/property mainDiv.innerHTML = '<p><a id="linkToOpenInNewTab" href="' + childTabSpec + '">Link</a></p>'; - // eslint-disable-next-line mozilla/no-cpows-in-tests gBrowser.contentDocumentAsCPOW.body.appendChild(mainDiv); // Execute the test in the child tabs with the two methods to open it. for (let openFn of [simulateCtrlClick, simulateContextMenuOpenInTab]) { let promiseTabLoaded = waitForSomeTabToLoad(); openFn(browser); await promiseTabLoaded; gBrowser.selectTabAtIndex(2); @@ -114,17 +111,16 @@ add_task(async function test_same_origin HTTPS_TEST_ROOT_1 + "file_bug906190_2.html", async function() { // The doorhanger should appear but activeBlocked should be >> NOT << true, // because our decision of disabling the mixed content blocker is persistent // across tabs. await assertMixedContentBlockingState(gBrowser, { activeLoaded: true, activeBlocked: false, passiveLoaded: false, }); - // eslint-disable-next-line mozilla/no-cpows-in-tests is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML, "Mixed Content Blocker disabled", "OK: Executed mixed script"); }); }); /** * 2. - Load a html page which has mixed content * - Doorhanger to disable protection appears - we disable it @@ -136,17 +132,16 @@ add_task(async function test_different_o HTTPS_TEST_ROOT_2 + "file_bug906190_2.html", async function() { // The doorhanger should appear and activeBlocked should be >> TRUE <<, // because our decision of disabling the mixed content blocker should only // persist if pages are from the same domain. await assertMixedContentBlockingState(gBrowser, { activeLoaded: false, activeBlocked: true, passiveLoaded: false, }); - // eslint-disable-next-line mozilla/no-cpows-in-tests is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML, "Mixed Content Blocker enabled", "OK: Blocked mixed script"); }); }); /** * 3. - Load a html page which has mixed content * - Doorhanger to disable protection appears - we disable it @@ -158,17 +153,16 @@ add_task(async function test_same_origin // file_bug906190_3_4.html redirects to page test1.example.com/* using meta-refresh await doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html", HTTPS_TEST_ROOT_1 + "file_bug906190_3_4.html", async function() { // The doorhanger should appear but activeBlocked should be >> NOT << true! await assertMixedContentBlockingState(gBrowser, { activeLoaded: true, activeBlocked: false, passiveLoaded: false, }); - // eslint-disable-next-line mozilla/no-cpows-in-tests is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML, "Mixed Content Blocker disabled", "OK: Executed mixed script"); }, true); }); /** * 4. - Load a html page which has mixed content * - Doorhanger to disable protection appears - we disable it @@ -179,17 +173,16 @@ add_task(async function test_same_origin add_task(async function test_same_origin_metarefresh_different_origin() { await doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html", HTTPS_TEST_ROOT_2 + "file_bug906190_3_4.html", async function() { // The doorhanger should appear and activeBlocked should be >> TRUE <<. await assertMixedContentBlockingState(gBrowser, { activeLoaded: false, activeBlocked: true, passiveLoaded: false, }); - // eslint-disable-next-line mozilla/no-cpows-in-tests is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML, "Mixed Content Blocker enabled", "OK: Blocked mixed script"); }, true); }); /** * 5. - Load a html page which has mixed content * - Doorhanger to disable protection appears - we disable it @@ -200,17 +193,16 @@ add_task(async function test_same_origin // the sjs files returns a 302 redirect- note, same origins await doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html", HTTPS_TEST_ROOT_1 + "file_bug906190.sjs", function() { // The doorhanger should appear but activeBlocked should be >> NOT << true. // Currently it is >> TRUE << - see follow up bug 914860 ok(!gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"), "OK: Mixed Content is NOT being blocked"); - // eslint-disable-next-line mozilla/no-cpows-in-tests is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML, "Mixed Content Blocker disabled", "OK: Executed mixed script"); }); }); /** * 6. - Load a html page which has mixed content * - Doorhanger to disable protection appears - we disable it @@ -221,17 +213,16 @@ add_task(async function test_same_origin // the sjs files returns a 302 redirect - note, different origins await doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html", HTTPS_TEST_ROOT_2 + "file_bug906190.sjs", async function() { // The doorhanger should appear and activeBlocked should be >> TRUE <<. await assertMixedContentBlockingState(gBrowser, { activeLoaded: false, activeBlocked: true, passiveLoaded: false, }); - // eslint-disable-next-line mozilla/no-cpows-in-tests is(gBrowser.contentDocumentAsCPOW.getElementById("mctestdiv").innerHTML, "Mixed Content Blocker enabled", "OK: Blocked mixed script"); }); }); /** * 7. - Test memory leak issue on redirection error. See Bug 1269426. */
--- a/browser/base/content/test/static/browser.ini +++ b/browser/base/content/test/static/browser.ini @@ -1,18 +1,20 @@ [DEFAULT] # These tests can be prone to intermittent failures on slower systems. # Since the specific flavor doesn't matter from a correctness standpoint, # just skip the tests on ASAN and debug builds. Also known to be flaky on # Linux32 (bug 1172468, bug 1349307), so skip them there as well. -skip-if = asan || debug || (os == 'linux' && bits == 32) +# +# Temporarily disable tests on all 32 bit OSes due to OOM failures after +# landing bug 1373708. +skip-if = asan || debug || (bits == 32) support-files = head.js [browser_all_files_referenced.js] -skip-if = (os == 'win' && bits == 32) [browser_misused_characters_in_strings.js] support-files = bug1262648_string_with_newlines.dtd [browser_parsable_css.js] support-files = dummy_page.html [browser_parsable_script.js]
--- a/browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js +++ b/browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js @@ -27,17 +27,16 @@ add_task(async function test_show_form() }, async function(browser) { // Make sure we've flushed the browser messages so that // we can restore it. await TabStateFlusher.flush(browser); // Now crash the browser. await BrowserTestUtils.crashBrowser(browser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; // Ensure the request is visible. We can safely reach into // the content since about:tabcrashed is an in-process URL. let requestAutoSubmit = doc.getElementById("requestAutoSubmit"); Assert.ok(!requestAutoSubmit.hidden, "Request for autosubmission is visible."); @@ -72,17 +71,16 @@ add_task(async function test_show_form() await BrowserTestUtils.withNewTab({ gBrowser, url: PAGE, }, async function(browser) { await TabStateFlusher.flush(browser); // Now crash the browser. await BrowserTestUtils.crashBrowser(browser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; // Ensure the request is NOT visible. We can safely reach into // the content since about:tabcrashed is an in-process URL. let requestAutoSubmit = doc.getElementById("requestAutoSubmit"); Assert.ok(requestAutoSubmit.hidden, "Request for autosubmission is not visible."); @@ -117,17 +115,16 @@ add_task(async function test_no_offer() await TabStateFlusher.flush(browser); // Make it so that it seems like no dump is available for the next crash. prepareNoDump(); // Now crash the browser. await BrowserTestUtils.crashBrowser(browser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; // Ensure the request to autosubmit is invisible, since there's no report. let requestRect = doc.getElementById("requestAutoSubmit") .getBoundingClientRect(); Assert.equal(0, requestRect.height, "Request for autosubmission has no height"); Assert.equal(0, requestRect.width,
--- a/browser/base/content/test/tabcrashed/browser_clearEmail.js +++ b/browser/base/content/test/tabcrashed/browser_clearEmail.js @@ -32,29 +32,27 @@ add_task(async function test_clear_email // crash prefs.setCharPref("email", EMAIL); prefs.setBoolPref("emailMe", true); let tab = gBrowser.getTabForBrowser(browser); await BrowserTestUtils.crashBrowser(browser, /* shouldShowTabCrashPage */ true, /* shouldClearMinidumps */ false); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; // Since about:tabcrashed will run in the parent process, we can safely // manipulate its DOM nodes directly let emailMe = doc.getElementById("emailMe"); emailMe.checked = false; let crashReport = promiseCrashReport({ Email: "", }); - // eslint-disable-next-line mozilla/no-cpows-in-tests let restoreTab = browser.contentDocument.getElementById("restoreTab"); restoreTab.click(); await BrowserTestUtils.waitForEvent(tab, "SSTabRestored"); await crashReport; is(prefs.getCharPref("email"), "", "No email address should be stored"); // Submitting the crash report may have set some prefs regarding how to
--- a/browser/base/content/test/tabcrashed/browser_showForm.js +++ b/browser/base/content/test/tabcrashed/browser_showForm.js @@ -21,17 +21,16 @@ add_task(async function test_show_form() let pref = TabCrashHandler.prefs.root + "sendReport"; await SpecialPowers.pushPrefEnv({ set: [[pref, true]] }); // Now crash the browser. await BrowserTestUtils.crashBrowser(browser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; // Ensure the checkbox is checked. We can safely reach into // the content since about:tabcrashed is an in-process URL. let checkbox = doc.getElementById("sendReport"); ok(checkbox.checked, "Send report checkbox is checked."); // Ensure the options form is displayed.
--- a/browser/base/content/test/tabcrashed/browser_shown.js +++ b/browser/base/content/test/tabcrashed/browser_shown.js @@ -51,17 +51,16 @@ function crashTabTestHelper(fieldValues, let prefs = TabCrashHandler.prefs; let originalSendReport = prefs.getBoolPref("sendReport"); let originalEmailMe = prefs.getBoolPref("emailMe"); let originalIncludeURL = prefs.getBoolPref("includeURL"); let originalEmail = prefs.getCharPref("email"); let tab = gBrowser.getTabForBrowser(browser); await BrowserTestUtils.crashBrowser(browser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; // Since about:tabcrashed will run in the parent process, we can safely // manipulate its DOM nodes directly let comments = doc.getElementById("comments"); let email = doc.getElementById("email"); let emailMe = doc.getElementById("emailMe"); let includeURL = doc.getElementById("includeURL"); @@ -78,17 +77,16 @@ function crashTabTestHelper(fieldValues, emailMe.checked = fieldValues.emailMe; } if (fieldValues.hasOwnProperty("includeURL")) { includeURL.checked = fieldValues.includeURL; } let crashReport = promiseCrashReport(expectedExtra); - // eslint-disable-next-line mozilla/no-cpows-in-tests let restoreTab = browser.contentDocument.getElementById("restoreTab"); restoreTab.click(); await BrowserTestUtils.waitForEvent(tab, "SSTabRestored"); await crashReport; // Submitting the crash report may have set some prefs regarding how to // send tab crash reports. Let's reset them for the next test. prefs.setBoolPref("sendReport", originalSendReport);
--- a/browser/base/content/test/urlbar/browser_urlbarKeepStateAcrossTabSwitches.js +++ b/browser/base/content/test/urlbar/browser_urlbarKeepStateAcrossTabSwitches.js @@ -5,17 +5,16 @@ * loads fail. */ add_task(async function() { let input = "i-definitely-dont-exist.example.com"; let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false); let browser = tab.linkedBrowser; // NB: CPOW usage because new tab pages can be preloaded, in which case no // load events fire. - // eslint-disable-next-line mozilla/no-cpows-in-tests await BrowserTestUtils.waitForCondition(() => browser.contentDocumentAsCPOW && !browser.contentDocumentAsCPOW.hidden); let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser); gURLBar.value = input; gURLBar.select(); EventUtils.sendKey("return"); await errorPageLoaded; is(gURLBar.textValue, input, "Text is still in URL bar"); await BrowserTestUtils.switchTab(gBrowser, tab.previousSibling); @@ -30,17 +29,16 @@ add_task(async function() { */ add_task(async function() { let input = "To be or not to be-that is the question"; await SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]}); let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false); let browser = tab.linkedBrowser; // NB: CPOW usage because new tab pages can be preloaded, in which case no // load events fire. - // eslint-disable-next-line mozilla/no-cpows-in-tests await BrowserTestUtils.waitForCondition(() => browser.contentDocumentAsCPOW && !browser.contentDocumentAsCPOW.hidden); let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser); gURLBar.value = input; gURLBar.select(); EventUtils.sendKey("return"); await errorPageLoaded; is(gURLBar.textValue, input, "Text is still in URL bar"); is(tab.linkedBrowser.userTypedValue, input, "Text still stored on browser");
--- a/browser/base/content/test/webextensions/browser_extension_sideloading.js +++ b/browser/base/content/test/webextensions/browser_extension_sideloading.js @@ -131,17 +131,16 @@ add_task(async function() { ok(PanelUI.panel.state != "open", "Main menu is closed or closing."); // When we get the permissions prompt, we should be at the extensions // list in about:addons let panel = await popupPromise; is(gBrowser.currentURI.spec, "about:addons", "Foreground tab is at about:addons"); const VIEW = "addons://list/extension"; - // eslint-disable-next-line mozilla/no-cpows-in-tests let win = gBrowser.selectedBrowser.contentWindow; ok(!win.gViewController.isLoading, "about:addons view is fully loaded"); is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list"); // Check the contents of the notification, then choose "Cancel" checkNotification(panel, /\/foo-icon\.png$/, [ ["webextPerms.hostDescription.allUrls"], ["webextPerms.description.history"], @@ -167,17 +166,16 @@ add_task(async function() { // Click the second sideloaded extension and wait for the notification popupPromise = promisePopupNotificationShown("addon-webext-permissions"); addons.children[0].click(); panel = await popupPromise; // Again we should be at the extentions list in about:addons is(gBrowser.currentURI.spec, "about:addons", "Foreground tab is at about:addons"); - // eslint-disable-next-line mozilla/no-cpows-in-tests win = gBrowser.selectedBrowser.contentWindow; ok(!win.gViewController.isLoading, "about:addons view is fully loaded"); is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list"); // Check the notification contents. checkNotification(panel, DEFAULT_ICON_URL, []); // This time accept the install.
--- a/browser/components/contextualidentity/test/browser/browser_usercontext.js +++ b/browser/components/contextualidentity/test/browser/browser_usercontext.js @@ -64,17 +64,16 @@ add_task(async function test() { let tab = openTabInUserContext(BASE_URI, userContextId); // wait for load let browser = gBrowser.getBrowserForTab(tab); await BrowserTestUtils.browserLoaded(browser); // get the title - // eslint-disable-next-line mozilla/no-cpows-in-tests let title = browser.contentDocumentAsCPOW.title.trim().split("|"); // check each item in the title and validate it meets expectatations for (let part of title) { let [storageMethodName, value] = part.split("="); is(value, expectedContext, "the title reflects the expected contextual identity of " + expectedContext + " for method " + storageMethodName + ": " + value);
--- a/browser/components/customizableui/test/browser_947914_button_addons.js +++ b/browser/components/customizableui/test/browser_947914_button_addons.js @@ -19,17 +19,16 @@ add_task(async function() { let addonsButton = document.getElementById("add-ons-button"); ok(addonsButton, "Add-ons button exists in Panel Menu"); addonsButton.click(); newTab = gBrowser.selectedTab; await waitForCondition(() => gBrowser.currentURI && gBrowser.currentURI.spec == "about:addons"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let addonsPage = gBrowser.selectedBrowser.contentWindow.document. getElementById("addons-page"); ok(addonsPage, "Add-ons page was opened"); }); add_task(async function asyncCleanup() { CustomizableUI.reset(); BrowserTestUtils.addTab(gBrowser, initialLocation);
--- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -258,16 +258,28 @@ var Policies = { }, "DontCheckDefaultBrowser": { onBeforeUIStartup(manager, param) { setAndLockPref("browser.shell.checkDefaultBrowser", false); } }, + "EnableTrackingProtection": { + onBeforeUIStartup(manager, param) { + if (param.Locked) { + setAndLockPref("privacy.trackingprotection.enabled", param.Value); + setAndLockPref("privacy.trackingprotection.pbmode.enabled", param.Value); + } else { + setDefaultPref("privacy.trackingprotection.enabled", param.Value); + setDefaultPref("privacy.trackingprotection.pbmode.enabled", param.Value); + } + } + }, + "FlashPlugin": { onBeforeUIStartup(manager, param) { addAllowDenyPermissions("plugin:flash", param.Allow, param.Block); } }, "Homepage": { onBeforeUIStartup(manager, param) { @@ -294,16 +306,24 @@ var Policies = { }, "InstallAddons": { onBeforeUIStartup(manager, param) { addAllowDenyPermissions("install", param.Allow, null); } }, + "NoDefaultBookmarks": { + onProfileAfterChange(manager, param) { + if (param) { + manager.disallowFeature("defaultBookmarks"); + } + } + }, + "Popups": { onBeforeUIStartup(manager, param) { addAllowDenyPermissions("popup", param.Allow, null); } }, "RememberPasswords": { onBeforeUIStartup(manager, param) { @@ -333,16 +353,33 @@ var Policies = { * @param {boolean,number,string} prefValue * The value to set and lock */ function setAndLockPref(prefName, prefValue) { if (Services.prefs.prefIsLocked(prefName)) { Services.prefs.unlockPref(prefName); } + setDefaultPref(prefName, prefValue); + + Services.prefs.lockPref(prefName); +} + +/** + * setDefaultPref + * + * Sets the _default_ value of a pref. + * The value is only changed in memory, and not stored to disk. + * + * @param {string} prefName + * The pref to be changed + * @param {boolean,number,string} prefValue + * The value to set + */ +function setDefaultPref(prefName, prefValue) { let defaults = Services.prefs.getDefaultBranch(""); switch (typeof(prefValue)) { case "boolean": defaults.setBoolPref(prefName, prefValue); break; case "number": @@ -352,18 +389,16 @@ function setAndLockPref(prefName, prefVa defaults.setIntPref(prefName, prefValue); break; case "string": defaults.setStringPref(prefName, prefValue); break; } - - Services.prefs.lockPref(prefName); } /** * addAllowDenyPermissions * * Helper function to call the permissions manager (Services.perms.add) * for two arrays of URLs. *
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json +++ b/browser/components/enterprisepolicies/schemas/policies-schema.json @@ -202,16 +202,32 @@ "DontCheckDefaultBrowser": { "description": "Don't check for the default browser on startup.", "first_available": "60.0", "type": "boolean" }, + "EnableTrackingProtection": { + "description": "Enables or disables tracking protection and optionally locks it.", + "first_available": "60.0", + + "type": "object", + "properties": { + "Value": { + "type": "boolean" + }, + "Locked": { + "type": "boolean" + } + }, + "required": ["Value"] + }, + "FlashPlugin": { "description": "Allow or deny flash plugin usage.", "first_available": "60.0", "type": "object", "properties": { "Allow": { "type": "array", @@ -262,16 +278,24 @@ "type": "array", "items": { "type": "origin" } } } }, + "NoDefaultBookmarks": { + "description": "Don't create the default bookmarks bundled with Firefox, nor the Smart Bookmarks (Most Visited, Recent Tags). Note: this policy is only effective if used before the first run of the profile.", + "first_available": "60.0", + + "type": "boolean", + "enum": [true] + }, + "Popups": { "description": "Allow or deny popup usage.", "first_available": "60.0", "type": "object", "properties": { "Allow": { "type": "array",
--- a/browser/components/enterprisepolicies/tests/browser/browser.ini +++ b/browser/components/enterprisepolicies/tests/browser/browser.ini @@ -31,10 +31,11 @@ support-files = [browser_policy_disable_masterpassword.js] [browser_policy_disable_pdfjs.js] [browser_policy_disable_pocket.js] [browser_policy_disable_privatebrowsing.js] [browser_policy_disable_safemode.js] [browser_policy_disable_shield.js] [browser_policy_display_bookmarks.js] [browser_policy_display_menu.js] +[browser_policy_enable_tracking_protection.js] [browser_policy_remember_passwords.js] [browser_policy_set_homepage.js]
--- a/browser/components/enterprisepolicies/tests/browser/browser_policies_notice_in_aboutpreferences.js +++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_notice_in_aboutpreferences.js @@ -4,13 +4,12 @@ "use strict"; add_task(async function test_notice_in_aboutprefences() { await setupPolicyEngineWithJson({ "policies": { } }); await BrowserTestUtils.withNewTab("about:preferences", async browser => { - // eslint-disable-next-line mozilla/no-cpows-in-tests ok(!browser.contentDocument.getElementById("policies-container").hidden, "The Policies notice was made visible in about:preferences"); }); });
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_masterpassword.js +++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_masterpassword.js @@ -32,17 +32,16 @@ async function checkDeviceManager({butto is(changePwButton.getAttribute("disabled") == "true", buttonIsDisabled, "Change Password button is in the correct state: " + buttonIsDisabled); await BrowserTestUtils.closeWindow(deviceManagerWindow); } async function checkAboutPreferences({checkboxIsDisabled}) { await BrowserTestUtils.withNewTab("about:preferences#privacy", async browser => { - // eslint-disable-next-line mozilla/no-cpows-in-tests is(browser.contentDocument.getElementById("useMasterPassword").disabled, checkboxIsDisabled, "Master Password checkbox is in the correct state: " + checkboxIsDisabled); }); } add_task(async function test_policy_disable_masterpassword() { ok(!mpToken.hasPassword, "Starting the test with no password");
new file mode 100644 --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_enable_tracking_protection.js @@ -0,0 +1,36 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_policy_enable_tracking_protection1() { + await setupPolicyEngineWithJson({ + "policies": { + "EnableTrackingProtection": { + "Value": true + } + } + }); + + is(Services.prefs.getBoolPref("privacy.trackingprotection.enabled"), true, "Tracking protection has been enabled by default."); + is(Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled"), true, "Tracking protection has been enabled by default in private browsing mode."); + is(Services.prefs.prefIsLocked("privacy.trackingprotection.enabled"), false, "Tracking protection pref is not locked."); +}); + +add_task(async function test_policy_enable_tracking_protection_locked() { + await setupPolicyEngineWithJson({ + "policies": { + "EnableTrackingProtection": { + "Value": false, + "Locked": true + } + } + }); + + is(Services.prefs.getBoolPref("privacy.trackingprotection.enabled"), false, "Tracking protection has been disabled by default."); + is(Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled"), false, "Tracking protection has been disabled by default in private browsing mode."); + is(Services.prefs.prefIsLocked("privacy.trackingprotection.enabled"), true, "Tracking protection pref is locked."); + + Services.prefs.unlockPref("privacy.trackingprotection.enabled"); + Services.prefs.unlockPref("privacy.trackingprotection.pbmode.enabled"); +});
new file mode 100644 --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/disable_default_bookmarks/bookmarks_policies.json @@ -0,0 +1,5 @@ +{ + "policies": { + "NoDefaultBookmarks": true + } +}
copy from browser/components/enterprisepolicies/tests/browser/disable_developer_tools/browser.ini copy to browser/components/enterprisepolicies/tests/browser/disable_default_bookmarks/browser.ini --- a/browser/components/enterprisepolicies/tests/browser/disable_developer_tools/browser.ini +++ b/browser/components/enterprisepolicies/tests/browser/disable_default_bookmarks/browser.ini @@ -1,8 +1,8 @@ [DEFAULT] prefs = browser.policies.enabled=true - browser.policies.alternatePath='<test-root>/browser/components/enterprisepolicies/tests/browser/disable_developer_tools/config_disable_developer_tools.json' + browser.policies.alternatePath='<test-root>/browser/components/enterprisepolicies/tests/browser/disable_default_bookmarks/bookmarks_policies.json' support-files = - config_disable_developer_tools.json + bookmarks_policies.json -[browser_policy_disable_developer_tools.js] +[browser_policy_no_default_bookmarks.js]
new file mode 100644 --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/disable_default_bookmarks/browser_policy_no_default_bookmarks.js @@ -0,0 +1,20 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// This test must run in a separate folder because the +// No Default Bookmarks policy needs to be present on +// the first run of the profile, and not dinamically loaded +// like most of the policies tested in the main test folder. + +add_task(async function test_no_default_bookmarks() { + let firstBookmarkOnToolbar = + await PlacesUtils.bookmarks.fetch({parentGuid: PlacesUtils.bookmarks.toolbarGuid, index: 0}); + + let firstBookmarkOnMenu = + await PlacesUtils.bookmarks.fetch({parentGuid: PlacesUtils.bookmarks.menuGuid, index: 0}); + + is(firstBookmarkOnToolbar, null, "No bookmarks on toolbar"); + is(firstBookmarkOnMenu, null, "No bookmarks on menu"); +});
--- a/browser/components/enterprisepolicies/tests/moz.build +++ b/browser/components/enterprisepolicies/tests/moz.build @@ -5,14 +5,15 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. with Files("**"): BUG_COMPONENT = ("Firefox", "General") BROWSER_CHROME_MANIFESTS += [ 'browser/browser.ini', 'browser/disable_app_update/browser.ini', + 'browser/disable_default_bookmarks/browser.ini', 'browser/disable_developer_tools/browser.ini', ] TESTING_JS_MODULES += [ 'EnterprisePolicyTesting.jsm', ]
--- a/browser/components/extensions/ext-windows.js +++ b/browser/components/extensions/ext-windows.js @@ -175,24 +175,20 @@ this.windows = class extends ExtensionAP let win = windowManager.getWrapper(window); win.updateGeometry(createData); // TODO: focused, type return new Promise(resolve => { window.addEventListener("load", function() { - if (["maximized", "normal"].includes(createData.state)) { - window.document.documentElement.setAttribute("sizemode", createData.state); - } resolve(promiseObserved("browser-delayed-startup-finished", win => win == window)); }, {once: true}); }).then(() => { - // Some states only work after delayed-startup-finished - if (["minimized", "fullscreen", "docked"].includes(createData.state)) { + if (["minimized", "fullscreen", "docked", "normal", "maximized"].includes(createData.state)) { win.state = createData.state; } if (allowScriptsToClose) { for (let {linkedBrowser} of window.gBrowser.tabs) { onXULFrameLoaderCreated({target: linkedBrowser}); // eslint-disable-next-line mozilla/balanced-listeners linkedBrowser.addEventListener("XULFrameLoaderCreated", onXULFrameLoaderCreated); }
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js +++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js @@ -36,22 +36,20 @@ add_task(async function testBrowserActio // Tolerate if it is 1px too wide, as that may happen with the current resizing method. Assert.lessOrEqual(Math.abs(dims.window.innerWidth - expected), 1, `Panel window should be ${expected}px wide`); is(dims.body.clientWidth, dims.body.scrollWidth, "Panel body should be wide enough to fit its contents"); } - /* eslint-disable mozilla/no-cpows-in-tests */ function setSize(size) { content.document.body.style.height = `${size}px`; content.document.body.style.width = `${size}px`; } - /* eslint-enable mozilla/no-cpows-in-tests */ let sizes = [ 200, 400, 300, ]; for (let size of sizes) { @@ -110,18 +108,16 @@ async function testPopupSize(standardsMo <span></span> </body> </html>`, }, }); await extension.startup(); - /* eslint-disable mozilla/no-cpows-in-tests */ - if (arrowSide == "top") { // Test the standalone panel for a toolbar button. let browser = await openPanel(extension, browserWin, true); let dims = await promiseContentDimensions(browser); is(dims.isStandards, standardsMode, "Document has the expected compat mode");
--- a/browser/components/extensions/test/browser/browser_ext_find.js +++ b/browser/components/extensions/test/browser/browser_ext_find.js @@ -1,12 +1,11 @@ /* global browser */ "use strict"; -/* eslint-disable mozilla/no-cpows-in-tests */ function frameScript() { function getSelectedText() { let frame = this.content.frames[0].frames[1]; let docShell = frame.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShell); let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsISelectionDisplay) @@ -24,17 +23,16 @@ function frameScript() { let rect = { top: (r1.top + r2.top + r3.top + f1.y + f2.y), left: (r1.left + r2.left + r3.left + f1.x + f2.x), }; this.sendAsyncMessage("test:find:selectionTest", {text: selection.toString(), rect}); } getSelectedText(); } -/* eslint-enable mozilla/no-cpows-in-tests */ function waitForMessage(messageManager, topic) { return new Promise(resolve => { messageManager.addMessageListener(topic, function messageListener(message) { messageManager.removeMessageListener(topic, messageListener); resolve(message); }); });
--- a/browser/components/extensions/test/browser/browser_ext_omnibox.js +++ b/browser/components/extensions/test/browser/browser_ext_omnibox.js @@ -1,18 +1,12 @@ /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim: set sts=2 sw=2 et tw=80: */ "use strict"; -// The no-cpows-in-tests check isn't very smart, simply warning if it finds -// a variable named `content`. For Chrome compatibility, the Omnibox API uses -// that name for setting the text of a suggestion, and that's all this test uses -// it for, so we can disable it for this test. -/* eslint-disable mozilla/no-cpows-in-tests */ - add_task(async function() { let keyword = "test"; let extension = ExtensionTestUtils.loadExtension({ manifest: { "omnibox": { "keyword": keyword, },
--- a/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js +++ b/browser/components/extensions/test/browser/browser_ext_pageAction_popup_resize.js @@ -46,23 +46,21 @@ add_task(async function testPageActionPo "Panel root should be tall enough to fit its contents"); // Tolerate if it is 1px too wide, as that may happen with the current resizing method. ok(Math.abs(dims.window.innerWidth - expected) <= 1, `Panel window should be ${expected}px wide`); is(body.clientWidth, body.scrollWidth, "Panel body should be wide enough to fit its contents"); } - /* eslint-disable mozilla/no-cpows-in-tests */ function setSize(size) { let elem = content.document.body.firstChild; elem.style.height = `${size}px`; elem.style.width = `${size}px`; } - /* eslint-enable mozilla/no-cpows-in-tests */ let sizes = [ 200, 400, 300, ]; for (let size of sizes) { @@ -119,21 +117,19 @@ add_task(async function testPageActionPo await extension.startup(); await extension.awaitMessage("action-shown"); clickPageAction(extension, window); browser = await awaitExtensionPanel(extension); - /* eslint-disable mozilla/no-cpows-in-tests */ function setSize(size) { content.document.body.style.fontSize = `${size}px`; } - /* eslint-enable mozilla/no-cpows-in-tests */ let dims = await alterContent(browser, setSize, 18); is(dims.window.innerWidth, 800, "Panel window should be 800px wide"); is(dims.body.clientWidth, 800, "Panel body should be 800px wide"); is(dims.body.clientWidth, dims.body.scrollWidth, "Panel body should be wide enough to fit its contents");
--- a/browser/components/extensions/test/browser/browser_ext_popup_background.js +++ b/browser/components/extensions/test/browser/browser_ext_popup_background.js @@ -54,21 +54,19 @@ add_task(async function testPopupBackgro function getBackground(browser) { return ContentTask.spawn(browser, null, async function() { return content.getComputedStyle(content.document.body) .backgroundColor; }); } - /* eslint-disable mozilla/no-cpows-in-tests */ let setBackground = color => { content.document.body.style.backgroundColor = color; }; - /* eslint-enable mozilla/no-cpows-in-tests */ await new Promise(resolve => setTimeout(resolve, 100)); info("Test that initial background color is applied"); checkArrow(await getBackground(browser)); info("Test that dynamically-changed background color is applied");
--- a/browser/components/extensions/test/browser/browser_ext_popup_corners.js +++ b/browser/components/extensions/test/browser/browser_ext_popup_corners.js @@ -41,23 +41,21 @@ add_task(async function testPopupBorderR let stack = browser.parentNode; let viewNode = stack.parentNode === panel ? browser : stack.parentNode; let viewStyle = getComputedStyle(viewNode); let props = ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius"]; - /* eslint-disable mozilla/no-cpows-in-tests */ let bodyStyle = await ContentTask.spawn(browser, props, async function(props) { let bodyStyle = content.getComputedStyle(content.document.body); return new Map(props.map(prop => [prop, bodyStyle[prop]])); }); - /* eslint-enable mozilla/no-cpows-in-tests */ for (let prop of props) { if (standAlone) { is(viewStyle[prop], panelStyle[prop], `Panel and view ${prop} should be the same`); is(bodyStyle.get(prop), panelStyle[prop], `Panel and body ${prop} should be the same`); } else { is(viewStyle[prop], "0px", `View node ${prop} should be 0px`); is(bodyStyle.get(prop), "0px", `Body node ${prop} should be 0px`);
--- a/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget.js +++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget.js @@ -117,17 +117,17 @@ add_task(async function test_on_created_ info("Open a subframe link in a new tab using Ctrl-click"); await runCreatedNavigationTargetTest({ extension, openNavTarget() { BrowserTestUtils.synthesizeMouseAtCenter(function() { // This code runs as a framescript in the child process and it returns the // target link in the subframe. - return this.content.frames[0].document // eslint-disable-line mozilla/no-cpows-in-tests + return this.content.frames[0].document .querySelector("#test-create-new-tab-from-mouse-click-subframe"); }, {ctrlKey: true, metaKey: true}, tab.linkedBrowser); }, expectedWebNavProps: { sourceTabId: expectedSourceTab.sourceTabId, sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId, url: `${OPENED_PAGE}#new-tab-from-mouse-click-subframe`, }, @@ -136,17 +136,17 @@ add_task(async function test_on_created_ info("Open a subframe link in a new window using Shift-click"); await runCreatedNavigationTargetTest({ extension, openNavTarget() { BrowserTestUtils.synthesizeMouseAtCenter(function() { // This code runs as a framescript in the child process and it returns the // target link in the subframe. - return this.content.frames[0].document // eslint-disable-line mozilla/no-cpows-in-tests + return this.content.frames[0].document .querySelector("#test-create-new-window-from-mouse-click-subframe"); }, {shiftKey: true}, tab.linkedBrowser); }, expectedWebNavProps: { sourceTabId: expectedSourceTab.sourceTabId, sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId, url: `${OPENED_PAGE}#new-window-from-mouse-click-subframe`, }, @@ -155,17 +155,17 @@ add_task(async function test_on_created_ info("Open a subframe link with target=\"_blank\" in a new tab using click"); await runCreatedNavigationTargetTest({ extension, openNavTarget() { BrowserTestUtils.synthesizeMouseAtCenter(function() { // This code runs as a framescript in the child process and it returns the // target link in the subframe. - return this.content.frames[0].document // eslint-disable-line mozilla/no-cpows-in-tests + return this.content.frames[0].document .querySelector("#test-create-new-tab-from-targetblank-click-subframe"); }, {}, tab.linkedBrowser); }, expectedWebNavProps: { sourceTabId: expectedSourceTab.sourceTabId, sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId, url: `${OPENED_PAGE}#new-tab-from-targetblank-click-subframe`, },
--- a/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget_contextmenu.js +++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_onCreatedNavigationTarget_contextmenu.js @@ -112,17 +112,17 @@ add_task(async function test_on_created_ await runCreatedNavigationTargetTest({ extension, async openNavTarget() { await clickContextMenuItem({ pageElementSelector: function() { // This code runs as a framescript in the child process and it returns the // target link in the subframe. - return this.content.frames[0] // eslint-disable-line mozilla/no-cpows-in-tests + return this.content.frames[0] .document.querySelector("#test-create-new-tab-from-context-menu-subframe"); }, contextMenuItemLabel: "Open Link in New Tab", }); }, expectedWebNavProps: { sourceTabId: expectedSourceTab.sourceTabId, sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId, @@ -134,17 +134,17 @@ add_task(async function test_on_created_ await runCreatedNavigationTargetTest({ extension, async openNavTarget() { await clickContextMenuItem({ pageElementSelector: function() { // This code runs as a framescript in the child process and it returns the // target link in the subframe. - return this.content.frames[0] // eslint-disable-line mozilla/no-cpows-in-tests + return this.content.frames[0] .document.querySelector("#test-create-new-window-from-context-menu-subframe"); }, contextMenuItemLabel: "Open Link in New Window", }); }, expectedWebNavProps: { sourceTabId: expectedSourceTab.sourceTabId, sourceFrameId: expectedSourceTab.sourceTabFrames[1].frameId,
--- a/browser/components/extensions/test/browser/browser_ext_windows_create.js +++ b/browser/components/extensions/test/browser/browser_ext_windows_create.js @@ -98,17 +98,17 @@ add_task(async function testWindowCreate extension.onMessage("check-window", expected => { if (expected.state != null) { let {windowState} = latestWindow; if (latestWindow.fullScreen) { windowState = latestWindow.STATE_FULLSCREEN; } - if (expected.state == "STATE_NORMAL" && AppConstants.platform == "macosx") { + if (expected.state == "STATE_NORMAL") { ok(windowState == window.STATE_NORMAL || windowState == window.STATE_MAXIMIZED, `Expected windowState (currently ${windowState}) to be STATE_NORMAL but will accept STATE_MAXIMIZED`); } else { is(windowState, window[expected.state], `Expected window state to be ${expected.state}`); } } if (expected.hiddenChrome) {
--- a/browser/components/migration/MigrationUtils.jsm +++ b/browser/components/migration/MigrationUtils.jsm @@ -355,17 +355,18 @@ var MigratorPrototype = { } await completeDeferred.promise; await unblockMainThread(); } } }; - if (MigrationUtils.isStartupMigration && !this.startupOnlyMigrator) { + if (MigrationUtils.isStartupMigration && !this.startupOnlyMigrator && + Services.policies.isAllowed("defaultBookmarks")) { MigrationUtils.profileStartup.doStartup(); // First import the default bookmarks. // Note: We do not need to do so for the Firefox migrator // (=startupOnlyMigrator), as it just copies over the places database // from another profile. (async function() { // Tell nsBrowserGlue we're importing default bookmarks. let browserGlue = Cc["@mozilla.org/browser/browserglue;1"].
--- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -1647,20 +1647,22 @@ BrowserGlue.prototype = { bookmarksUrl = "chrome://browser/locale/bookmarks.html"; } else if (await OS.File.exists(BookmarkHTMLUtils.defaultPath)) { bookmarksUrl = OS.Path.toFileURI(BookmarkHTMLUtils.defaultPath); } if (bookmarksUrl) { // Import from bookmarks.html file. try { - await BookmarkHTMLUtils.importFromURL(bookmarksUrl, { - replace: true, - source: PlacesUtils.bookmarks.SOURCES.RESTORE_ON_STARTUP, - }); + if (Services.policies.isAllowed("defaultBookmarks")) { + await BookmarkHTMLUtils.importFromURL(bookmarksUrl, { + replace: true, + source: PlacesUtils.bookmarks.SOURCES.RESTORE_ON_STARTUP, + }); + } } catch (e) { Cu.reportError("Bookmarks.html file could be corrupt. " + e); } try { // Now apply distribution customized bookmarks. // This should always run after Places initialization. await this._distributionCustomizer.applyBookmarks(); // Ensure that smart bookmarks are created once the operation is @@ -2304,16 +2306,17 @@ BrowserGlue.prototype = { // TODO bug 399268: should this be a pref? const MAX_RESULTS = 10; // Get current smart bookmarks version. If not set, create them. let smartBookmarksCurrentVersion = Services.prefs.getIntPref(SMART_BOOKMARKS_PREF, 0); // If version is current, or smart bookmarks are disabled, bail out. if (smartBookmarksCurrentVersion == -1 || + !Services.policies.isAllowed("defaultBookmarks") || smartBookmarksCurrentVersion >= SMART_BOOKMARKS_VERSION) { return; } try { let menuIndex = 0; let toolbarIndex = 0; let bundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
--- a/browser/components/preferences/in-content/tests/browser_advanced_update.js +++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js @@ -106,17 +106,16 @@ add_task(async function() { gBrowser.removeCurrentTab(); }); add_task(async function() { await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true }); let doc = gBrowser.selectedBrowser.contentDocument; let showBtn = doc.getElementById("showUpdateHistory"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let dialogOverlay = content.gSubDialog._preloadDialog._overlay; // XXX: For unknown reasons, this mock cannot be loaded by // XPCOMUtils.defineLazyServiceGetter() called in aboutDialog-appUpdater.js. // It is registered here so that we could assert update history subdialog // without stopping the preferences advanced pane from loading. // See bug 1361929. mockUpdateManager.register();
--- a/browser/components/preferences/in-content/tests/browser_applications_selection.js +++ b/browser/components/preferences/in-content/tests/browser_applications_selection.js @@ -3,27 +3,25 @@ var feedItem; var container; SimpleTest.requestCompleteLog(); add_task(async function setup() { await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true }); info("Preferences page opened on the general pane."); - // eslint-disable-next-line mozilla/no-cpows-in-tests await gBrowser.selectedBrowser.contentWindow.promiseLoadHandlersList; info("Apps list loaded."); registerCleanupFunction(() => { gBrowser.removeCurrentTab(); }); }); add_task(async function getFeedItem() { - // eslint-disable-next-line mozilla/no-cpows-in-tests win = gBrowser.selectedBrowser.contentWindow; container = win.document.getElementById("handlersView"); feedItem = container.querySelector("richlistitem[type='application/vnd.mozilla.maybe.feed']"); Assert.ok(feedItem, "feedItem is present in handlersView."); }); add_task(async function selectInternalOptionForFeed() { @@ -79,17 +77,16 @@ add_task(async function reselectInternal Assert.ok(list.selectedItem, "Should have a selected item"); Assert.equal(list.selectedItem.getAttribute("action"), Ci.nsIHandlerInfo.handleInternally, "Selected item should still be the same as the previously selected item."); }); add_task(async function sortingCheck() { - // eslint-disable-next-line mozilla/no-cpows-in-tests win = gBrowser.selectedBrowser.contentWindow; const handlerView = win.document.getElementById("handlersView"); const typeColumn = win.document.getElementById("typeColumn"); Assert.ok(typeColumn, "typeColumn is present in handlersView."); // Test default sorting assertSortByType("ascending");
--- a/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js +++ b/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js @@ -1,21 +1,18 @@ Services.prefs.setBoolPref("browser.preferences.instantApply", true); registerCleanupFunction(function() { Services.prefs.clearUserPref("browser.preferences.instantApply"); }); add_task(async function() { await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true }); - // eslint-disable-next-line mozilla/no-cpows-in-tests await gBrowser.contentWindow.gMainPane._selectDefaultLanguageGroupPromise; - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; - // eslint-disable-next-line mozilla/no-cpows-in-tests let contentWindow = gBrowser.contentWindow; var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data; is(contentWindow.Preferences.get("font.language.group").value, langGroup, "Language group should be set correctly."); let defaultFontType = Services.prefs.getCharPref("font.default." + langGroup); let fontFamilyPref = "font.name." + defaultFontType + "." + langGroup; let fontFamily = Services.prefs.getCharPref(fontFamilyPref);
--- a/browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js +++ b/browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js @@ -8,18 +8,16 @@ registerCleanupFunction(function() { gBrowser.removeTab(gBrowser.tabs[1]); }); add_task(async function() { originalWindowHeight = window.outerHeight; window.resizeTo(window.outerWidth, 300); let prefs = await openPreferencesViaOpenPreferencesAPI("paneSearch", {leaveOpen: true}); is(prefs.selectedPane, "paneSearch", "Search pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let mainContent = gBrowser.contentDocument.querySelector(".main-content"); mainContent.scrollTop = 50; is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels"); - // eslint-disable-next-line mozilla/no-cpows-in-tests gBrowser.contentWindow.gotoPref("paneGeneral"); is(mainContent.scrollTop, 0, "Switching to a different category should reset the scroll position"); });
--- a/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js +++ b/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js @@ -1,13 +1,11 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* eslint-disable mozilla/no-cpows-in-tests */ - Services.prefs.setBoolPref("browser.preferences.instantApply", true); registerCleanupFunction(function() { Services.prefs.clearUserPref("browser.preferences.instantApply"); }); // Test opening to the differerent panes and subcategories in Preferences add_task(async function() {
--- a/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js +++ b/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js @@ -4,17 +4,16 @@ const {Utils} = ChromeUtils.import("reso const triggeringPrincipal_base64 = Utils.SERIALIZED_SYSTEMPRINCIPAL; add_task(async function() { waitForExplicitFinish(); const tabURL = getRootDirectory(gTestPath) + "browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul"; await BrowserTestUtils.withNewTab({ gBrowser, url: tabURL }, async function(browser) { - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; let container = doc.getElementById("container"); // Test button let button = doc.getElementById("button"); button.focus(); EventUtils.sendString(" "); await checkPageScrolling(container, "button"); @@ -37,17 +36,16 @@ add_task(async function() { // Test radio let radiogroup = doc.getElementById("radiogroup"); radiogroup.focus(); EventUtils.sendString(" "); await checkPageScrolling(container, "radio"); }); await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, async function(browser) { - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; let container = doc.getElementsByClassName("main-content")[0]; // Test search let engineList = doc.getElementById("engineList"); engineList.focus(); EventUtils.sendString(" "); is(engineList.view.selection.currentIndex, 0, "Search engineList is selected");
--- a/browser/components/preferences/in-content/tests/browser_bug410900.js +++ b/browser/components/preferences/in-content/tests/browser_bug410900.js @@ -17,21 +17,19 @@ function test() { getService(Ci.nsIExternalProtocolService); var info = extps.getProtocolHandlerInfo("apppanetest"); info.possibleApplicationHandlers.appendElement(handler); var hserv = Cc["@mozilla.org/uriloader/handler-service;1"]. getService(Ci.nsIHandlerService); hserv.store(info); - /* eslint-disable mozilla/no-cpows-in-tests */ openPreferencesViaOpenPreferencesAPI("general", {leaveOpen: true}) .then(() => gBrowser.selectedBrowser.contentWindow.promiseLoadHandlersList) .then(() => runTest(gBrowser.selectedBrowser.contentWindow)); - /* eslint-enable mozilla/no-cpows-in-tests */ } function runTest(win) { var rbox = win.document.getElementById("handlersView"); ok(rbox, "handlersView is present"); var items = rbox && rbox.getElementsByTagName("richlistitem"); ok(items && items.length > 0, "App handler list populated");
--- a/browser/components/preferences/in-content/tests/browser_change_app_handler.js +++ b/browser/components/preferences/in-content/tests/browser_change_app_handler.js @@ -14,17 +14,16 @@ function setupFakeHandler() { gHandlerSvc.store(infoToModify); } add_task(async function() { setupFakeHandler(); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let win = gBrowser.selectedBrowser.contentWindow; let container = win.document.getElementById("handlersView"); let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']"); ok(ourItem, "handlersView is present"); ourItem.scrollIntoView(); container.selectItem(ourItem); ok(ourItem.selected, "Should be able to select our item.");
--- a/browser/components/preferences/in-content/tests/browser_checkspelling.js +++ b/browser/components/preferences/in-content/tests/browser_checkspelling.js @@ -1,17 +1,16 @@ add_task(async function() { SpecialPowers.pushPrefEnv({set: [ ["layout.spellcheckDefault", 2] ]}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let checkbox = doc.querySelector("#checkSpelling"); is(checkbox.checked, Services.prefs.getIntPref("layout.spellcheckDefault") == 2, "checkbox should represent pref value before clicking on checkbox"); ok(checkbox.checked, "checkbox should be checked before clicking on checkbox"); checkbox.click();
--- a/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js +++ b/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js @@ -233,17 +233,16 @@ add_task(async function testSort() { async function runTest(test, observances) { registerCleanupFunction(function() { Services.prefs.clearUserPref("privacy.history.custom"); }); await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let historyMode = doc.getElementById("historyMode"); historyMode.value = "custom"; historyMode.doCommand(); let promiseSubDialogLoaded = promiseLoadSubDialog("chrome://browser/content/preferences/permissions.xul"); doc.getElementById("cookieExceptions").doCommand();
--- a/browser/components/preferences/in-content/tests/browser_engines.js +++ b/browser/components/preferences/in-content/tests/browser_engines.js @@ -1,13 +1,12 @@ // Test Engine list add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("search", {leaveOpen: true}); is(prefs.selectedPane, "paneSearch", "Search pane is selected by default"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let tree = doc.querySelector("#engineList"); ok(!tree.hidden, "The search engine list should be visible when Search is requested"); // Check for default search engines to be displayed in the engineList let defaultEngines = Services.search.getDefaultEngines(); for (let i = 0; i < defaultEngines.length; i++) {
--- a/browser/components/preferences/in-content/tests/browser_extension_controlled.js +++ b/browser/components/preferences/in-content/tests/browser_extension_controlled.js @@ -50,17 +50,16 @@ function waitForMutation(target, opts, c observer.observe(target, opts); }); } function waitForMessageChange(element, cb, opts = { attributes: true, attributeFilter: ["hidden"] }) { return waitForMutation(element, opts, cb); } -// eslint-disable-next-line mozilla/no-cpows-in-tests function getElement(id, doc = gBrowser.contentDocument) { return doc.getElementById(id); } function waitForMessageHidden(messageId, doc) { return waitForMessageChange(getElement(messageId, doc), target => target.hidden); } @@ -79,17 +78,16 @@ function waitForMessageContent(messageId return waitForMessageChange( getElement(messageId, doc), target => target.textContent === content, { childList: true }); } add_task(async function testExtensionControlledHomepage() { await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; is(gBrowser.currentURI.spec, "about:preferences#general", "#general should be in the URI for about:preferences"); let homepagePref = () => Services.prefs.getCharPref("browser.startup.homepage"); let originalHomepagePref = homepagePref(); let extensionHomepage = "https://developer.mozilla.org/"; let controlledContent = doc.getElementById("browserHomePageExtensionContent"); @@ -139,17 +137,16 @@ add_task(async function testExtensionCon await waitForMessageShown("browserHomePageExtensionContent"); // Do the uninstall now that the enable code has been run. addon.uninstall(); await BrowserTestUtils.removeTab(gBrowser.selectedTab); }); add_task(async function testPrefLockedHomepage() { await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; is(gBrowser.currentURI.spec, "about:preferences#general", "#general should be in the URI for about:preferences"); let homePagePref = "browser.startup.homepage"; let buttonPrefs = [ "pref.browser.homepage.disable_button.current_page", "pref.browser.homepage.disable_button.bookmark_page", @@ -271,17 +268,16 @@ add_task(async function testPrefLockedHo is(controlledContent.hidden, true, "The extension controlled message is hidden when unlocked with no extension"); await BrowserTestUtils.removeTab(gBrowser.selectedTab); }); add_task(async function testExtensionControlledNewTab() { await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; is(gBrowser.currentURI.spec, "about:preferences#general", "#general should be in the URI for about:preferences"); let controlledContent = doc.getElementById("browserNewTabExtensionContent"); // The new tab is set to the default and message is hidden. ok(!aboutNewTabService.newTabURL.startsWith("moz-extension:"), "new tab is not set"); @@ -321,17 +317,16 @@ add_task(async function testExtensionCon // Cleanup the tab and add-on. await BrowserTestUtils.removeTab(gBrowser.selectedTab); let addon = await AddonManager.getAddonByID("@set_newtab"); addon.uninstall(); }); add_task(async function testExtensionControlledDefaultSearch() { await openPreferencesViaOpenPreferencesAPI("paneSearch", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let extensionId = "@set_default_search"; let manifest = { manifest_version: 2, name: "set_default_search", applications: {gecko: {id: extensionId}}, description: "set_default_search description", permissions: [], @@ -417,17 +412,16 @@ add_task(async function testExtensionCon await originalExtension.unload(); await updatedExtension.unload(); await BrowserTestUtils.removeTab(gBrowser.selectedTab); }); add_task(async function testExtensionControlledHomepageUninstalledAddon() { async function checkHomepageEnabled() { await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; is(gBrowser.currentURI.spec, "about:preferences#general", "#general should be in the URI for about:preferences"); let controlledContent = doc.getElementById("browserHomePageExtensionContent"); // The homepage is enabled. let homepageInut = doc.getElementById("browserHomePage"); is(homepageInut.disabled, false, "The homepage input is enabled"); @@ -561,17 +555,16 @@ add_task(async function testExtensionCon let controlledMessageShown = waitForMessageShown(CONTROLLED_LABEL_ID[uiType]); addon.userDisabled = false; await controlledMessageShown; } let uiType = "new"; await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; is(gBrowser.currentURI.spec, "about:preferences#privacy", "#privacy should be in the URI for about:preferences"); let controlledButton = doc.getElementById(CONTROLLED_BUTTON_ID); verifyState(false); @@ -740,17 +733,16 @@ add_task(async function testExtensionCon async function closeProxyPanel(panelObj) { panelObj.panel.document.documentElement.cancelDialog(); let panelClosingEvent = await panelObj.closingPromise; ok(panelClosingEvent, "Proxy panel closed."); } await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let mainDoc = gBrowser.contentDocument; is(gBrowser.currentURI.spec, "about:preferences#general", "#general should be in the URI for about:preferences"); verifyState(mainDoc, false); // Open the connections panel.
--- a/browser/components/preferences/in-content/tests/browser_fluent.js +++ b/browser/components/preferences/in-content/tests/browser_fluent.js @@ -1,9 +1,8 @@ -/* eslint-disable mozilla/no-cpows-in-tests */ function whenMainPaneLoadedFinished() { return new Promise(function(resolve, reject) { const topic = "main-pane-loaded"; Services.obs.addObserver(function observer(aSubject) { Services.obs.removeObserver(observer, topic); resolve(); }, topic);
--- a/browser/components/preferences/in-content/tests/browser_homepages_filter_aboutpreferences.js +++ b/browser/components/preferences/in-content/tests/browser_homepages_filter_aboutpreferences.js @@ -1,13 +1,12 @@ add_task(async function testSetHomepageUseCurrent() { is(gBrowser.currentURI.spec, "about:blank", "Test starts with about:blank open"); await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home"); await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; is(gBrowser.currentURI.spec, "about:preferences#general", "#general should be in the URI for about:preferences"); let oldHomepagePref = Services.prefs.getCharPref("browser.startup.homepage"); let useCurrent = doc.getElementById("useCurrent"); useCurrent.click();
--- a/browser/components/preferences/in-content/tests/browser_languages_subdialog.js +++ b/browser/components/preferences/in-content/tests/browser_languages_subdialog.js @@ -1,13 +1,11 @@ add_task(async function() { await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true }); - // eslint-disable-next-line mozilla/no-cpows-in-tests const contentDocument = gBrowser.contentDocument; - // eslint-disable-next-line mozilla/no-cpows-in-tests const dialogOverlay = content.gSubDialog._preloadDialog._overlay; async function languagesSubdialogOpened() { const promiseSubDialogLoaded = promiseLoadSubDialog("chrome://browser/content/preferences/languages.xul"); contentDocument.getElementById("chooseLanguage").click(); const win = await promiseSubDialogLoaded; win.Preferences.forceEnableInstantApply(); is(dialogOverlay.style.visibility, "visible", "The dialog is visible.");
--- a/browser/components/preferences/in-content/tests/browser_layersacceleration.js +++ b/browser/components/preferences/in-content/tests/browser_layersacceleration.js @@ -2,17 +2,16 @@ add_task(async function() { SpecialPowers.pushPrefEnv({set: [ ["gfx.direct2d.disabled", false], ["layers.acceleration.disabled", false] ]}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let checkbox = doc.querySelector("#allowHWAccel"); is(!checkbox.checked, Services.prefs.getBoolPref("layers.acceleration.disabled"), "checkbox should represent inverted pref value before clicking on checkbox"); checkbox.click();
--- a/browser/components/preferences/in-content/tests/browser_masterpassword.js +++ b/browser/components/preferences/in-content/tests/browser_masterpassword.js @@ -1,13 +1,12 @@ add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true}); is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; // Fake the subdialog and LoginHelper let win = doc.defaultView; let dialogURL = ""; win.gSubDialog = { open(aDialogURL, unused, unused2, aCallback) { dialogURL = aDialogURL; masterPasswordSet = masterPasswordNextState;
--- a/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js +++ b/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js @@ -6,17 +6,16 @@ registerCleanupFunction(function() { while (gBrowser.tabs[1]) gBrowser.removeTab(gBrowser.tabs[1]); }); add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true}); is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let notificationsDoNotDisturbBox = doc.getElementById("notificationsDoNotDisturbBox"); if (notificationsDoNotDisturbBox.hidden) { todo(false, "Do not disturb is not available on this platform"); return; } let alertService;
--- a/browser/components/preferences/in-content/tests/browser_password_management.js +++ b/browser/components/preferences/in-content/tests/browser_password_management.js @@ -61,12 +61,11 @@ add_task(async function test_deletePassw if (AppConstants.platform == "macosx") { EventUtils.synthesizeKey("KEY_Backspace"); } else { EventUtils.synthesizeKey("KEY_Delete"); } await TestUtils.waitForCondition(() => tree.view.rowCount == 0); - // eslint-disable-next-line mozilla/no-cpows-in-tests is_element_visible(content.gSubDialog._dialogs[0]._box, "Subdialog is visible after deleting an element"); });
--- a/browser/components/preferences/in-content/tests/browser_performance.js +++ b/browser/components/preferences/in-content/tests/browser_performance.js @@ -8,17 +8,16 @@ add_task(async function() { ["browser.preferences.defaultPerformanceSettings.enabled", true], ]}); }); add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings"); is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true, "pref value should be true before clicking on checkbox"); ok(useRecommendedPerformanceSettings.checked, "checkbox should be checked before clicking on checkbox"); useRecommendedPerformanceSettings.click(); @@ -74,17 +73,16 @@ add_task(async function() { Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); await BrowserTestUtils.removeTab(gBrowser.selectedTab); }); add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings"); let allowHWAccel = doc.querySelector("#allowHWAccel"); let contentProcessCount = doc.querySelector("#contentProcessCount"); let performanceSettings = doc.querySelector("#performanceSettings"); useRecommendedPerformanceSettings.click(); allowHWAccel.click(); @@ -100,17 +98,16 @@ add_task(async function() { Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); await BrowserTestUtils.removeTab(gBrowser.selectedTab); }); add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let performanceSettings = doc.querySelector("#performanceSettings"); is(performanceSettings.hidden, true, "performance settings section should not be shown"); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false); is(performanceSettings.hidden, false, "performance settings section should be shown"); @@ -120,17 +117,16 @@ add_task(async function() { }); add_task(async function() { Services.prefs.setIntPref("dom.ipc.processCount", 7); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let performanceSettings = doc.querySelector("#performanceSettings"); is(performanceSettings.hidden, false, "performance settings section should be shown"); let contentProcessCount = doc.querySelector("#contentProcessCount"); is(Services.prefs.getIntPref("dom.ipc.processCount"), 7, "pref value should be 7"); is(contentProcessCount.selectedItem.value, 7, "selected item should be 7"); @@ -140,17 +136,16 @@ add_task(async function() { }); add_task(async function() { Services.prefs.setBoolPref("layers.acceleration.disabled", true); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let performanceSettings = doc.querySelector("#performanceSettings"); is(performanceSettings.hidden, false, "performance settings section should be shown"); let allowHWAccel = doc.querySelector("#allowHWAccel"); is(Services.prefs.getBoolPref("layers.acceleration.disabled"), true, "pref value is false");
--- a/browser/components/preferences/in-content/tests/browser_performance_e10srollout.js +++ b/browser/components/preferences/in-content/tests/browser_performance_e10srollout.js @@ -11,17 +11,16 @@ add_task(async function() { add_task(async function testPrefsAreDefault() { Services.prefs.setIntPref("dom.ipc.processCount", DEFAULT_PROCESS_COUNT); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings"); is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true, "pref value should be true before clicking on checkbox"); ok(useRecommendedPerformanceSettings.checked, "checkbox should be checked before clicking on checkbox"); useRecommendedPerformanceSettings.click(); @@ -46,17 +45,16 @@ add_task(async function testPrefsAreDefa add_task(async function testPrefsSetByUser() { Services.prefs.setIntPref("dom.ipc.processCount", DEFAULT_PROCESS_COUNT + 2); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let performanceSettings = doc.querySelector("#performanceSettings"); is(performanceSettings.hidden, false, "performance settings section is shown"); let contentProcessCount = doc.querySelector("#contentProcessCount"); is(contentProcessCount.disabled, false, "process count control should be enabled"); is(Services.prefs.getIntPref("dom.ipc.processCount"), DEFAULT_PROCESS_COUNT + 2, "process count should be the set value"); is(contentProcessCount.selectedItem.value, DEFAULT_PROCESS_COUNT + 2, "selected item should be the set one");
--- a/browser/components/preferences/in-content/tests/browser_performance_non_e10s.js +++ b/browser/components/preferences/in-content/tests/browser_performance_non_e10s.js @@ -8,17 +8,16 @@ add_task(async function() { ["browser.preferences.defaultPerformanceSettings.enabled", true], ]}); }); add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings"); is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true, "pref value should be true before clicking on checkbox"); ok(useRecommendedPerformanceSettings.checked, "checkbox should be checked before clicking on checkbox"); useRecommendedPerformanceSettings.click(); @@ -62,17 +61,16 @@ add_task(async function() { Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); await BrowserTestUtils.removeTab(gBrowser.selectedTab); }); add_task(async function() { let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let performanceSettings = doc.querySelector("#performanceSettings"); is(performanceSettings.hidden, true, "performance settings section should not be shown"); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", false); is(performanceSettings.hidden, false, "performance settings section should be shown"); @@ -82,17 +80,16 @@ add_task(async function() { }); add_task(async function() { Services.prefs.setBoolPref("layers.acceleration.disabled", true); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); is(prefs.selectedPane, "paneGeneral", "General pane was selected"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocument; let performanceSettings = doc.querySelector("#performanceSettings"); is(performanceSettings.hidden, false, "performance settings section should be shown"); let allowHWAccel = doc.querySelector("#allowHWAccel"); is(Services.prefs.getBoolPref("layers.acceleration.disabled"), true, "pref value is false");
--- a/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js +++ b/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js @@ -1,15 +1,14 @@ "use strict"; const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul"; add_task(async function urlFieldVisibleForPopupPermissions(finish) { await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true}); - // eslint-disable-next-line mozilla/no-cpows-in-tests let win = gBrowser.selectedBrowser.contentWindow; let doc = win.document; let popupPolicyCheckbox = doc.getElementById("popupPolicy"); ok(!popupPolicyCheckbox.checked, "popupPolicyCheckbox should be unchecked by default"); popupPolicyCheckbox.click(); let popupPolicyButton = doc.getElementById("popupPolicyButton"); ok(popupPolicyButton, "popupPolicyButton found"); let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
--- a/browser/components/preferences/in-content/tests/browser_privacypane.js +++ b/browser/components/preferences/in-content/tests/browser_privacypane.js @@ -1,13 +1,11 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* eslint-disable mozilla/no-cpows-in-tests */ - // Test the initial value of Browser Error collection checkbox add_task(async function testBrowserErrorInitialValue() { // Skip if non-Nightly since the checkbox will be missing. if (!AppConstants.NIGHTLY_BUILD) { return; } await SpecialPowers.pushPrefEnv({
--- a/browser/components/preferences/in-content/tests/browser_sanitizeOnShutdown_prefLocked.js +++ b/browser/components/preferences/in-content/tests/browser_sanitizeOnShutdown_prefLocked.js @@ -3,17 +3,16 @@ function switchToCustomHistoryMode(doc) { // Select the last item in the menulist. let menulist = doc.getElementById("historyMode"); menulist.focus(); EventUtils.sendKey("UP"); } function testPrefStateMatchesLockedState() { - // eslint-disable-next-line mozilla/no-cpows-in-tests let win = gBrowser.contentWindow; let doc = win.document; switchToCustomHistoryMode(doc); let checkbox = doc.getElementById("alwaysClear"); let preference = win.Preferences.get("privacy.sanitize.sanitizeOnShutdown"); is(checkbox.disabled, preference.locked, "Always Clear checkbox should be enabled when preference is not locked.");
--- a/browser/components/preferences/in-content/tests/browser_search_within_preferences_1.js +++ b/browser/components/preferences/in-content/tests/browser_search_within_preferences_1.js @@ -1,15 +1,13 @@ "use strict"; /** * This file contains tests for the Preferences search bar. */ -/* eslint-disable mozilla/no-cpows-in-tests */ - requestLongerTimeout(6); /** * Tests to see if search bar is being shown when pref is turned on */ add_task(async function() { await openPreferencesViaOpenPreferencesAPI("paneGeneral", { leaveOpen: true }); let searchInput = gBrowser.contentDocument.getElementById("searchInput");
--- a/browser/components/preferences/in-content/tests/browser_search_within_preferences_2.js +++ b/browser/components/preferences/in-content/tests/browser_search_within_preferences_2.js @@ -1,15 +1,13 @@ "use strict"; /** * This file contains tests for the Preferences search bar. */ -/* eslint-disable mozilla/no-cpows-in-tests */ - /** * Enabling searching functionality. Will display search bar from this testcase forward. */ add_task(async function() { await SpecialPowers.pushPrefEnv({"set": [["browser.preferences.search", true]]}); }); /**
--- a/browser/components/preferences/in-content/tests/browser_search_within_preferences_command.js +++ b/browser/components/preferences/in-content/tests/browser_search_within_preferences_command.js @@ -1,12 +1,10 @@ "use strict"; -/* eslint-disable mozilla/no-cpows-in-tests */ - /** * Test for "command" event on search input (when user clicks the x button) */ add_task(async function() { await SpecialPowers.pushPrefEnv({"set": [["browser.storageManager.enabled", false]]}); await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true}); let generalPane = gBrowser.contentDocument.getElementById("generalCategory");
--- a/browser/components/preferences/in-content/tests/browser_security-1.js +++ b/browser/components/preferences/in-content/tests/browser_security-1.js @@ -43,17 +43,16 @@ add_task(async function() { is(blockDownloads.hasAttribute("disabled"), !checked, "block downloads checkbox is set correctly"); is(checked, val1 && val2, "safebrowsing preference is initialized correctly"); // should be disabled when checked is false (= pref is turned off) is(blockUncommon.hasAttribute("disabled"), !checked, "block uncommon checkbox is set correctly"); // scroll the checkbox into the viewport and click checkbox checkbox.scrollIntoView(); - // eslint-disable-next-line mozilla/no-cpows-in-tests EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow); // check that both settings are now turned on or off is(Services.prefs.getBoolPref("browser.safebrowsing.phishing.enabled"), !checked, "safebrowsing.enabled is set correctly"); is(Services.prefs.getBoolPref("browser.safebrowsing.malware.enabled"), !checked, "safebrowsing.malware.enabled is set correctly");
--- a/browser/components/preferences/in-content/tests/browser_security-2.js +++ b/browser/components/preferences/in-content/tests/browser_security-2.js @@ -40,17 +40,16 @@ add_task(async function() { let blockUncommon = doc.getElementById("blockUncommonUnwanted"); let checked = checkbox.checked; is(checked, val, "downloads preference is initialized correctly"); // should be disabled when val is false (= pref is turned off) is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly"); // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it checkbox.scrollIntoView(); - // eslint-disable-next-line mozilla/no-cpows-in-tests EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow); // check that setting is now turned on or off is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.enabled"), !checked, "safebrowsing.downloads preference is set correctly"); // check if the uncommon warning checkbox has updated is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly"); @@ -80,17 +79,16 @@ add_task(async function() { let doc = gBrowser.selectedBrowser.contentDocument; let checkbox = doc.getElementById("blockUncommonUnwanted"); let checked = checkbox.checked; is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly"); // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it checkbox.scrollIntoView(); - // eslint-disable-next-line mozilla/no-cpows-in-tests EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow); // check that both settings are now turned on or off is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted"), !checked, "block_potentially_unwanted is set correctly"); is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_uncommon"), !checked, "block_uncommon is set correctly");
--- a/browser/components/preferences/in-content/tests/browser_site_login_exceptions.js +++ b/browser/components/preferences/in-content/tests/browser_site_login_exceptions.js @@ -66,12 +66,11 @@ add_task(async function deleteALoginExce if (AppConstants.platform == "macosx") { EventUtils.synthesizeKey("KEY_Backspace"); } else { EventUtils.synthesizeKey("KEY_Delete"); } await TestUtils.waitForCondition(() => tree.view.rowCount == 0); - // eslint-disable-next-line mozilla/no-cpows-in-tests is_element_visible(content.gSubDialog._dialogs[0]._box, "Subdialog is visible after deleting an element"); });
--- a/browser/components/preferences/in-content/tests/browser_spotlight.js +++ b/browser/components/preferences/in-content/tests/browser_spotlight.js @@ -1,9 +1,8 @@ -/* eslint-disable mozilla/no-cpows-in-tests */ add_task(async function test_reports_section() { let prefs = await openPreferencesViaOpenPreferencesAPI("privacy-reports", {leaveOpen: true}); is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected by default"); let doc = gBrowser.contentDocument; is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI"); await TestUtils.waitForCondition(() => doc.querySelector(".spotlight"), "Wait for the reports section is spotlighted.");
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js +++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js @@ -180,17 +180,16 @@ add_task(async function check_reopening_ await close_subdialog_and_test_generic_end_state(tab.linkedBrowser, function() { content.window.gSubDialog._topDialog._frame.contentDocument.documentElement.acceptDialog(); }, "accept", 1); }); add_task(async function check_opening_while_closing() { await open_subdialog_and_test_generic_start_state(tab.linkedBrowser); info("closing"); - // eslint-disable-next-line mozilla/no-cpows-in-tests content.window.gSubDialog._topDialog.close(); info("reopening immediately after calling .close()"); await open_subdialog_and_test_generic_start_state(tab.linkedBrowser); await close_subdialog_and_test_generic_end_state(tab.linkedBrowser, function() { content.window.gSubDialog._topDialog._frame.contentDocument.documentElement.acceptDialog(); }, "accept", 1); });
--- a/browser/components/preferences/in-content/tests/siteData/browser_siteData.js +++ b/browser/components/preferences/in-content/tests/siteData/browser_siteData.js @@ -21,17 +21,16 @@ add_task(async function() { await BrowserTestUtils.waitForContentEvent( gBrowser.selectedBrowser, "test-indexedDB-done", false, null, true); await BrowserTestUtils.removeTab(gBrowser.selectedTab); let updatedPromise = promiseSiteDataManagerSitesUpdated(); await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true }); await updatedPromise; await openSiteDataSettingsDialog(); - // eslint-disable-next-line mozilla/no-cpows-in-tests let dialog = content.gSubDialog._topDialog; let dialogFrame = dialog._frame; let frameDoc = dialogFrame.contentDocument; let siteItems = frameDoc.getElementsByTagName("richlistitem"); is(siteItems.length, 2, "Should list sites using quota usage or appcache"); let appcacheSite = frameDoc.querySelector(`richlistitem[host="${TEST_OFFLINE_HOST}"]`);
--- a/browser/components/preferences/in-content/tests/siteData/browser_siteData2.js +++ b/browser/components/preferences/in-content/tests/siteData/browser_siteData2.js @@ -1,12 +1,10 @@ "use strict"; -/* eslint-disable mozilla/no-cpows-in-tests */ - function promiseSettingsDialogClose() { return new Promise(resolve => { let win = gBrowser.selectedBrowser.contentWindow; let dialogOverlay = win.gSubDialog._topDialog._overlay; let dialogWin = win.gSubDialog._topDialog._frame.contentWindow; dialogWin.addEventListener("unload", function unload() { if (dialogWin.document.documentURI === "chrome://browser/content/preferences/siteDataSettings.xul") { isnot(dialogOverlay.style.visibility, "visible", "The Settings dialog should be hidden");
--- a/browser/components/preferences/in-content/tests/siteData/browser_siteData3.js +++ b/browser/components/preferences/in-content/tests/siteData/browser_siteData3.js @@ -72,17 +72,16 @@ add_task(async function() { persisted: false }, ]); let updatedPromise = promiseSiteDataManagerSitesUpdated(); await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true }); await updatedPromise; await openSiteDataSettingsDialog(); - // eslint-disable-next-line mozilla/no-cpows-in-tests let win = gBrowser.selectedBrowser.contentWindow; let dialogFrame = win.gSubDialog._topDialog._frame; let frameDoc = dialogFrame.contentDocument; let siteItems = frameDoc.getElementsByTagName("richlistitem"); is(siteItems.length, 1, "Should group sites across scheme, port and origin attributes"); let columns = siteItems[0].querySelectorAll(".item-box > label"); @@ -124,17 +123,16 @@ add_task(async function() { }, ]); let updatePromise = promiseSiteDataManagerSitesUpdated(); await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true }); await updatePromise; await openSiteDataSettingsDialog(); - // eslint-disable-next-line mozilla/no-cpows-in-tests let dialog = content.gSubDialog._topDialog; let dialogFrame = dialog._frame; let frameDoc = dialogFrame.contentDocument; let hostCol = frameDoc.getElementById("hostCol"); let usageCol = frameDoc.getElementById("usageCol"); let cookiesCol = frameDoc.getElementById("cookiesCol"); let sitesList = frameDoc.getElementById("sitesList"); @@ -239,17 +237,16 @@ add_task(async function() { }, ]); let updatePromise = promiseSiteDataManagerSitesUpdated(); await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true }); await updatePromise; await openSiteDataSettingsDialog(); - // eslint-disable-next-line mozilla/no-cpows-in-tests let dialog = content.gSubDialog._topDialog; let dialogFrame = dialog._frame; let frameDoc = dialogFrame.contentDocument; let lastAccessedCol = frameDoc.getElementById("lastAccessedCol"); let sitesList = frameDoc.getElementById("sitesList"); // Test sorting on the date column lastAccessedCol.click();
--- a/browser/components/search/test/browser_aboutSearchReset.js +++ b/browser/components/search/test/browser_aboutSearchReset.js @@ -59,17 +59,16 @@ var gTests = [ uri.spec; let rawEngine = engine.wrappedJSObject; let initialHash = rawEngine.getAttr("loadPathHash"); rawEngine.setAttr("loadPathHash", "broken"); Services.prefs.setCharPref(kStatusPref, "pending"); let loadPromise = promiseStoppedLoad(expectedURL); - // eslint-disable-next-line mozilla/no-cpows-in-tests gBrowser.contentDocumentAsCPOW.getElementById("searchResetKeepCurrent").click(); await loadPromise; is(engine, Services.search.currentEngine, "the custom engine is still default"); is(rawEngine.getAttr("loadPathHash"), initialHash, "the loadPathHash has been fixed"); @@ -78,17 +77,16 @@ var gTests = [ } }, { desc: "Test the 'Restore Search Defaults' button.", async run() { let currentEngine = Services.search.currentEngine; let originalEngine = Services.search.originalDefaultEngine; - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocumentAsCPOW; let defaultEngineSpan = doc.getElementById("defaultEngine"); is(defaultEngineSpan.textContent, originalEngine.name, "the name of the original default engine is displayed"); let expectedURL = originalEngine. getSubmission(kSearchStr, null, kSearchPurpose). uri.spec; @@ -111,17 +109,16 @@ var gTests = [ { desc: "Click the settings link.", async run() { Services.prefs.setCharPref(kStatusPref, "pending"); let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, "about:preferences#search"); - // eslint-disable-next-line mozilla/no-cpows-in-tests gBrowser.contentDocumentAsCPOW.getElementById("linkSettingsPage").click(); await loadPromise; checkTelemetryRecords(TELEMETRY_RESULT_ENUM.OPENED_SETTINGS); is(Services.prefs.getCharPref(kStatusPref), "customized"); } },
--- a/browser/components/search/test/browser_abouthome_behavior.js +++ b/browser/components/search/test/browser_abouthome_behavior.js @@ -34,17 +34,16 @@ function test() { if (event.originalTarget != tab.linkedBrowser.contentDocumentAsCPOW || event.target.location.href == "about:blank") { info("skipping spurious load event"); return; } tab.linkedBrowser.removeEventListener("load", load, true); // Observe page setup - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocumentAsCPOW; gMutationObserver = new MutationObserver(function(mutations) { for (let mutation of mutations) { if (mutation.attributeName == "searchEngineName") { // Re-add the listener, and perform a search gBrowser.addProgressListener(listener); gMutationObserver.disconnect(); gMutationObserver = null;
--- a/browser/components/sessionstore/test/browser_480893.js +++ b/browser/components/sessionstore/test/browser_480893.js @@ -11,17 +11,16 @@ add_task(async function() { ] }); let tab = BrowserTestUtils.addTab(gBrowser, "about:sessionrestore"); gBrowser.selectedTab = tab; let browser = tab.linkedBrowser; await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; // Click on the "Close" button after about:sessionrestore is loaded. doc.getElementById("errorCancel").click(); await BrowserTestUtils.browserLoaded(browser, false, "about:blank"); // Test that starting a new session loads the homepage (set to http://mochi.test:8888) @@ -31,17 +30,16 @@ add_task(async function() { "set": [ ["browser.startup.homepage", homepage], ["browser.startup.page", 1], ] }); browser.loadURI("about:sessionrestore"); await BrowserTestUtils.browserLoaded(browser, false, "about:sessionrestore"); - // eslint-disable-next-line mozilla/no-cpows-in-tests doc = browser.contentDocument; // Click on the "Close" button after about:sessionrestore is loaded. doc.getElementById("errorCancel").click(); await BrowserTestUtils.browserLoaded(browser); is(browser.currentURI.spec, homepage, "loaded page is the homepage");
--- a/browser/components/sessionstore/test/browser_590563.js +++ b/browser/components/sessionstore/test/browser_590563.js @@ -27,25 +27,23 @@ function test() { middleClickTest(win); }, win); }); }); } async function middleClickTest(win) { let browser = win.gBrowser.selectedBrowser; - /* eslint-disable mozilla/no-cpows-in-tests */ let tabsToggle = browser.contentDocument.getElementById("tabsToggle"); EventUtils.synthesizeMouseAtCenter(tabsToggle, { button: 0 }, browser.contentWindow); let treeContainer = browser.contentDocument.querySelector(".tree-container"); await BrowserTestUtils.waitForCondition(() => win.getComputedStyle(treeContainer).visibility == "visible"); let tree = browser.contentDocument.getElementById("tabList"); is(tree.view.rowCount, 3, "There should be three items"); - /* eslint-enable mozilla/no-cpows-in-tests */ // click on the first tab item var rect = tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[1], "text"); EventUtils.synthesizeMouse(tree.body, rect.x, rect.y, { button: 1 }, browser.contentWindow); // click on the second tab item rect = tree.treeBoxObject.getCoordsForCellItem(2, tree.columns[1], "text"); EventUtils.synthesizeMouse(tree.body, rect.x, rect.y, { button: 1 },
--- a/browser/components/sessionstore/test/browser_705597.js +++ b/browser/components/sessionstore/test/browser_705597.js @@ -42,17 +42,16 @@ function test() { waitForBrowserState(blankState, finish); }); // Force reload the browser to deprecate the subframes. browser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE); }); // Create a dynamic subframe. - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; let iframe = doc.createElement("iframe"); doc.body.appendChild(iframe); iframe.setAttribute("src", "about:mozilla"); }); }); }
--- a/browser/components/sessionstore/test/browser_707862.js +++ b/browser/components/sessionstore/test/browser_707862.js @@ -41,17 +41,16 @@ function test() { }); }); // Force reload the browser to deprecate the subframes. browser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE); }); // Create a dynamic subframe. - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; let iframe = doc.createElement("iframe"); doc.body.appendChild(iframe); iframe.setAttribute("src", "about:mozilla"); }); }); // This test relies on the test timing out in order to indicate failure so
--- a/browser/components/sessionstore/test/browser_aboutSessionRestore.js +++ b/browser/components/sessionstore/test/browser_aboutSessionRestore.js @@ -24,17 +24,16 @@ add_task(async function() { await promiseBrowserLoaded(browser); // Fake a post-crash tab. ss.setTabState(tab, JSON.stringify(TAB_STATE)); await promiseTabRestored(tab); ok(gBrowser.tabs.length > 1, "we have more than one tab"); - // eslint-disable-next-line mozilla/no-cpows-in-tests let view = browser.contentDocument.getElementById("tabList").view; ok(view.isContainer(0), "first entry is the window"); is(view.getCellProperties(1, { id: "title" }), "icon", "second entry is the tab and has a favicon"); browser.messageManager.loadFrameScript(FRAME_SCRIPT, true); // Wait until the new window was restored.
--- a/browser/components/sessionstore/test/browser_crashedTabs.js +++ b/browser/components/sessionstore/test/browser_crashedTabs.js @@ -385,17 +385,16 @@ add_task(async function test_hide_restor browser.loadURI(PAGE_1); await promiseBrowserLoaded(browser); await TabStateFlusher.flush(browser); // Crash the tab await BrowserTestUtils.crashBrowser(browser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = browser.contentDocument; let restoreAllButton = doc.getElementById("restoreAll"); let restoreOneButton = doc.getElementById("restoreTab"); let restoreAllStyles = window.getComputedStyle(restoreAllButton); is(restoreAllStyles.display, "none", "Restore All button should be hidden"); ok(restoreOneButton.classList.contains("primary"), "Restore Tab button should have the primary class"); @@ -416,17 +415,16 @@ add_task(async function test_hide_restor // sending its AboutTabCrashedReady event before we know for // sure whether or not we're showing the right Restore buttons. let otherBrowserReady = promiseTabCrashedReady(otherWinBrowser); // Crash the first tab. await BrowserTestUtils.crashBrowser(browser); await otherBrowserReady; - // eslint-disable-next-line mozilla/no-cpows-in-tests doc = browser.contentDocument; restoreAllButton = doc.getElementById("restoreAll"); restoreOneButton = doc.getElementById("restoreTab"); restoreAllStyles = window.getComputedStyle(restoreAllButton); isnot(restoreAllStyles.display, "none", "Restore All button should not be hidden"); ok(!(restoreOneButton.classList.contains("primary")), "Restore Tab button should not have the primary class");
--- a/browser/components/sessionstore/test/browser_swapDocShells.js +++ b/browser/components/sessionstore/test/browser_swapDocShells.js @@ -21,16 +21,15 @@ function promiseDelayedStartupFinished(w return new Promise(resolve => { whenDelayedStartupFinished(win, resolve); }); } function promiseBrowserHasURL(browser, url) { let promise = Promise.resolve(); - // eslint-disable-next-line mozilla/no-cpows-in-tests if (browser.contentDocument.readyState === "complete" && browser.currentURI.spec === url) { return promise; } return promise.then(() => promiseBrowserHasURL(browser, url)); }
--- a/browser/components/shell/test/browser_1119088.js +++ b/browser/components/shell/test/browser_1119088.js @@ -27,17 +27,16 @@ function onPageLoad() { wpFile.append("logo.png"); if (wpFile.exists()) { wpFile.remove(false); } let shell = Cc["@mozilla.org/browser/shell-service;1"]. getService(Ci.nsIShellService); - // eslint-disable-next-line mozilla/no-cpows-in-tests let image = gBrowser.contentDocumentAsCPOW.images[0]; shell.setDesktopBackground(image, 0, "logo.png"); setTimeout(function() { ok(wpFile.exists(), "Desktop background was written to disk."); desktopBackgroundDbBackup.moveTo(null, desktopBackgroundDb.leafName); wpFile.remove(false);
--- a/browser/extensions/onboarding/test/browser/browser_onboarding_skip_tour.js +++ b/browser/extensions/onboarding/test/browser/browser_onboarding_skip_tour.js @@ -31,13 +31,12 @@ add_task(async function test_hide_skip_b resetOnboardingDefaultState(); Preferences.set("browser.onboarding.skip-tour-button.hide", true); let tab = await openTab(ABOUT_NEWTAB_URL); await promiseOnboardingOverlayLoaded(tab.linkedBrowser); await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser); await promiseOnboardingOverlayOpened(tab.linkedBrowser); - // eslint-disable-next-line mozilla/no-cpows-in-tests ok(!gBrowser.contentDocumentAsCPOW.querySelector("#onboarding-skip-tour-button"), "should not render the skip button"); await BrowserTestUtils.removeTab(tab); });
--- a/browser/extensions/onboarding/test/browser/browser_onboarding_tourset.js +++ b/browser/extensions/onboarding/test/browser/browser_onboarding_tourset.js @@ -8,17 +8,16 @@ requestLongerTimeout(2); add_task(async function test_onboarding_default_new_tourset() { resetOnboardingDefaultState(); let tab = await openTab(ABOUT_NEWTAB_URL); await promiseOnboardingOverlayLoaded(tab.linkedBrowser); await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser); await promiseOnboardingOverlayOpened(tab.linkedBrowser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocumentAsCPOW; let doms = doc.querySelectorAll(".onboarding-tour-item"); is(doms.length, TOUR_IDs.length, "has exact tour numbers"); doms.forEach((dom, idx) => { is(TOUR_IDs[idx], dom.id, "contain defined onboarding id"); }); await BrowserTestUtils.removeTab(tab); @@ -39,17 +38,16 @@ add_task(async function test_onboarding_ ["browser.onboarding.newtour", "private,addons,customize"], ]}); let tab = await openTab(ABOUT_NEWTAB_URL); await promiseOnboardingOverlayLoaded(tab.linkedBrowser); await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser); await promiseOnboardingOverlayOpened(tab.linkedBrowser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocumentAsCPOW; let doms = doc.querySelectorAll(".onboarding-tour-item"); is(doms.length, CUSTOM_NEW_TOURs.length, "has exact tour numbers"); doms.forEach((dom, idx) => { is(CUSTOM_NEW_TOURs[idx], dom.id, "contain defined onboarding id"); }); await BrowserTestUtils.removeTab(tab); @@ -69,17 +67,16 @@ add_task(async function test_onboarding_ ["browser.onboarding.updatetour", "customize,private,addons"], ]}); let tab = await openTab(ABOUT_NEWTAB_URL); await promiseOnboardingOverlayLoaded(tab.linkedBrowser); await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser); await promiseOnboardingOverlayOpened(tab.linkedBrowser); - // eslint-disable-next-line mozilla/no-cpows-in-tests let doc = gBrowser.contentDocumentAsCPOW; let doms = doc.querySelectorAll(".onboarding-tour-item"); is(doms.length, CUSTOM_UPDATE_TOURs.length, "has exact tour numbers"); doms.forEach((dom, idx) => { is(CUSTOM_UPDATE_TOURs[idx], dom.id, "contain defined onboarding id"); }); await BrowserTestUtils.removeTab(tab);
--- a/browser/modules/test/browser/formValidation/browser_form_validation.js +++ b/browser/modules/test/browser/formValidation/browser_form_validation.js @@ -341,17 +341,16 @@ add_task(async function() { gObserver.notifyInvalidSubmit = function() {}; resolve(); }); }; Services.obs.addObserver(gObserver, "invalidformsubmit"); executeSoon(function() { - // eslint-disable-next-line mozilla/no-cpows-in-tests browser.contentDocument.getElementById("s").click(); }); }); await notifierPromise; gBrowser.removeTab(gBrowser.getTabForBrowser(browser)); }); @@ -387,17 +386,16 @@ add_task(async function() { let popupShownPromise = BrowserTestUtils.waitForEvent(gInvalidFormPopup, "popupshown"); await clickChildElement(browser); await popupShownPromise; checkPopupShow(); await checkChildFocus(browser, gInvalidFormPopup.firstChild.textContent); - // eslint-disable-next-line mozilla/no-cpows-in-tests let inputPromise = BrowserTestUtils.waitForEvent(gBrowser.contentDocument.getElementById("i"), "input"); EventUtils.sendString("f"); await inputPromise; // Now, the element suffers from another error, the message should have // been updated. await new Promise((resolve, reject) => { // XXXndeakin This isn't really going to work when the content is another process
--- a/devtools/.eslintrc.js +++ b/devtools/.eslintrc.js @@ -13,17 +13,16 @@ module.exports = { "require": true, }, "rules": { // These are the rules that have been configured so far to match the // devtools coding style. // Rules from the mozilla plugin "mozilla/no-aArgs": "error", - "mozilla/no-cpows-in-tests": "error", "mozilla/no-single-arg-cu-import": "error", // See bug 1224289. "mozilla/reject-importGlobalProperties": "error", // devtools/shared/platform is special; see the README.md in that // directory for details. We reject requires using explicit // subdirectories of this directory. "mozilla/reject-some-requires": ["error", "^devtools/shared/platform/(chome|content)/"], "mozilla/var-only-at-top-level": "error",
--- a/devtools/client/debugger/new/README.mozilla +++ b/devtools/client/debugger/new/README.mozilla @@ -1,13 +1,13 @@ This is the debugger.html project output. See https://github.com/devtools-html/debugger.html -Version 22.0 +Version 23.0 -Comparison: https://github.com/devtools-html/debugger.html/compare/release-21...release-22 +Comparison: https://github.com/devtools-html/debugger.html/compare/release-22...release-23 Packages: - babel-plugin-transform-es2015-modules-commonjs @6.26.0 - babel-preset-react @6.24.1 - react @16.2.0 - react-dom @16.2.0 - webpack @3.11.0
--- a/devtools/client/debugger/new/debugger.css +++ b/devtools/client/debugger/new/debugger.css @@ -1,420 +1,8 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -menu { - display: inline; - padding: 0; -} - -menu > menuitem::after { - content: "\25BA"; - float: right; - padding-left: 5px; -} - -menu > menupopup { - display: none; -} - -menu > menuitem:hover + menupopup, -menu > menupopup:hover { - display: block; -} - -menupopup { - position: fixed; - z-index: 10000; - background: white; - border: 1px solid #cccccc; - padding: 5px 0; - background: #f2f2f2; - border-radius: 5px; - color: #585858; - box-shadow: 0 0 4px 0 rgba(190, 190, 190, 0.8); - min-width: 130px; -} - -menuitem { - display: block; - padding: 0 20px; - line-height: 20px; - font-weight: 500; - font-size: 13px; - -moz-user-select: none; - user-select: none; -} - -menuitem:hover { - background: #3780fb; - color: white; - cursor: pointer; -} - -menuitem[disabled=true] { - color: #cccccc; -} - -menuitem[disabled=true]:hover { - background-color: transparent; - cursor: default; -} - -menuitem[type=checkbox]::before { - content: ""; - width: 10px; - display: inline-block; -} - -menuitem[type=checkbox][checked=true]::before { - content: "\2713"; - left: -8px; - position: relative; -} - -menuseparator { - border-bottom: 1px solid #cacdd3; - width: 100%; - height: 5px; - display: block; - margin-bottom: 5px; -} - -#contextmenu-mask.show { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 999; -} -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -:root.theme-light, -:root .theme-light { - --theme-search-overlays-semitransparent: rgba(221, 225, 228, 0.66); -} - -* { - box-sizing: border-box; -} - -html, -body { - height: 100%; - margin: 0; - padding: 0; - width: 100%; -} - -#mount { - display: flex; - height: 100%; -} - -::-webkit-scrollbar { - width: 8px; - height: 8px; - background: transparent; -} - -::-webkit-scrollbar-track { - border-radius: 8px; - background: transparent; -} - -::-webkit-scrollbar-thumb { - border-radius: 8px; - background: rgba(113, 113, 113, 0.5); -} - -:root.theme-dark .CodeMirror-scrollbar-filler { - background: transparent; -} -/* 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/. */ - -.landing-page { - flex: 1; - display: flex; - width: 100vw; - height: 100vh; - flex-direction: row; - align-items: stretch; - /* Customs properties */ - --title-font-size: 24px; - --ui-element-font-size: 16px; - --primary-line-height: 22px; - --secondary-line-height: 25px; - --base-spacing: 20px; - --base-transition: all 0.25s ease; -} - -.landing-popup { - min-width: 0; -} - -.landing-page .panel { - display: flex; - flex: 1; - flex-direction: column; - justify-content: space-between; -} - -.landing-page .panel header { - display: flex; - align-items: baseline; - margin: calc(2 * var(--base-spacing)) 0 0; - padding-bottom: var(--base-spacing); -} - -.landing-page .panel header input[type="search"] { - flex: 1; - background-color: var(--theme-tab-toolbar-background); - color: var(--theme-comment); - font-size: var(--ui-element-font-size); - border: 1px solid var(--theme-splitter-color); - padding: calc(var(--base-spacing) / 2); - margin: 0 var(--base-spacing); - transition: var(--base-transition); -} - -.landing-page .panel .hero { - height: 100%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; -} - -.landing-page button { - background-color: var(--theme-tab-toolbar-background); - color: var(--theme-comment); - font-size: var(--ui-element-font-size); - border: 1px solid var(--theme-splitter-color); - padding: calc(var(--base-spacing) / 2); - margin: 0 var(--base-spacing); - transition: var(--base-transition); - cursor: pointer; -} - -.landing-page .panel header h1 { - color: var(--theme-body-color); - font-size: var(--title-font-size); - margin: 0; - line-height: var(--primary-line-height); - font-weight: normal; - padding-left: calc(2 * var(--base-spacing)); -} - -.landing-page .panel h3 { - padding-left: calc(2 * var(--base-spacing)); -} - -.landing-page .panel header input::placeholder { - color: var(--theme-body-color-inactive); -} - -.landing-page .panel header input:focus { - border: 1px solid var(--theme-selection-background); -} - -.landing-page .panel .center-message { - font-size: var(--ui-element-font-size); - line-height: var(--secondary-line-height); - padding: calc(var(--base-spacing) / 2); -} - -.landing-page .center a { - color: var(--theme-highlight-bluegrey); - text-decoration: none; -} - -.landing-page .panel .footer-note { - padding: var(--base-spacing) 0; - text-align: center; - font-size: 14px; - color: var(--theme-comment); -} - -.landing-page .panel .launch-action-container { - text-align: center; -} - -.landing-page .panel .under-construction { - display: flex; - width: 417px; - color: var(--theme-comment); - font-size: calc(var(--ui-element-font-size) / 1); - margin: var(--base-spacing) auto; - max-width: 350px; - - line-height: 1.4em; -} - -.landing-page .panel .under-construction .github-link { - display: block; -} -/* 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/. */ - -.landing-page .tab-group { - flex: 1; - overflow-y: auto; -} - -.landing-page .tab-list { - list-style: none; - padding: 0; - margin: 0; -} - -.landing-page .tab { - border-bottom: 1px solid var(--theme-splitter-color); - padding: calc(var(--base-spacing) / 2) var(--base-spacing); - font-family: sans-serif; - cursor: pointer; -} - -.landing-page .tab-sides { - display: flex; - justify-content: space-between; - margin: 0 calc(var(--base-spacing) * 2); -} - -.landing-page .tab-title { - line-height: var(--secondary-line-height); - font-size: var(--ui-element-font-size); - color: var(--theme-highlight-bluegrey); - word-break: break-all; -} - -.landing-page .tab-url { - color: var(--theme-comment); - word-break: break-all; -} - -.landing-page .tab-value { - color: var(--theme-comment); - line-height: var(--secondary-line-height); - font-size: var(--ui-element-font-size); -} - -.landing-page .tab:focus, -.landing-page .tab.active { - background: var(--theme-selection-background); - color: var(--theme-selection-color); - transition: var(--base-transition); -} - -.landing-page .tab:focus .tab-title, -.landing-page .tab.active .tab-title { - color: inherit; -} - -.landing-page .tab:focus .tab-url, -.landing-page .tab.active .tab-url { - color: var(--theme-highlight-gray); -} -/* 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/. */ - -.landing-page .sidebar { - --sidebar-width: 200px; - display: flex; - background-color: var(--theme-tab-toolbar-background); - width: var(--sidebar-width); - flex-direction: column; - border-right: 1px solid var(--theme-splitter-color); -} - -.landing-page .sidebar h1 { - color: var(--theme-body-color); - font-size: var(--title-font-size); - margin: 0; - line-height: var(--primary-line-height); - font-weight: bold; - padding: var(--base-spacing) var(--base-spacing); -} - -.landing-page .sidebar ul { - list-style: none; - padding: 0; - line-height: var(--primary-line-height); - font-size: var(--ui-element-font-size); -} - -.landing-page .sidebar li { - padding: calc(var(--base-spacing) / 4) var(--base-spacing); -} - -.landing-page .sidebar li a { - color: var(--theme-body-color); -} - -.landing-page .sidebar li.selected { - background: var(--theme-highlight-bluegrey); - color: var(--theme-selection-color); - transition: var(--base-transition); -} - -.landing-page .sidebar li.selected a { - color: inherit; -} - -.landing-page .sidebar li:hover, -.landing-page .sidebar li:focus { - background: var(--theme-selection-background); - color: var(--theme-selection-color); - cursor: pointer; -} - -.landing-page .sidebar li:hover a, -.landing-page .sidebar li:focus a { - color: inherit; -} - -.landing-page .sidebar li:last-child { - border-top: 2px solid var(--theme-splitter-color); - margin: 2px; -} - -.landing-page .sidebar .title-wrapper .launchpad-container { - padding-left: var(--base-spacing); -} - -.landing-page - .sidebar - .title-wrapper - .launchpad-container - .launchpad-container-icon { - display: inline-block; -} - -.landing-page .sidebar .title-wrapper .launchpad-container .rocket svg { - width: 18px; - height: 18px; -} - -.landing-page - .sidebar - .title-wrapper - .launchpad-container - .launchpad-container-title { - display: inline; - padding-left: 3px; - font-weight: normal; -} /* 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/>. */ .modal-wrapper { position: fixed; display: flex; flex-direction: column; @@ -465,16 +53,17 @@ body { * 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/>. */ .shortcuts-content { padding: 15px; -moz-column-width: 250px; -webkit-column-width: 250px; column-width: 250px; + cursor: default; } .shortcuts-content h2 { margin-top: 2px; margin-bottom: 2px; color: var(--theme-content-color1); } @@ -611,16 +200,61 @@ button:focus { text-align: center; } .min-width-0 { min-width: 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/. */ + +:root.theme-light, +:root .theme-light { + --theme-search-overlays-semitransparent: rgba(221, 225, 228, 0.66); +} + +* { + box-sizing: border-box; +} + +html, +body { + height: 100%; + margin: 0; + padding: 0; + width: 100%; +} + +#mount { + display: flex; + height: 100%; +} + +::-webkit-scrollbar { + width: 8px; + height: 8px; + background: transparent; +} + +::-webkit-scrollbar-track { + border-radius: 8px; + background: transparent; +} + +::-webkit-scrollbar-thumb { + border-radius: 8px; + background: rgba(113, 113, 113, 0.5); +} + +:root.theme-dark .CodeMirror-scrollbar-filler { + background: transparent; +} +/* 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/>. */ menupopup { position: fixed; z-index: 10000; background: white; border: 1px solid #cccccc; padding: 5px 0; @@ -1776,16 +1410,106 @@ html[dir="rtl"] .arrow svg, .function-signature .paren { color: var(--object-color); } .function-signature .comma { color: var(--object-color); } +/* 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/. */ + +menu { + display: inline; + padding: 0; +} + +menu > menuitem::after { + content: "\25BA"; + float: right; + padding-left: 5px; +} + +menu > menupopup { + display: none; +} + +menu > menuitem:hover + menupopup, +menu > menupopup:hover { + display: block; +} + +menupopup { + position: fixed; + z-index: 10000; + background: white; + border: 1px solid #cccccc; + padding: 5px 0; + background: #f2f2f2; + border-radius: 5px; + color: #585858; + box-shadow: 0 0 4px 0 rgba(190, 190, 190, 0.8); + min-width: 130px; +} + +menuitem { + display: block; + padding: 0 20px; + line-height: 20px; + font-weight: 500; + font-size: 13px; + -moz-user-select: none; + user-select: none; +} + +menuitem:hover { + background: #3780fb; + color: white; + cursor: pointer; +} + +menuitem[disabled=true] { + color: #cccccc; +} + +menuitem[disabled=true]:hover { + background-color: transparent; + cursor: default; +} + +menuitem[type=checkbox]::before { + content: ""; + width: 10px; + display: inline-block; +} + +menuitem[type=checkbox][checked=true]::before { + content: "\2713"; + left: -8px; + position: relative; +} + +menuseparator { + border-bottom: 1px solid #cacdd3; + width: 100%; + height: 5px; + display: block; + margin-bottom: 5px; +} + +#contextmenu-mask.show { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; +} .command-bar-button { appearance: none; background: transparent; border: none; display: inline-block; text-align: center; position: relative; padding: 0px 5px; @@ -2782,17 +2506,17 @@ html[dir="rtl"] .editor-mount { } .folding-enabled .CodeMirror-linenumber { text-align: left; padding: 0 0 0 2px; } /* set the linenumber white when there is a breakpoint */ -.new-breakpoint .CodeMirror-gutter-wrapper .CodeMirror-linenumber { +.cm-s-mozilla .new-breakpoint .CodeMirror-gutter-wrapper .CodeMirror-linenumber { color: white; } /* move the breakpoint below the other gutter elements */ .new-breakpoint .CodeMirror-gutter-elt:nth-child(2) { z-index: 0; }
--- a/devtools/client/debugger/new/debugger.js +++ b/devtools/client/debugger/new/debugger.js @@ -1,18 +1,18 @@ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("devtools/client/shared/vendor/react"), require("devtools/client/shared/vendor/lodash"), require("devtools/client/shared/vendor/react-dom"), require("Services"), require("devtools/shared/flags"), require("devtools/client/sourceeditor/editor"), require("devtools/client/shared/vendor/WasmParser"), require("devtools/client/shared/vendor/WasmDis")); + module.exports = factory(require("devtools/client/shared/vendor/react"), require("devtools/client/shared/vendor/lodash"), require("devtools/client/shared/vendor/react-dom"), require("Services"), require("devtools/shared/flags"), require("devtools/client/sourceeditor/editor"), require("devtools/client/shared/vendor/WasmParser"), require("devtools/client/shared/vendor/WasmDis"), require("devtools/client/shared/vendor/react-redux"), require("devtools/client/shared/vendor/redux"), require("devtools/client/shared/vendor/immutable")); else if(typeof define === 'function' && define.amd) - define(["devtools/client/shared/vendor/react", "devtools/client/shared/vendor/lodash", "devtools/client/shared/vendor/react-dom", "Services", "devtools/shared/flags", "devtools/client/sourceeditor/editor", "devtools/client/shared/vendor/WasmParser", "devtools/client/shared/vendor/WasmDis"], factory); + define(["devtools/client/shared/vendor/react", "devtools/client/shared/vendor/lodash", "devtools/client/shared/vendor/react-dom", "Services", "devtools/shared/flags", "devtools/client/sourceeditor/editor", "devtools/client/shared/vendor/WasmParser", "devtools/client/shared/vendor/WasmDis", "devtools/client/shared/vendor/react-redux", "devtools/client/shared/vendor/redux", "devtools/client/shared/vendor/immutable"], factory); else { - var a = typeof exports === 'object' ? factory(require("devtools/client/shared/vendor/react"), require("devtools/client/shared/vendor/lodash"), require("devtools/client/shared/vendor/react-dom"), require("Services"), require("devtools/shared/flags"), require("devtools/client/sourceeditor/editor"), require("devtools/client/shared/vendor/WasmParser"), require("devtools/client/shared/vendor/WasmDis")) : factory(root["devtools/client/shared/vendor/react"], root["devtools/client/shared/vendor/lodash"], root["devtools/client/shared/vendor/react-dom"], root["Services"], root["devtools/shared/flags"], root["devtools/client/sourceeditor/editor"], root["devtools/client/shared/vendor/WasmParser"], root["devtools/client/shared/vendor/WasmDis"]); + var a = typeof exports === 'object' ? factory(require("devtools/client/shared/vendor/react"), require("devtools/client/shared/vendor/lodash"), require("devtools/client/shared/vendor/react-dom"), require("Services"), require("devtools/shared/flags"), require("devtools/client/sourceeditor/editor"), require("devtools/client/shared/vendor/WasmParser"), require("devtools/client/shared/vendor/WasmDis"), require("devtools/client/shared/vendor/react-redux"), require("devtools/client/shared/vendor/redux"), require("devtools/client/shared/vendor/immutable")) : factory(root["devtools/client/shared/vendor/react"], root["devtools/client/shared/vendor/lodash"], root["devtools/client/shared/vendor/react-dom"], root["Services"], root["devtools/shared/flags"], root["devtools/client/sourceeditor/editor"], root["devtools/client/shared/vendor/WasmParser"], root["devtools/client/shared/vendor/WasmDis"], root["devtools/client/shared/vendor/react-redux"], root["devtools/client/shared/vendor/redux"], root["devtools/client/shared/vendor/immutable"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } -})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_52__, __WEBPACK_EXTERNAL_MODULE_197__, __WEBPACK_EXTERNAL_MODULE_677__, __WEBPACK_EXTERNAL_MODULE_678__) { +})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_52__, __WEBPACK_EXTERNAL_MODULE_197__, __WEBPACK_EXTERNAL_MODULE_677__, __WEBPACK_EXTERNAL_MODULE_678__, __WEBPACK_EXTERNAL_MODULE_3592__, __WEBPACK_EXTERNAL_MODULE_3593__, __WEBPACK_EXTERNAL_MODULE_3594__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache @@ -607,23 +607,16 @@ function set(object, path, value) { return object == null ? object : baseSet(object, path, value); } module.exports = set; /***/ }), -/***/ 1126: -/***/ (function(module, exports) { - -module.exports = "<svg enable-background=\"new 0 0 800 800\" id=\"GUIDE\" version=\"1.1\" viewBox=\"0 0 800 800\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><path d=\"M580.562,219.439c-12.721-12.723-29.637-19.728-47.623-19.728c-17.987,0-34.903,7.005-47.625,19.728 c-12.72,12.72-19.725,29.634-19.725,47.621c0,17.99,7.005,34.904,19.725,47.625c12.722,12.721,29.633,19.723,47.618,19.726 c0.007,0,0.007,0,0.007,0c17.986,0,34.902-7.005,47.623-19.726c12.721-12.723,19.726-29.636,19.726-47.625 C600.286,249.073,593.281,232.16,580.562,219.439z M553.771,287.895c-5.566,5.568-12.96,8.636-20.834,8.636l0,0 c-7.872-0.002-15.271-3.068-20.834-8.636c-5.566-5.562-8.633-12.96-8.633-20.834c0-7.868,3.065-15.269,8.633-20.834 c5.563-5.565,12.967-8.63,20.834-8.63c7.868,0,15.268,3.063,20.834,8.63C565.263,257.715,565.263,276.407,553.771,287.895z\" fill=\"#041C3F\"></path><g><path d=\"M62.282,627.218c-4.847,0-9.693-1.847-13.392-5.546c-7.398-7.397-7.398-19.395,0-26.79L158.42,485.35 c7.398-7.397,19.392-7.397,26.79,0s7.398,19.395,0,26.792L75.676,621.672C71.978,625.371,67.131,627.218,62.282,627.218z\" fill=\"#041C3F\"></path></g><g><path d=\"M86.774,732.172c-4.85,0-9.696-1.85-13.395-5.549c-7.398-7.397-7.398-19.389,0-26.786L187.545,585.67 c7.398-7.398,19.392-7.398,26.787,0c7.398,7.398,7.398,19.393,0,26.79L100.168,726.623C96.47,730.322,91.62,732.172,86.774,732.172 z\" fill=\"#041C3F\"></path></g><g><path d=\"M191.725,756.661c-4.849,0-9.696-1.847-13.395-5.546c-7.398-7.397-7.398-19.393,0-26.789L287.863,614.79 c7.396-7.394,19.392-7.396,26.787,0c7.398,7.397,7.398,19.395,0,26.793L205.12,751.115 C201.421,754.813,196.574,756.661,191.725,756.661z\" fill=\"#041C3F\"></path></g><path d=\"M751.113,48.891c-4.302-4.3-10.409-6.278-16.403-5.311c-2.202,0.357-54.705,8.98-126.25,36.316 c-41.974,16.034-81.85,35.237-118.529,57.076c-45.039,26.814-85.356,57.721-119.899,91.871l-143.055,27.85 c-3.693,0.718-7.086,2.524-9.753,5.177L87.618,391.06c-5.907,5.886-7.267,14.938-3.36,22.301c3.33,6.27,9.818,10.059,16.725,10.059 c1.202,0,2.415-0.114,3.628-0.347l146.185-28.463c-9.516,18.672-18.419,38.055-26.683,58.144 c-2.904,7.072-1.279,15.194,4.125,20.603l35.811,35.811l-33.27,33.27c-7.398,7.398-7.398,19.39,0,26.787 c3.699,3.699,8.545,5.549,13.397,5.549c4.847,0,9.693-1.85,13.392-5.546l33.27-33.271l35.811,35.813 c3.625,3.619,8.469,5.548,13.4,5.548c2.423,0,4.871-0.467,7.199-1.426c20.091-8.262,39.475-17.165,58.141-26.678l-28.455,146.186 c-1.593,8.183,2.35,16.443,9.709,20.352c2.806,1.488,5.852,2.213,8.879,2.213c4.917,0,9.778-1.918,13.417-5.573l129.188-129.604 c2.656-2.663,4.459-6.061,5.181-9.753l27.845-143.055c34.148-34.547,65.06-74.859,91.876-119.901 c21.834-36.683,41.04-76.558,57.077-118.529c27.33-71.551,35.958-124.048,36.313-126.25 C757.386,59.292,755.407,53.188,751.113,48.891z M158.393,374.001l81.489-81.224l87.674-17.069 c-19.015,23.391-36.655,48.634-52.847,75.648L158.393,374.001z M507.219,560.121l-81.222,81.489l22.643-116.316 c27.021-16.192,52.259-33.83,75.648-52.848L507.219,560.121z M684.359,178.936c-23.915,62.371-68.01,152.302-142.237,226.531 c-34.171,34.168-73.96,64.54-118.89,90.838c-0.804,0.401-1.585,0.854-2.322,1.366c-24.049,13.943-49.566,26.728-76.476,38.302 l-26.806-26.809l54.11-54.106c7.395-7.397,7.395-19.392,0-26.79c-7.398-7.397-19.392-7.396-26.79,0l-54.109,54.106l-26.806-26.809 c11.578-26.913,24.361-52.433,38.308-76.488c0.508-0.732,0.951-1.5,1.35-2.295c26.298-44.938,56.672-84.732,90.849-118.909 c74.225-74.225,164.156-118.319,226.527-142.235c37.897-14.537,70.522-23.601,92.09-28.797 C707.959,108.412,698.894,141.038,684.359,178.936z\" fill=\"#041C3F\"></path></svg>" - -/***/ }), - /***/ 113: /***/ (function(module, exports, __webpack_require__) { var assignValue = __webpack_require__(114), castPath = __webpack_require__(69), isIndex = __webpack_require__(117), isObject = __webpack_require__(84), toKey = __webpack_require__(111); @@ -806,36 +799,16 @@ module.exports = "<!-- This Source Code /***/ 118: /***/ (function(module, exports) { /***/ }), -/***/ 1189: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_Provider__ = __webpack_require__(1195); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_connectAdvanced__ = __webpack_require__(1192); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__connect_connect__ = __webpack_require__(1198); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Provider", function() { return __WEBPACK_IMPORTED_MODULE_0__components_Provider__["b"]; }); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "createProvider", function() { return __WEBPACK_IMPORTED_MODULE_0__components_Provider__["a"]; }); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "connectAdvanced", function() { return __WEBPACK_IMPORTED_MODULE_1__components_connectAdvanced__["a"]; }); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "connect", function() { return __WEBPACK_IMPORTED_MODULE_2__connect_connect__["a"]; }); - - - - - - -/***/ }), - /***/ 119: /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including @@ -1058,891 +1031,16 @@ var substr = 'ab'.substr(-1) === 'b' return str.substr(start, len); } ; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(120))) /***/ }), -/***/ 1190: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = warning; -/** - * Prints a warning in the console if it exists. - * - * @param {String} message The warning message. - * @returns {void} - */ -function warning(message) { - /* eslint-disable no-console */ - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(message); - } - /* eslint-enable no-console */ - try { - // This error was thrown as a convenience so that if you enable - // "break on all exceptions" in your console, - // it would pause the execution at this line. - throw new Error(message); - /* eslint-disable no-empty */ - } catch (e) {} - /* eslint-enable no-empty */ -} - -/***/ }), - -/***/ 1191: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return subscriptionShape; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return storeShape; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prop_types__ = __webpack_require__(20); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_prop_types__); - - -var subscriptionShape = __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.shape({ - trySubscribe: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func.isRequired, - tryUnsubscribe: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func.isRequired, - notifyNestedSubs: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func.isRequired, - isSubscribed: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func.isRequired -}); - -var storeShape = __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.shape({ - subscribe: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func.isRequired, - dispatch: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func.isRequired, - getState: __WEBPACK_IMPORTED_MODULE_0_prop_types___default.a.func.isRequired -}); - -/***/ }), - -/***/ 1192: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = connectAdvanced; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_hoist_non_react_statics__ = __webpack_require__(1196); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_hoist_non_react_statics___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_hoist_non_react_statics__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant__ = __webpack_require__(159); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_invariant___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_invariant__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_Subscription__ = __webpack_require__(1197); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_PropTypes__ = __webpack_require__(1191); -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - - - - - - - - -var hotReloadingVersion = 0; -var dummyState = {}; -function noop() {} -function makeSelectorStateful(sourceSelector, store) { - // wrap the selector in an object that tracks its results between runs. - var selector = { - run: function runComponentSelector(props) { - try { - var nextProps = sourceSelector(store.getState(), props); - if (nextProps !== selector.props || selector.error) { - selector.shouldComponentUpdate = true; - selector.props = nextProps; - selector.error = null; - } - } catch (error) { - selector.shouldComponentUpdate = true; - selector.error = error; - } - } - }; - - return selector; -} - -function connectAdvanced( -/* - selectorFactory is a func that is responsible for returning the selector function used to - compute new props from state, props, and dispatch. For example: - export default connectAdvanced((dispatch, options) => (state, props) => ({ - thing: state.things[props.thingId], - saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)), - }))(YourComponent) - Access to dispatch is provided to the factory so selectorFactories can bind actionCreators - outside of their selector as an optimization. Options passed to connectAdvanced are passed to - the selectorFactory, along with displayName and WrappedComponent, as the second argument. - Note that selectorFactory is responsible for all caching/memoization of inbound and outbound - props. Do not use connectAdvanced directly without memoizing results between calls to your - selector, otherwise the Connect component will re-render on every state or props change. -*/ -selectorFactory) { - var _contextTypes, _childContextTypes; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$getDisplayName = _ref.getDisplayName, - getDisplayName = _ref$getDisplayName === undefined ? function (name) { - return 'ConnectAdvanced(' + name + ')'; - } : _ref$getDisplayName, - _ref$methodName = _ref.methodName, - methodName = _ref$methodName === undefined ? 'connectAdvanced' : _ref$methodName, - _ref$renderCountProp = _ref.renderCountProp, - renderCountProp = _ref$renderCountProp === undefined ? undefined : _ref$renderCountProp, - _ref$shouldHandleStat = _ref.shouldHandleStateChanges, - shouldHandleStateChanges = _ref$shouldHandleStat === undefined ? true : _ref$shouldHandleStat, - _ref$storeKey = _ref.storeKey, - storeKey = _ref$storeKey === undefined ? 'store' : _ref$storeKey, - _ref$withRef = _ref.withRef, - withRef = _ref$withRef === undefined ? false : _ref$withRef, - connectOptions = _objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'renderCountProp', 'shouldHandleStateChanges', 'storeKey', 'withRef']); - - var subscriptionKey = storeKey + 'Subscription'; - var version = hotReloadingVersion++; - - var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = __WEBPACK_IMPORTED_MODULE_4__utils_PropTypes__["a" /* storeShape */], _contextTypes[subscriptionKey] = __WEBPACK_IMPORTED_MODULE_4__utils_PropTypes__["b" /* subscriptionShape */], _contextTypes); - var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = __WEBPACK_IMPORTED_MODULE_4__utils_PropTypes__["b" /* subscriptionShape */], _childContextTypes); - - return function wrapWithConnect(WrappedComponent) { - __WEBPACK_IMPORTED_MODULE_1_invariant___default()(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + (methodName + '. Instead received ' + JSON.stringify(WrappedComponent))); - - var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component'; - - var displayName = getDisplayName(wrappedComponentName); - - var selectorFactoryOptions = _extends({}, connectOptions, { - getDisplayName: getDisplayName, - methodName: methodName, - renderCountProp: renderCountProp, - shouldHandleStateChanges: shouldHandleStateChanges, - storeKey: storeKey, - withRef: withRef, - displayName: displayName, - wrappedComponentName: wrappedComponentName, - WrappedComponent: WrappedComponent - }); - - var Connect = function (_Component) { - _inherits(Connect, _Component); - - function Connect(props, context) { - _classCallCheck(this, Connect); - - var _this = _possibleConstructorReturn(this, _Component.call(this, props, context)); - - _this.version = version; - _this.state = {}; - _this.renderCount = 0; - _this.store = props[storeKey] || context[storeKey]; - _this.propsMode = Boolean(props[storeKey]); - _this.setWrappedInstance = _this.setWrappedInstance.bind(_this); - - __WEBPACK_IMPORTED_MODULE_1_invariant___default()(_this.store, 'Could not find "' + storeKey + '" in either the context or props of ' + ('"' + displayName + '". Either wrap the root component in a <Provider>, ') + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".')); - - _this.initSelector(); - _this.initSubscription(); - return _this; - } - - Connect.prototype.getChildContext = function getChildContext() { - var _ref2; - - // If this component received store from props, its subscription should be transparent - // to any descendants receiving store+subscription from context; it passes along - // subscription passed to it. Otherwise, it shadows the parent subscription, which allows - // Connect to control ordering of notifications to flow top-down. - var subscription = this.propsMode ? null : this.subscription; - return _ref2 = {}, _ref2[subscriptionKey] = subscription || this.context[subscriptionKey], _ref2; - }; - - Connect.prototype.componentDidMount = function componentDidMount() { - if (!shouldHandleStateChanges) return; - - // componentWillMount fires during server side rendering, but componentDidMount and - // componentWillUnmount do not. Because of this, trySubscribe happens during ...didMount. - // Otherwise, unsubscription would never take place during SSR, causing a memory leak. - // To handle the case where a child component may have triggered a state change by - // dispatching an action in its componentWillMount, we have to re-run the select and maybe - // re-render. - this.subscription.trySubscribe(); - this.selector.run(this.props); - if (this.selector.shouldComponentUpdate) this.forceUpdate(); - }; - - Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { - this.selector.run(nextProps); - }; - - Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() { - return this.selector.shouldComponentUpdate; - }; - - Connect.prototype.componentWillUnmount = function componentWillUnmount() { - if (this.subscription) this.subscription.tryUnsubscribe(); - this.subscription = null; - this.notifyNestedSubs = noop; - this.store = null; - this.selector.run = noop; - this.selector.shouldComponentUpdate = false; - }; - - Connect.prototype.getWrappedInstance = function getWrappedInstance() { - __WEBPACK_IMPORTED_MODULE_1_invariant___default()(withRef, 'To access the wrapped instance, you need to specify ' + ('{ withRef: true } in the options argument of the ' + methodName + '() call.')); - return this.wrappedInstance; - }; - - Connect.prototype.setWrappedInstance = function setWrappedInstance(ref) { - this.wrappedInstance = ref; - }; - - Connect.prototype.initSelector = function initSelector() { - var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions); - this.selector = makeSelectorStateful(sourceSelector, this.store); - this.selector.run(this.props); - }; - - Connect.prototype.initSubscription = function initSubscription() { - if (!shouldHandleStateChanges) return; - - // parentSub's source should match where store came from: props vs. context. A component - // connected to the store via props shouldn't use subscription from context, or vice versa. - var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey]; - this.subscription = new __WEBPACK_IMPORTED_MODULE_3__utils_Subscription__["a" /* default */](this.store, parentSub, this.onStateChange.bind(this)); - - // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in - // the middle of the notification loop, where `this.subscription` will then be null. An - // extra null check every change can be avoided by copying the method onto `this` and then - // replacing it with a no-op on unmount. This can probably be avoided if Subscription's - // listeners logic is changed to not call listeners that have been unsubscribed in the - // middle of the notification loop. - this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription); - }; - - Connect.prototype.onStateChange = function onStateChange() { - this.selector.run(this.props); - - if (!this.selector.shouldComponentUpdate) { - this.notifyNestedSubs(); - } else { - this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate; - this.setState(dummyState); - } - }; - - Connect.prototype.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() { - // `componentDidUpdate` is conditionally implemented when `onStateChange` determines it - // needs to notify nested subs. Once called, it unimplements itself until further state - // changes occur. Doing it this way vs having a permanent `componentDidUpdate` that does - // a boolean check every time avoids an extra method call most of the time, resulting - // in some perf boost. - this.componentDidUpdate = undefined; - this.notifyNestedSubs(); - }; - - Connect.prototype.isSubscribed = function isSubscribed() { - return Boolean(this.subscription) && this.subscription.isSubscribed(); - }; - - Connect.prototype.addExtraProps = function addExtraProps(props) { - if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props; - // make a shallow copy so that fields added don't leak to the original selector. - // this is especially important for 'ref' since that's a reference back to the component - // instance. a singleton memoized selector would then be holding a reference to the - // instance, preventing the instance from being garbage collected, and that would be bad - var withExtras = _extends({}, props); - if (withRef) withExtras.ref = this.setWrappedInstance; - if (renderCountProp) withExtras[renderCountProp] = this.renderCount++; - if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription; - return withExtras; - }; - - Connect.prototype.render = function render() { - var selector = this.selector; - selector.shouldComponentUpdate = false; - - if (selector.error) { - throw selector.error; - } else { - return Object(__WEBPACK_IMPORTED_MODULE_2_react__["createElement"])(WrappedComponent, this.addExtraProps(selector.props)); - } - }; - - return Connect; - }(__WEBPACK_IMPORTED_MODULE_2_react__["Component"]); - - Connect.WrappedComponent = WrappedComponent; - Connect.displayName = displayName; - Connect.childContextTypes = childContextTypes; - Connect.contextTypes = contextTypes; - Connect.propTypes = contextTypes; - - if (false) { - Connect.prototype.componentWillUpdate = function componentWillUpdate() { - var _this2 = this; - - // We are hot reloading! - if (this.version !== version) { - this.version = version; - this.initSelector(); - - // If any connected descendants don't hot reload (and resubscribe in the process), their - // listeners will be lost when we unsubscribe. Unfortunately, by copying over all - // listeners, this does mean that the old versions of connected descendants will still be - // notified of state changes; however, their onStateChange function is a no-op so this - // isn't a huge deal. - var oldListeners = []; - - if (this.subscription) { - oldListeners = this.subscription.listeners.get(); - this.subscription.tryUnsubscribe(); - } - this.initSubscription(); - if (shouldHandleStateChanges) { - this.subscription.trySubscribe(); - oldListeners.forEach(function (listener) { - return _this2.subscription.listeners.subscribe(listener); - }); - } - } - }; - } - - return __WEBPACK_IMPORTED_MODULE_0_hoist_non_react_statics___default()(Connect, WrappedComponent); - }; -} - -/***/ }), - -/***/ 1193: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = wrapMapToPropsConstant; -/* unused harmony export getDependsOnOwnProps */ -/* harmony export (immutable) */ __webpack_exports__["b"] = wrapMapToPropsFunc; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_verifyPlainObject__ = __webpack_require__(1194); - - -function wrapMapToPropsConstant(getConstant) { - return function initConstantSelector(dispatch, options) { - var constant = getConstant(dispatch, options); - - function constantSelector() { - return constant; - } - constantSelector.dependsOnOwnProps = false; - return constantSelector; - }; -} - -// dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args -// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine -// whether mapToProps needs to be invoked when props have changed. -// -// A length of one signals that mapToProps does not depend on props from the parent component. -// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and -// therefore not reporting its length accurately.. -function getDependsOnOwnProps(mapToProps) { - return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1; -} - -// Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction, -// this function wraps mapToProps in a proxy function which does several things: -// -// * Detects whether the mapToProps function being called depends on props, which -// is used by selectorFactory to decide if it should reinvoke on props changes. -// -// * On first call, handles mapToProps if returns another function, and treats that -// new function as the true mapToProps for subsequent calls. -// -// * On first call, verifies the first result is a plain object, in order to warn -// the developer that their mapToProps function is not returning a valid result. -// -function wrapMapToPropsFunc(mapToProps, methodName) { - return function initProxySelector(dispatch, _ref) { - var displayName = _ref.displayName; - - var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) { - return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch); - }; - - // allow detectFactoryAndVerify to get ownProps - proxy.dependsOnOwnProps = true; - - proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) { - proxy.mapToProps = mapToProps; - proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps); - var props = proxy(stateOrDispatch, ownProps); - - if (typeof props === 'function') { - proxy.mapToProps = props; - proxy.dependsOnOwnProps = getDependsOnOwnProps(props); - props = proxy(stateOrDispatch, ownProps); - } - - if (false) verifyPlainObject(props, displayName, methodName); - - return props; - }; - - return proxy; - }; -} - -/***/ }), - -/***/ 1194: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export default */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_lodash_es_isPlainObject__ = __webpack_require__(33); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__warning__ = __webpack_require__(1190); - - - -function verifyPlainObject(value, displayName, methodName) { - if (!Object(__WEBPACK_IMPORTED_MODULE_0_lodash_es_isPlainObject__["a" /* default */])(value)) { - Object(__WEBPACK_IMPORTED_MODULE_1__warning__["a" /* default */])(methodName + '() in ' + displayName + ' must return a plain object. Instead received ' + value + '.'); - } -} - -/***/ }), - -/***/ 1195: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = createProvider; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types__ = __webpack_require__(20); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prop_types__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_PropTypes__ = __webpack_require__(1191); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_warning__ = __webpack_require__(1190); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - - - - - -var didWarnAboutReceivingStore = false; -function warnAboutReceivingStore() { - if (didWarnAboutReceivingStore) { - return; - } - didWarnAboutReceivingStore = true; - - Object(__WEBPACK_IMPORTED_MODULE_3__utils_warning__["a" /* default */])('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.'); -} - -function createProvider() { - var _Provider$childContex; - - var storeKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'store'; - var subKey = arguments[1]; - - var subscriptionKey = subKey || storeKey + 'Subscription'; - - var Provider = function (_Component) { - _inherits(Provider, _Component); - - Provider.prototype.getChildContext = function getChildContext() { - var _ref; - - return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref; - }; - - function Provider(props, context) { - _classCallCheck(this, Provider); - - var _this = _possibleConstructorReturn(this, _Component.call(this, props, context)); - - _this[storeKey] = props.store; - return _this; - } - - Provider.prototype.render = function render() { - return __WEBPACK_IMPORTED_MODULE_0_react__["Children"].only(this.props.children); - }; - - return Provider; - }(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]); - - if (false) { - Provider.prototype.componentWillReceiveProps = function (nextProps) { - if (this[storeKey] !== nextProps.store) { - warnAboutReceivingStore(); - } - }; - } - - Provider.propTypes = { - store: __WEBPACK_IMPORTED_MODULE_2__utils_PropTypes__["a" /* storeShape */].isRequired, - children: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.element.isRequired - }; - Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[storeKey] = __WEBPACK_IMPORTED_MODULE_2__utils_PropTypes__["a" /* storeShape */].isRequired, _Provider$childContex[subscriptionKey] = __WEBPACK_IMPORTED_MODULE_2__utils_PropTypes__["b" /* subscriptionShape */], _Provider$childContex); - - return Provider; -} - -/* harmony default export */ __webpack_exports__["b"] = (createProvider()); - -/***/ }), - -/***/ 1196: -/***/ (function(module, exports, __webpack_require__) { - -/** - * Copyright 2015, Yahoo! Inc. - * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. - */ -(function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.hoistNonReactStatics = factory()); -}(this, (function () { - 'use strict'; - - var REACT_STATICS = { - childContextTypes: true, - contextTypes: true, - defaultProps: true, - displayName: true, - getDefaultProps: true, - getDerivedStateFromProps: true, - mixins: true, - propTypes: true, - type: true - }; - - var KNOWN_STATICS = { - name: true, - length: true, - prototype: true, - caller: true, - callee: true, - arguments: true, - arity: true - }; - - var defineProperty = Object.defineProperty; - var getOwnPropertyNames = Object.getOwnPropertyNames; - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - var getPrototypeOf = Object.getPrototypeOf; - var objectPrototype = getPrototypeOf && getPrototypeOf(Object); - - return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { - if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components - - if (objectPrototype) { - var inheritedComponent = getPrototypeOf(sourceComponent); - if (inheritedComponent && inheritedComponent !== objectPrototype) { - hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); - } - } - - var keys = getOwnPropertyNames(sourceComponent); - - if (getOwnPropertySymbols) { - keys = keys.concat(getOwnPropertySymbols(sourceComponent)); - } - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { - var descriptor = getOwnPropertyDescriptor(sourceComponent, key); - try { // Avoid failures from read-only properties - defineProperty(targetComponent, key, descriptor); - } catch (e) {} - } - } - - return targetComponent; - } - - return targetComponent; - }; -}))); - - -/***/ }), - -/***/ 1197: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscription; }); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// encapsulates the subscription logic for connecting a component to the redux store, as -// well as nesting subscriptions of descendant components, so that we can ensure the -// ancestor components re-render before descendants - -var CLEARED = null; -var nullListeners = { - notify: function notify() {} -}; - -function createListenerCollection() { - // the current/next pattern is copied from redux's createStore code. - // TODO: refactor+expose that code to be reusable here? - var current = []; - var next = []; - - return { - clear: function clear() { - next = CLEARED; - current = CLEARED; - }, - notify: function notify() { - var listeners = current = next; - for (var i = 0; i < listeners.length; i++) { - listeners[i](); - } - }, - get: function get() { - return next; - }, - subscribe: function subscribe(listener) { - var isSubscribed = true; - if (next === current) next = current.slice(); - next.push(listener); - - return function unsubscribe() { - if (!isSubscribed || current === CLEARED) return; - isSubscribed = false; - - if (next === current) next = current.slice(); - next.splice(next.indexOf(listener), 1); - }; - } - }; -} - -var Subscription = function () { - function Subscription(store, parentSub, onStateChange) { - _classCallCheck(this, Subscription); - - this.store = store; - this.parentSub = parentSub; - this.onStateChange = onStateChange; - this.unsubscribe = null; - this.listeners = nullListeners; - } - - Subscription.prototype.addNestedSub = function addNestedSub(listener) { - this.trySubscribe(); - return this.listeners.subscribe(listener); - }; - - Subscription.prototype.notifyNestedSubs = function notifyNestedSubs() { - this.listeners.notify(); - }; - - Subscription.prototype.isSubscribed = function isSubscribed() { - return Boolean(this.unsubscribe); - }; - - Subscription.prototype.trySubscribe = function trySubscribe() { - if (!this.unsubscribe) { - this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange); - - this.listeners = createListenerCollection(); - } - }; - - Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() { - if (this.unsubscribe) { - this.unsubscribe(); - this.unsubscribe = null; - this.listeners.clear(); - this.listeners = nullListeners; - } - }; - - return Subscription; -}(); - - - -/***/ }), - -/***/ 1198: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export createConnect */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_connectAdvanced__ = __webpack_require__(1192); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_shallowEqual__ = __webpack_require__(1199); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__mapDispatchToProps__ = __webpack_require__(1200); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__mapStateToProps__ = __webpack_require__(1201); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__mergeProps__ = __webpack_require__(1202); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__selectorFactory__ = __webpack_require__(1203); -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - - - - - - - - -/* - connect is a facade over connectAdvanced. It turns its args into a compatible - selectorFactory, which has the signature: - - (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps - - connect passes its args to connectAdvanced as options, which will in turn pass them to - selectorFactory each time a Connect component instance is instantiated or hot reloaded. - - selectorFactory returns a final props selector from its mapStateToProps, - mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps, - mergePropsFactories, and pure args. - - The resulting final props selector is called by the Connect component instance whenever - it receives new props or store state. - */ - -function match(arg, factories, name) { - for (var i = factories.length - 1; i >= 0; i--) { - var result = factories[i](arg); - if (result) return result; - } - - return function (dispatch, options) { - throw new Error('Invalid value of type ' + typeof arg + ' for ' + name + ' argument when connecting component ' + options.wrappedComponentName + '.'); - }; -} - -function strictEqual(a, b) { - return a === b; -} - -// createConnect with default args builds the 'official' connect behavior. Calling it with -// different options opens up some testing and extensibility scenarios -function createConnect() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$connectHOC = _ref.connectHOC, - connectHOC = _ref$connectHOC === undefined ? __WEBPACK_IMPORTED_MODULE_0__components_connectAdvanced__["a" /* default */] : _ref$connectHOC, - _ref$mapStateToPropsF = _ref.mapStateToPropsFactories, - mapStateToPropsFactories = _ref$mapStateToPropsF === undefined ? __WEBPACK_IMPORTED_MODULE_3__mapStateToProps__["a" /* default */] : _ref$mapStateToPropsF, - _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories, - mapDispatchToPropsFactories = _ref$mapDispatchToPro === undefined ? __WEBPACK_IMPORTED_MODULE_2__mapDispatchToProps__["a" /* default */] : _ref$mapDispatchToPro, - _ref$mergePropsFactor = _ref.mergePropsFactories, - mergePropsFactories = _ref$mergePropsFactor === undefined ? __WEBPACK_IMPORTED_MODULE_4__mergeProps__["a" /* default */] : _ref$mergePropsFactor, - _ref$selectorFactory = _ref.selectorFactory, - selectorFactory = _ref$selectorFactory === undefined ? __WEBPACK_IMPORTED_MODULE_5__selectorFactory__["a" /* default */] : _ref$selectorFactory; - - return function connect(mapStateToProps, mapDispatchToProps, mergeProps) { - var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, - _ref2$pure = _ref2.pure, - pure = _ref2$pure === undefined ? true : _ref2$pure, - _ref2$areStatesEqual = _ref2.areStatesEqual, - areStatesEqual = _ref2$areStatesEqual === undefined ? strictEqual : _ref2$areStatesEqual, - _ref2$areOwnPropsEqua = _ref2.areOwnPropsEqual, - areOwnPropsEqual = _ref2$areOwnPropsEqua === undefined ? __WEBPACK_IMPORTED_MODULE_1__utils_shallowEqual__["a" /* default */] : _ref2$areOwnPropsEqua, - _ref2$areStatePropsEq = _ref2.areStatePropsEqual, - areStatePropsEqual = _ref2$areStatePropsEq === undefined ? __WEBPACK_IMPORTED_MODULE_1__utils_shallowEqual__["a" /* default */] : _ref2$areStatePropsEq, - _ref2$areMergedPropsE = _ref2.areMergedPropsEqual, - areMergedPropsEqual = _ref2$areMergedPropsE === undefined ? __WEBPACK_IMPORTED_MODULE_1__utils_shallowEqual__["a" /* default */] : _ref2$areMergedPropsE, - extraOptions = _objectWithoutProperties(_ref2, ['pure', 'areStatesEqual', 'areOwnPropsEqual', 'areStatePropsEqual', 'areMergedPropsEqual']); - - var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps'); - var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps'); - var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps'); - - return connectHOC(selectorFactory, _extends({ - // used in error messages - methodName: 'connect', - - // used to compute Connect's displayName from the wrapped component's displayName. - getDisplayName: function getDisplayName(name) { - return 'Connect(' + name + ')'; - }, - - // if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes - shouldHandleStateChanges: Boolean(mapStateToProps), - - // passed through to selectorFactory - initMapStateToProps: initMapStateToProps, - initMapDispatchToProps: initMapDispatchToProps, - initMergeProps: initMergeProps, - pure: pure, - areStatesEqual: areStatesEqual, - areOwnPropsEqual: areOwnPropsEqual, - areStatePropsEqual: areStatePropsEqual, - areMergedPropsEqual: areMergedPropsEqual - - }, extraOptions)); - }; -} - -/* harmony default export */ __webpack_exports__["a"] = (createConnect()); - -/***/ }), - -/***/ 1199: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = shallowEqual; -var hasOwn = Object.prototype.hasOwnProperty; - -function is(x, y) { - if (x === y) { - return x !== 0 || y !== 0 || 1 / x === 1 / y; - } else { - return x !== x && y !== y; - } -} - -function shallowEqual(objA, objB) { - if (is(objA, objB)) return true; - - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false; - } - - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); - - if (keysA.length !== keysB.length) return false; - - for (var i = 0; i < keysA.length; i++) { - if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { - return false; - } - } - - return true; -} - -/***/ }), - /***/ 120: /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is @@ -2124,267 +1222,16 @@ process.cwd = function () { return '/' } process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), -/***/ 1200: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export whenMapDispatchToPropsIsFunction */ -/* unused harmony export whenMapDispatchToPropsIsMissing */ -/* unused harmony export whenMapDispatchToPropsIsObject */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_redux__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__wrapMapToProps__ = __webpack_require__(1193); - - - -function whenMapDispatchToPropsIsFunction(mapDispatchToProps) { - return typeof mapDispatchToProps === 'function' ? Object(__WEBPACK_IMPORTED_MODULE_1__wrapMapToProps__["b" /* wrapMapToPropsFunc */])(mapDispatchToProps, 'mapDispatchToProps') : undefined; -} - -function whenMapDispatchToPropsIsMissing(mapDispatchToProps) { - return !mapDispatchToProps ? Object(__WEBPACK_IMPORTED_MODULE_1__wrapMapToProps__["a" /* wrapMapToPropsConstant */])(function (dispatch) { - return { dispatch: dispatch }; - }) : undefined; -} - -function whenMapDispatchToPropsIsObject(mapDispatchToProps) { - return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? Object(__WEBPACK_IMPORTED_MODULE_1__wrapMapToProps__["a" /* wrapMapToPropsConstant */])(function (dispatch) { - return Object(__WEBPACK_IMPORTED_MODULE_0_redux__["bindActionCreators"])(mapDispatchToProps, dispatch); - }) : undefined; -} - -/* harmony default export */ __webpack_exports__["a"] = ([whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject]); - -/***/ }), - -/***/ 1201: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export whenMapStateToPropsIsFunction */ -/* unused harmony export whenMapStateToPropsIsMissing */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__wrapMapToProps__ = __webpack_require__(1193); - - -function whenMapStateToPropsIsFunction(mapStateToProps) { - return typeof mapStateToProps === 'function' ? Object(__WEBPACK_IMPORTED_MODULE_0__wrapMapToProps__["b" /* wrapMapToPropsFunc */])(mapStateToProps, 'mapStateToProps') : undefined; -} - -function whenMapStateToPropsIsMissing(mapStateToProps) { - return !mapStateToProps ? Object(__WEBPACK_IMPORTED_MODULE_0__wrapMapToProps__["a" /* wrapMapToPropsConstant */])(function () { - return {}; - }) : undefined; -} - -/* harmony default export */ __webpack_exports__["a"] = ([whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing]); - -/***/ }), - -/***/ 1202: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export defaultMergeProps */ -/* unused harmony export wrapMergePropsFunc */ -/* unused harmony export whenMergePropsIsFunction */ -/* unused harmony export whenMergePropsIsOmitted */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_verifyPlainObject__ = __webpack_require__(1194); -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - - - -function defaultMergeProps(stateProps, dispatchProps, ownProps) { - return _extends({}, ownProps, stateProps, dispatchProps); -} - -function wrapMergePropsFunc(mergeProps) { - return function initMergePropsProxy(dispatch, _ref) { - var displayName = _ref.displayName, - pure = _ref.pure, - areMergedPropsEqual = _ref.areMergedPropsEqual; - - var hasRunOnce = false; - var mergedProps = void 0; - - return function mergePropsProxy(stateProps, dispatchProps, ownProps) { - var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps); - - if (hasRunOnce) { - if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps; - } else { - hasRunOnce = true; - mergedProps = nextMergedProps; - - if (false) verifyPlainObject(mergedProps, displayName, 'mergeProps'); - } - - return mergedProps; - }; - }; -} - -function whenMergePropsIsFunction(mergeProps) { - return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined; -} - -function whenMergePropsIsOmitted(mergeProps) { - return !mergeProps ? function () { - return defaultMergeProps; - } : undefined; -} - -/* harmony default export */ __webpack_exports__["a"] = ([whenMergePropsIsFunction, whenMergePropsIsOmitted]); - -/***/ }), - -/***/ 1203: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export impureFinalPropsSelectorFactory */ -/* unused harmony export pureFinalPropsSelectorFactory */ -/* harmony export (immutable) */ __webpack_exports__["a"] = finalPropsSelectorFactory; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__verifySubselectors__ = __webpack_require__(1204); -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - - - -function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) { - return function impureFinalPropsSelector(state, ownProps) { - return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps); - }; -} - -function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) { - var areStatesEqual = _ref.areStatesEqual, - areOwnPropsEqual = _ref.areOwnPropsEqual, - areStatePropsEqual = _ref.areStatePropsEqual; - - var hasRunAtLeastOnce = false; - var state = void 0; - var ownProps = void 0; - var stateProps = void 0; - var dispatchProps = void 0; - var mergedProps = void 0; - - function handleFirstCall(firstState, firstOwnProps) { - state = firstState; - ownProps = firstOwnProps; - stateProps = mapStateToProps(state, ownProps); - dispatchProps = mapDispatchToProps(dispatch, ownProps); - mergedProps = mergeProps(stateProps, dispatchProps, ownProps); - hasRunAtLeastOnce = true; - return mergedProps; - } - - function handleNewPropsAndNewState() { - stateProps = mapStateToProps(state, ownProps); - - if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); - - mergedProps = mergeProps(stateProps, dispatchProps, ownProps); - return mergedProps; - } - - function handleNewProps() { - if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps); - - if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); - - mergedProps = mergeProps(stateProps, dispatchProps, ownProps); - return mergedProps; - } - - function handleNewState() { - var nextStateProps = mapStateToProps(state, ownProps); - var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps); - stateProps = nextStateProps; - - if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps); - - return mergedProps; - } - - function handleSubsequentCalls(nextState, nextOwnProps) { - var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps); - var stateChanged = !areStatesEqual(nextState, state); - state = nextState; - ownProps = nextOwnProps; - - if (propsChanged && stateChanged) return handleNewPropsAndNewState(); - if (propsChanged) return handleNewProps(); - if (stateChanged) return handleNewState(); - return mergedProps; - } - - return function pureFinalPropsSelector(nextState, nextOwnProps) { - return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps); - }; -} - -// TODO: Add more comments - -// If pure is true, the selector returned by selectorFactory will memoize its results, -// allowing connectAdvanced's shouldComponentUpdate to return false if final -// props have not changed. If false, the selector will always return a new -// object and shouldComponentUpdate will always return true. - -function finalPropsSelectorFactory(dispatch, _ref2) { - var initMapStateToProps = _ref2.initMapStateToProps, - initMapDispatchToProps = _ref2.initMapDispatchToProps, - initMergeProps = _ref2.initMergeProps, - options = _objectWithoutProperties(_ref2, ['initMapStateToProps', 'initMapDispatchToProps', 'initMergeProps']); - - var mapStateToProps = initMapStateToProps(dispatch, options); - var mapDispatchToProps = initMapDispatchToProps(dispatch, options); - var mergeProps = initMergeProps(dispatch, options); - - if (false) { - verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName); - } - - var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory; - - return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options); -} - -/***/ }), - -/***/ 1204: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export default */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_warning__ = __webpack_require__(1190); - - -function verify(selector, methodName, displayName) { - if (!selector) { - throw new Error('Unexpected value for ' + methodName + ' in ' + displayName + '.'); - } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') { - if (!selector.hasOwnProperty('dependsOnOwnProps')) { - Object(__WEBPACK_IMPORTED_MODULE_0__utils_warning__["a" /* default */])('The selector for ' + methodName + ' of ' + displayName + ' did not specify a value for dependsOnOwnProps.'); - } - } -} - -function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) { - verify(mapStateToProps, 'mapStateToProps', displayName); - verify(mapDispatchToProps, 'mapDispatchToProps', displayName); - verify(mergeProps, 'mergeProps', displayName); -} - -/***/ }), - /***/ 121: /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the @@ -2560,193 +1407,23 @@ var objectKeys = Object.keys || function if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); } return res; }; /***/ }), -/***/ 123: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Symbol_js__ = __webpack_require__(34); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getRawTag_js__ = __webpack_require__(127); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__objectToString_js__ = __webpack_require__(128); - - - - -/** `Object#toString` result references. */ -var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - -/** Built-in value references. */ -var symToStringTag = __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */] ? __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */].toStringTag : undefined; - -/** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? Object(__WEBPACK_IMPORTED_MODULE_1__getRawTag_js__["a" /* default */])(value) - : Object(__WEBPACK_IMPORTED_MODULE_2__objectToString_js__["a" /* default */])(value); -} - -/* harmony default export */ __webpack_exports__["a"] = (baseGetTag); - - -/***/ }), - /***/ 1233: /***/ (function(module, exports) { 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/. --><svg viewBox=\"0 0 256 296\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"xMidYMid\"><g><polygon fill=\"#673AB8\" points=\"128 0 256 73.8999491 256 221.699847 128 295.599796 0 221.699847 0 73.8999491\"></polygon><path d=\"M34.8647584,220.478469 C51.8814262,242.25881 105.959701,225.662965 157.014868,185.774297 C208.070035,145.885628 237.255632,97.428608 220.238964,75.6482664 C203.222296,53.8679249 149.144022,70.4637701 98.0888543,110.352439 C47.0336869,150.241107 17.8480906,198.698127 34.8647584,220.478469 Z M42.1343351,214.798853 C36.4908625,207.575537 38.9565723,193.395881 49.7081913,175.544904 C61.0297348,156.747677 80.2490923,135.997367 103.76847,117.622015 C127.287848,99.2466634 152.071368,85.6181573 173.049166,79.1803727 C192.970945,73.066665 207.325915,74.1045667 212.969387,81.3278822 C218.61286,88.5511977 216.14715,102.730854 205.395531,120.581832 C194.073987,139.379058 174.85463,160.129368 151.335252,178.50472 C127.815874,196.880072 103.032354,210.508578 82.054556,216.946362 C62.1327769,223.06007 47.7778077,222.022168 42.1343351,214.798853 Z\" fill=\"#FFFFFF\"></path><path d=\"M220.238964,220.478469 C237.255632,198.698127 208.070035,150.241107 157.014868,110.352439 C105.959701,70.4637701 51.8814262,53.8679249 34.8647584,75.6482664 C17.8480906,97.428608 47.0336869,145.885628 98.0888543,185.774297 C149.144022,225.662965 203.222296,242.25881 220.238964,220.478469 Z M212.969387,214.798853 C207.325915,222.022168 192.970945,223.06007 173.049166,216.946362 C152.071368,210.508578 127.287848,196.880072 103.76847,178.50472 C80.2490923,160.129368 61.0297348,139.379058 49.7081913,120.581832 C38.9565723,102.730854 36.4908625,88.5511977 42.1343351,81.3278822 C47.7778077,74.1045667 62.1327769,73.066665 82.054556,79.1803727 C103.032354,85.6181573 127.815874,99.2466634 151.335252,117.622015 C174.85463,135.997367 194.073987,156.747677 205.395531,175.544904 C216.14715,193.395881 218.61286,207.575537 212.969387,214.798853 Z\" fill=\"#FFFFFF\"></path><path d=\"M127.551861,167.666971 C138.378632,167.666971 147.155465,158.890139 147.155465,148.063368 C147.155465,137.236596 138.378632,128.459764 127.551861,128.459764 C116.72509,128.459764 107.948257,137.236596 107.948257,148.063368 C107.948257,158.890139 116.72509,167.666971 127.551861,167.666971 L127.551861,167.666971 Z\" fill=\"#FFFFFF\"></path></g></svg>" /***/ }), -/***/ 124: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__freeGlobal_js__ = __webpack_require__(125); - - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = __WEBPACK_IMPORTED_MODULE_0__freeGlobal_js__["a" /* default */] || freeSelf || Function('return this')(); - -/* harmony default export */ __webpack_exports__["a"] = (root); - - -/***/ }), - -/***/ 125: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/* harmony default export */ __webpack_exports__["a"] = (freeGlobal); - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(792))) - -/***/ }), - -/***/ 127: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Symbol_js__ = __webpack_require__(34); - - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; - -/** Built-in value references. */ -var symToStringTag = __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */] ? __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */].toStringTag : undefined; - -/** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ -function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; -} - -/* harmony default export */ __webpack_exports__["a"] = (getRawTag); - - -/***/ }), - -/***/ 128: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; - -/** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ -function objectToString(value) { - return nativeObjectToString.call(value); -} - -/* harmony default export */ __webpack_exports__["a"] = (objectToString); - - -/***/ }), - -/***/ 129: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__overArg_js__ = __webpack_require__(130); - - -/** Built-in value references. */ -var getPrototype = Object(__WEBPACK_IMPORTED_MODULE_0__overArg_js__["a" /* default */])(Object.getPrototypeOf, Object); - -/* harmony default export */ __webpack_exports__["a"] = (getPrototype); - - -/***/ }), - /***/ 1290: /***/ (function(module, exports) { 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/. --><svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 512 512\" enable-background=\"new 0 0 512 512\" xml:space=\"preserve\"><g id=\"Layer_2\"><path fill=\"#132028\" d=\"M190.475,376V203.308H81.266c-27.129,0-50.139,26-58.222,62.035c-9.877,1.302-17.62,13.541-17.62,28.455 c0,14.914,7.743,27.153,17.62,28.455c7.291,32.507,26.733,56.84,50.385,61.294v68.669h395.95V376H190.475z\"></path></g><g id=\"Layer_3\"><path fill=\"#575A5B\" d=\"M490.712,427.977c0,30.941-25.082,56.023-56.023,56.023c-25.804,0-47.519-17.451-54.023-41.19 c-6.504,23.739-28.219,41.19-54.023,41.19c-30.941,0-56.023-25.082-56.023-56.023c0-30.941,25.082-56.023,56.023-56.023 c25.804,0,47.519,17.451,54.023,41.19c6.504-23.739,28.219-41.19,54.023-41.19C465.629,371.954,490.712,397.036,490.712,427.977z M161.24,203.308l29.75-113.845H94.232l29.75,113.845h-13.668c-33.865,0-61.319,40.513-61.319,90.489 c0,49.976,27.453,90.489,61.319,90.489H294.27V203.308H161.24z M162.321,420.431c-13.164,0-24.458,8.002-29.285,19.408 c-4.826-11.405-16.121-19.408-29.284-19.408c-17.554,0-31.785,14.23-31.785,31.784c0,17.554,14.23,31.785,31.785,31.785 c13.164,0,24.458-8.002,29.284-19.408C137.863,475.998,149.157,484,162.321,484c17.554,0,31.784-14.23,31.784-31.785 C194.106,434.661,179.875,420.431,162.321,420.431z\"></path></g><g id=\"Layer_4\"><path fill=\"#FFB636\" d=\"M200.78,384.287h-16.028c-20.105,0-36.403-40.513-36.403-90.489c0-49.976,16.298-90.489,36.403-90.489 h16.028c-20.105,0-36.403,40.513-36.403,90.489C164.378,343.773,180.676,384.287,200.78,384.287z M122.236,293.797 c0-49.976,16.298-90.489,36.403-90.489H142.61c-20.105,0-36.403,40.513-36.403,90.489c0,49.976,16.298,90.489,36.403,90.489h16.028 C138.534,384.287,122.236,343.773,122.236,293.797z\"></path></g><g id=\"Layer_5\"><path fill=\"#FF473E\" d=\"M489.353,384.287H294.27V85.761h195.083V384.287z M74.21,384.103h-7.99c-2.436,0-4.707,1.48-6.035,3.934 l-43.633,80.594C13.436,474.387,16.874,482,22.587,482h52.826c4.027,0,7.271-3.968,7.199-8.806l-1.203-80.594 C81.339,387.883,78.136,384.103,74.21,384.103z\"></path></g><g id=\"Layer_6\"><path fill=\"#EF2020\" d=\"M497.28,66.397H286.342c-5.92,0-10.72,4.8-10.72,10.72v1.626c0,5.92,4.8,10.72,10.72,10.72H497.28 c5.921,0,10.72-4.8,10.72-10.72v-1.626C508,71.197,503.201,66.397,497.28,66.397z\"></path></g><g id=\"Layer_7\"><path fill=\"#76DFFF\" d=\"M371.466,257.523h-40.952c-3.976,0-7.2-3.224-7.2-7.2V124.018c0-3.976,3.224-7.2,7.2-7.2h40.952 c3.976,0,7.2,3.224,7.2,7.2v126.305C378.666,254.3,375.442,257.523,371.466,257.523z M460.474,250.323V124.018 c0-3.976-3.224-7.2-7.2-7.2h-40.952c-3.976,0-7.2,3.224-7.2,7.2v126.305c0,3.976,3.224,7.2,7.2,7.2h40.952 C457.251,257.523,460.474,254.3,460.474,250.323z\"></path></g><g id=\"Layer_8\"><path fill=\"#132028\" d=\"M489.353,339.586H294.27v-36.582h195.083V339.586z M111.17,52L94.206,89.463h96.758L174,52H111.17z M326.643,414.954c-7.192,0-13.023,5.831-13.023,13.023S319.451,441,326.643,441c7.192,0,13.023-5.831,13.023-13.023 S333.835,414.954,326.643,414.954z M434.689,414.954c-7.192,0-13.023,5.831-13.023,13.023S427.496,441,434.689,441 s13.023-5.831,13.023-13.023S441.881,414.954,434.689,414.954z M103.752,444.827c-4.081,0-7.389,3.308-7.389,7.389 s3.308,7.389,7.389,7.389c4.081,0,7.389-3.308,7.389-7.389S107.833,444.827,103.752,444.827z M162.321,444.827 c-4.081,0-7.389,3.308-7.389,7.389s3.308,7.389,7.389,7.389s7.389-3.308,7.389-7.389S166.402,444.827,162.321,444.827z\"></path></g><g id=\"Layer_9\"><path fill=\"#FFB636\" d=\"M196.709,444.208h-92.957c-4.91,0-8.891-3.98-8.891-8.891s3.98-8.891,8.891-8.891h90.449l36.759-22.53 c1.398-0.857,3.006-1.311,4.646-1.311H459.54c4.91,0,8.891,3.98,8.891,8.891s-3.98,8.891-8.891,8.891H238.114l-36.759,22.53 C199.957,443.755,198.349,444.208,196.709,444.208z\"></path></g><g id=\"Layer_10\"><path fill=\"#ADB7BC\" d=\"M69.849,393.079c-5.787,0-10.485-4.685-10.5-10.475c-0.014-5.799,4.676-10.512,10.475-10.525l413.924-1 c0.009,0,0.018,0,0.026,0c5.787,0,10.485,4.685,10.499,10.475c0.014,5.799-4.676,10.512-10.475,10.525l-413.924,1 C69.867,393.079,69.857,393.079,69.849,393.079z\"></path></g></svg>" /***/ }), /***/ 1295: @@ -2758,60 +1435,16 @@ module.exports = "<!-- This Source Code /***/ 1296: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/***/ 1298: -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), - -/***/ 1299: -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), - -/***/ 130: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} - -/* harmony default export */ __webpack_exports__["a"] = (overArg); - - -/***/ }), - -/***/ 1300: -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), - /***/ 1301: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 1302: @@ -4289,17 +2922,17 @@ module.exports = { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var I = _interopRequireWildcard(_immutable); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } /** * Make an immutable record type * @@ -4327,231 +2960,16 @@ function makeRecord(spec) { * This depends on a performance fix that will go out in 0.29 though; * @module utils/makeRecord */ exports.default = makeRecord; /***/ }), -/***/ 1362: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* 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/. */ - -/* global window, document, DebuggerConfig */ - -const { bindActionCreators, combineReducers } = __webpack_require__(3); -const { Provider } = __webpack_require__(1189); - -const { defer } = __webpack_require__(1412); -const { debugGlobal } = __webpack_require__(1460); -const { setConfig, getValue, isDevelopment } = __webpack_require__(1355); -const L10N = __webpack_require__(1462); -const { showMenu, buildMenu } = __webpack_require__(1413); - -setConfig({"environment":"firefox-panel","logging":false,"clientLogging":false,"firefox":{"mcPath":"./firefox"},"workers":{"parserURL":"resource://devtools/client/debugger/new/parser-worker.js","prettyPrintURL":"resource://devtools/client/debugger/new/pretty-print-worker.js","searchURL":"resource://devtools/client/debugger/new/search-worker.js"},"features":{}}); - -// Set various flags before requiring app code. -if (getValue("logging.client")) { - // DevToolsUtils.dumpn.wantLogging = true; -} - -const { firefox, chrome, startDebugging } = __webpack_require__(1470); -const Root = __webpack_require__(1476); - -// Using this static variable allows webpack to know at compile-time -// to avoid this require and not include it at all in the output. -if (false) { - require("devtools-mc-assets/assets/devtools/client/themes/light-theme.css"); - require("devtools-mc-assets/assets/devtools/client/themes/dark-theme.css"); - require("devtools-mc-assets/assets/devtools/client/themes/firebug-theme.css"); -} - -function updateTheme(className) { - if (false) { - const theme = getValue("theme"); - const root = document.body.parentNode; - const appRoot = document.querySelector(".launchpad-root"); - - root.className = ""; - appRoot.className = className; - - root.classList.add(`theme-${theme}`); - appRoot.classList.add(`theme-${theme}`); - } -} - -function updatePlatform(className) { - if (false) { - const root = document.body.parentNode; - const appRoot = document.querySelector(".launchpad-root"); - - const agent = navigator.userAgent.toLowerCase(); - const win = agent.indexOf("windows") > -1 ? "win" : "linux"; - const platform = agent.indexOf("mac os") > -1 ? "mac" : win; - - root.classList.add("html"); - appRoot.setAttribute("platform", platform); - } -} - -function updateDir() { - const dir = getValue("dir"); - const root = document.body.parentNode; - root.dir = dir; -} - -async function updateConfig() { - const response = await fetch("/getconfig", { - method: "get" - }); - - const config = await response.json(); - setConfig(config); - return config; -} - -async function initApp() { - const configureStore = __webpack_require__(1477); - const reducers = __webpack_require__(1486); - const LaunchpadApp = __webpack_require__(1489); - - const createStore = configureStore({ - log: getValue("logging.actions"), - makeThunkArgs: (args, state) => { - return Object.assign({}, args, {}); - } - }); - - const store = createStore(combineReducers(reducers)); - const actions = bindActionCreators(__webpack_require__(1415), store.dispatch); - - debugGlobal("launchpadStore", store); - - if (isDevelopment()) { - const config = await updateConfig(); - actions.setConfig(config); - // AppConstants.DEBUG_JS_MODULES = true; - } - - return { store, actions, LaunchpadApp }; -} - -function renderRoot(_React, _ReactDOM, component, _store, props) { - const { createElement } = _React; - const mount = document.querySelector("#mount"); - - // bail in test environments that do not have a mount - if (!mount) { - return; - } - - const className = "launchpad-root theme-body"; - const root = Root(className); - mount.appendChild(root); - - if (isDevelopment()) { - updateConfig(); - updateTheme(className); - updatePlatform(); - } - - if (component.props || component.propTypes) { - _ReactDOM.render(createElement(Provider, { store: _store }, createElement(component, props)), root); - } else { - root.appendChild(component); - } -} - -function unmountRoot(_ReactDOM) { - const mount = document.querySelector("#mount .launchpad-root"); - _ReactDOM.unmountComponentAtNode(mount); -} - -function getTargetFromQuery() { - const href = window.location.href; - const nodeMatch = href.match(/node-tab=([^&#]*)/); - const firefoxMatch = href.match(/firefox-tab=([^&#]*)/); - const chromeMatch = href.match(/chrome-tab=([^&#]*)/); - - if (nodeMatch) { - return { type: "node", param: nodeMatch[1] }; - } else if (firefoxMatch) { - return { type: "firefox", param: firefoxMatch[1] }; - } else if (chromeMatch) { - return { type: "chrome", param: chromeMatch[1] }; - } - - return null; -} - -async function connectClients(actions) { - const firefoxTabs = await firefox.connectClient(); - actions.newTabs(firefoxTabs); - - chrome.connectClient().then(actions.newTabs); - - chrome.connectNodeClient().then(actions.newTabs); -} - -async function getTabs(actions) { - const firefoxTabs = await firefox.connectClient(); - const chromeTabs = await chrome.connectClient(); - const nodeTabs = await chrome.connectNodeClient(); - - actions.clearTabs(); - - actions.newTabs(firefoxTabs); - actions.newTabs(chromeTabs); - actions.newTabs(nodeTabs); -} - -async function bootstrap(React, ReactDOM) { - const connTarget = getTargetFromQuery(); - if (connTarget) { - const debuggedTarget = await startDebugging(connTarget); - - if (debuggedTarget) { - const { tab, tabConnection } = debuggedTarget; - await updateConfig(); - return { tab, connTarget, tabConnection }; - } - - console.info("Tab closed due to missing debugged target window."); - } - - const { store, actions, LaunchpadApp } = await initApp(); - renderRoot(React, ReactDOM, LaunchpadApp, store); - await connectClients(actions); - setInterval(async () => await getTabs(actions), 3000); - - return undefined; -} - -module.exports = { - bootstrap, - buildMenu, - debugGlobal, - defer, - renderRoot, - L10N, - showMenu, - unmountRoot, - updateTheme, - updateDir -}; - -/***/ }), - /***/ 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); @@ -5024,26 +3442,27 @@ var _extends = Object.assign || function /** * Sources reducer * @module reducers/sources */ exports.initialSourcesState = initialSourcesState; exports.removeSourceFromTabList = removeSourceFromTabList; exports.removeSourcesFromTabList = removeSourcesFromTabList; +exports.getBlackBoxList = getBlackBoxList; exports.getNewSelectedSourceId = getNewSelectedSourceId; exports.getSource = getSource; exports.getSourceByURL = getSourceByURL; exports.getGeneratedSource = getGeneratedSource; exports.getPendingSelectedLocation = getPendingSelectedLocation; exports.getPrettySource = getPrettySource; exports.hasPrettySource = hasPrettySource; exports.getSourceInSources = getSourceInSources; -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var I = _interopRequireWildcard(_immutable); var _reselect = __webpack_require__(993); var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); @@ -5145,17 +3564,20 @@ function update(state = initialSourcesSt _prefs.prefs.tabs = action.tabs; return state.merge({ tabs: action.tabs }); case "LOAD_SOURCE_TEXT": return setSourceTextProps(state, action); case "BLACKBOX": if (action.status === "done") { - return state.setIn(["sources", action.source.id, "isBlackBoxed"], action.value.isBlackBoxed); + const url = action.source.url; + const isBlackBoxed = action.value.isBlackBoxed; + updateBlackBoxList(url, isBlackBoxed); + return state.setIn(["sources", action.source.id, "isBlackBoxed"], isBlackBoxed); } break; case "NAVIGATE": const source = getSelectedSource({ sources: state }); const url = source && source.url; if (!url) { @@ -5241,16 +3663,33 @@ function updateTabList(state, url, tabIn } else { tabs = tabs.insert(0, url); } _prefs.prefs.tabs = tabs.toJS(); return tabs; } +function updateBlackBoxList(url, isBlackBoxed) { + const tabs = getBlackBoxList(); + const i = tabs.indexOf(url); + if (i >= 0) { + if (!isBlackBoxed) { + tabs.splice(i, 1); + } + } else if (isBlackBoxed) { + tabs.push(url); + } + _prefs.prefs.tabsBlackBoxed = tabs; +} + +function getBlackBoxList() { + return _prefs.prefs.tabsBlackBoxed || []; +} + /** * Gets the next tab to select when a tab closes. Heuristics: * 1. if the selected tab is available, it remains selected * 2. if it is gone, the next available tab to the left should be active * 3. if the first tab is active and closed, select the second tab * * @memberof reducers/sources * @static @@ -5691,68 +4130,16 @@ module.exports = { PrefsHelper, Services, ZoomKeys, EventEmitter }; /***/ }), -/***/ 1377: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const sidePanelItems = { - Firefox: { - name: "Firefox", - clientType: "firefox", - paramName: "firefox-tab", - docsUrlPart: "firefox" - }, - Chrome: { - name: "Chrome", - clientType: "chrome", - paramName: "chrome-tab", - docsUrlPart: "chrome", - isUnderConstruction: true - }, - Node: { - name: "Node", - clientType: "node", - paramName: "node-tab", - docsUrlPart: "node", - isUnderConstruction: true - }, - Settings: { - name: "Settings", - clientType: "settings", - paramName: "settings-tab", - docsUrlPart: "settings" - } -}; - -module.exports = { - CLEAR_TABS: "CLEAR_TABS", - ADD_TABS: "ADD_TABS", - SELECT_TAB: "SELECT_TAB", - FILTER_TABS: "FILTER_TABS", - SET_VALUE: "SET_VALUE", - SET_CONFIG: "SET_CONFIG", - sidePanelItems -}; - -/***/ }), - /***/ 1378: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -5772,17 +4159,17 @@ exports.getBreakpoints = getBreakpoints; exports.getBreakpoint = getBreakpoint; exports.getBreakpointsDisabled = getBreakpointsDisabled; exports.getBreakpointsLoading = getBreakpointsLoading; exports.getBreakpointsForSource = getBreakpointsForSource; exports.getBreakpointForLine = getBreakpointForLine; exports.getHiddenBreakpoint = getHiddenBreakpoint; exports.getHiddenBreakpointLocation = getHiddenBreakpointLocation; -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var I = _interopRequireWildcard(_immutable); var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); var _devtoolsSourceMap = __webpack_require__(1360); @@ -6159,17 +4546,17 @@ Object.defineProperty(exports, "__esModu value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* 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/>. */ exports.getLibraryFromUrl = getLibraryFromUrl; -exports.annotateFrame = annotateFrame; +exports.annotateFrames = annotateFrames; exports.simplifyDisplayName = simplifyDisplayName; exports.formatDisplayName = formatDisplayName; exports.formatCopyName = formatCopyName; exports.collapseFrames = collapseFrames; var _utils = __webpack_require__(1366); var _source = __webpack_require__(1356); @@ -6258,16 +4645,19 @@ function getLibraryFromUrl(frame) { // @TODO each of these fns calls getFrameUrl, just call it once // (assuming there's not more complex logic to identify a lib) const frameUrl = getFrameUrl(frame); const match = (0, _lodash.find)(libraryMap, o => frameUrl.match(o.pattern)); return match && match.label; } const displayNameMap = { + Babel: { + tryCatch: "Async" + }, Backbone: { "extend/child": "Create Class", ".create": "Create Model" }, jQuery: { "jQuery.event.dispatch": "Dispatch Event" }, React: { @@ -6280,30 +4670,62 @@ const displayNameMap = { }, Webpack: { // eslint-disable-next-line camelcase __webpack_require__: "Bootstrap" } }; function mapDisplayNames(frame, library) { - const map = displayNameMap[library]; const { displayName } = frame; - return map && map[displayName] || displayName; + return displayNameMap[library] && displayNameMap[library][displayName] || displayName; +} + +function annotateFrames(frames) { + const annotatedFrames = frames.map(annotateFrame); + return annotateBabelAsyncFrames(annotatedFrames); } function annotateFrame(frame) { const library = getLibraryFromUrl(frame); if (library) { return _extends({}, frame, { library }); } return frame; } +function annotateBabelAsyncFrames(frames) { + const babelFrameIndexes = getBabelFrameIndexes(frames); + const isBabelFrame = frameIndex => babelFrameIndexes.includes(frameIndex); + + return frames.map((frame, frameIndex) => isBabelFrame(frameIndex) ? _extends({}, frame, { library: "Babel" }) : frame); +} + +// Receives an array of frames and looks for babel async +// call stack groups. +function getBabelFrameIndexes(frames) { + const startIndexes = getFrameIndices(frames, (displayName, url) => url.match(/regenerator-runtime/i) && displayName === "tryCatch"); + + const endIndexes = getFrameIndices(frames, (displayName, url) => displayName === "_asyncToGenerator/<" || url.match(/_microtask/i) && displayName === "flush"); + + if (startIndexes.length != endIndexes.length || startIndexes.length === 0) { + return frames; + } + + // Receives an array of start and end index tuples and returns + // an array of async call stack index ranges. + // e.g. [[1,3], [5,7]] => [[1,2,3], [5,6,7]] + return (0, _lodash.flatMap)((0, _lodash.zip)(startIndexes, endIndexes), ([startIndex, endIndex]) => (0, _lodash.range)(startIndex, endIndex + 1)); +} + +function getFrameIndices(frames, predicate) { + return frames.reduce((accumulator, frame, index) => predicate(frame.displayName, getFrameUrl(frame)) ? [...accumulator, index] : accumulator, []); +} + // Decodes an anonymous naming scheme that // spider monkey implements based on "Naming Anonymous JavaScript Functions" // http://johnjbarton.github.io/nonymous/index.html const objectProperty = /([\w\d]+)$/; const arrayProperty = /\[(.*?)\]$/; const functionProperty = /([\w\d]+)[\/\.<]*?$/; const annonymousProperty = /([\w\d]+)\(\^\)$/; @@ -6642,17 +5064,17 @@ exports.hasSymbols = hasSymbols; exports.isEmptyLineInSource = isEmptyLineInSource; exports.getEmptyLines = getEmptyLines; exports.getOutOfScopeLocations = getOutOfScopeLocations; exports.getPreview = getPreview; exports.getSourceMetaData = getSourceMetaData; exports.getInScopeLines = getInScopeLines; exports.isLineInScope = isLineInScope; -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var I = _interopRequireWildcard(_immutable); var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -7159,53 +5581,16 @@ module.exports = { isOriginalId, isGeneratedId, getContentType, contentMapForTesting: contentMap }; /***/ }), -/***/ 139: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return value != null && typeof value == 'object'; -} - -/* harmony default export */ __webpack_exports__["a"] = (isObjectLike); - - -/***/ }), - /***/ 1393: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -9448,45 +7833,16 @@ function Svg(name, props) { props = Object.assign({}, props, { className, src: svg[name] }); return React.createElement(_svgInlineReact2.default, props); } module.exports = Svg; /***/ }), -/***/ 1412: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* 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/. */ - -/** - * Returns a deferred object, with a resolve and reject property. - * https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred - */ -module.exports = function defer() { - let resolve, reject; - let promise = new Promise(function () { - resolve = arguments[0]; - reject = arguments[1]; - }); - return { - resolve: resolve, - reject: reject, - promise: promise - }; -}; - -/***/ }), - /***/ 1413: /***/ (function(module, exports, __webpack_require__) { "use strict"; /* 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 @@ -9624,83 +7980,16 @@ function buildMenu(items) { module.exports = { showMenu, buildMenu }; /***/ }), -/***/ 1414: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* 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 Immutable = __webpack_require__(146); - -// When our app state is fully types, we should be able to get rid of -// this function. This is only temporarily necessary to support -// converting typed objects to immutable.js, which usually happens in -// reducers. -function fromJS(value) { - if (Array.isArray(value)) { - return Immutable.Seq(value).map(fromJS).toList(); - } - if (value && value.constructor.meta) { - // This adds support for tcomb objects which are native JS objects - // but are not "plain", so the above checks fail. Since they - // behave the same we can use the same constructors, but we need - // special checks for them. - const kind = value.constructor.meta.kind; - if (kind === "struct") { - return Immutable.Seq(value).map(fromJS).toMap(); - } else if (kind === "list") { - return Immutable.Seq(value).map(fromJS).toList(); - } - } - - // If it's a primitive type, just return the value. Note `==` check - // for null, which is intentionally used to match either `null` or - // `undefined`. - if (value == null || typeof value !== "object") { - return value; - } - - // Otherwise, treat it like an object. We can't reliably detect if - // it's a plain object because we might be objects from other JS - // contexts so `Object !== Object`. - return Immutable.Seq(value).map(fromJS).toMap(); -} - -module.exports = fromJS; - -/***/ }), - -/***/ 1415: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* 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 tabs = __webpack_require__(1497); -const config = __webpack_require__(1498); - -module.exports = Object.assign({}, tabs, config); - -/***/ }), - /***/ 1416: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -9782,17 +8071,17 @@ Object.defineProperty(exports, "__esModu }); exports.getExpressionError = exports.getExpressions = exports.createExpressionState = undefined; exports.getExpression = getExpression; var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var _lodash = __webpack_require__(2); var _reselect = __webpack_require__(993); var _prefs = __webpack_require__(226); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -9888,17 +8177,17 @@ function updateItemInList(state, path, k const index = list.findIndex(e => e.input == key); return list.update(index, () => value); }); storeExpressions(newState); return newState; } function deleteExpression(state, input) { - const index = getExpressions({ expressions: state }).findKey(e => e.input == input); + const index = getExpressions({ expressions: state }).findIndex(e => e.input == input); const newState = state.deleteIn(["expressions", index]); storeExpressions(newState); return newState; } const getExpressionsWrapper = state => state.expressions; const getExpressions = exports.getExpressions = (0, _reselect.createSelector)(getExpressionsWrapper, expressions => expressions.get("expressions")); @@ -9923,17 +8212,17 @@ Object.defineProperty(exports, "__esModu value: true }); exports.getWorkers = exports.createDebuggeeState = undefined; exports.default = debuggee; exports.getWorker = getWorker; var _reselect = __webpack_require__(993); -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const createDebuggeeState = exports.createDebuggeeState = (0, _makeRecord2.default)({ @@ -9974,17 +8263,17 @@ function getWorker(state, url) { Object.defineProperty(exports, "__esModule", { value: true }); exports.initialPendingBreakpointsState = initialPendingBreakpointsState; exports.getPendingBreakpoints = getPendingBreakpoints; exports.getPendingBreakpointsForSource = getPendingBreakpointsForSource; -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var I = _interopRequireWildcard(_immutable); var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); var _breakpoint = __webpack_require__(1364); @@ -10492,17 +8781,17 @@ Object.defineProperty(exports, "__esModu exports.createCoverageState = undefined; exports.getHitCountForSource = getHitCountForSource; exports.getCoverageEnabled = getCoverageEnabled; var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var I = _interopRequireWildcard(_immutable); var _fromJS = __webpack_require__(1502); var _fromJS2 = _interopRequireDefault(_fromJS); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -10558,17 +8847,17 @@ Object.defineProperty(exports, "__esModu value: true }); exports.statusType = undefined; exports.initialProjectTextSearchState = initialProjectTextSearchState; exports.getTextSearchResults = getTextSearchResults; exports.getTextSearchStatus = getTextSearchStatus; exports.getTextSearchQuery = getTextSearchQuery; -var _immutable = __webpack_require__(146); +var _immutable = __webpack_require__(3594); var I = _interopRequireWildcard(_immutable); var _makeRecord = __webpack_require__(1361); var _makeRecord2 = _interopRequireDefault(_makeRecord); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -10916,34 +9205,32 @@ Object.defineProperty(exports, "__esModu value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* 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/>. */ exports.bootstrapStore = bootstrapStore; -exports.bootstrapApp = bootstrapApp; exports.bootstrapWorkers = bootstrapWorkers; exports.teardownWorkers = teardownWorkers; - -var _react = __webpack_require__(0); - -var _react2 = _interopRequireDefault(_react); - -var _redux = __webpack_require__(3); +exports.bootstrapApp = bootstrapApp; + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _redux = __webpack_require__(3593); var _reactDom = __webpack_require__(4); var _reactDom2 = _interopRequireDefault(_reactDom); var _devtoolsConfig = __webpack_require__(1355); -var _devtoolsLaunchpad = __webpack_require__(1362); - var _devtoolsSourceMap = __webpack_require__(1360); var _search = __webpack_require__(1395); var _prettyPrint = __webpack_require__(1431); var _parser = __webpack_require__(1365); @@ -10964,16 +9251,28 @@ var _App = __webpack_require__(1518); var _App2 = _interopRequireDefault(_App); var _prefs = __webpack_require__(226); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const { Provider } = __webpack_require__(3592); + +function renderPanel(component, store) { + const root = document.createElement("div"); + root.className = "launchpad-root theme-body"; + root.style.setProperty("flex", 1); + const mount = document.querySelector("#mount"); + mount.appendChild(root); + + _reactDom2.default.render(_react2.default.createElement(Provider, { store }, _react2.default.createElement(component)), root); +} + function bootstrapStore(client, { services, toolboxActions }) { const createStore = (0, _createStore2.default)({ log: (0, _devtoolsConfig.isTesting)() || (0, _devtoolsConfig.getValue)("logging.actions"), timing: (0, _devtoolsConfig.isDevelopment)(), makeThunkArgs: (args, state) => { return _extends({}, args, { client }, services, toolboxActions); } }); @@ -10981,29 +9280,16 @@ function bootstrapStore(client, { servic const store = createStore((0, _redux.combineReducers)(_reducers2.default)); store.subscribe(() => updatePrefs(store.getState())); const actions = (0, _redux.bindActionCreators)(__webpack_require__(1354).default, store.dispatch); return { store, actions, selectors }; } -function bootstrapApp(connection, { store, actions }) { - window.appStore = store; - - // Expose the bound actions so external things can do things like - // selecting a source. - window.actions = { - selectLocation: actions.selectLocation, - selectSourceURL: actions.selectSourceURL - }; - - (0, _devtoolsLaunchpad.renderRoot)(_react2.default, _reactDom2.default, _App2.default, store); -} - function bootstrapWorkers() { if (!(0, _devtoolsConfig.isFirefoxPanel)()) { // When used in Firefox, the toolbox manages the source map worker. (0, _devtoolsSourceMap.startSourceMapWorker)((0, _devtoolsConfig.getValue)("workers.sourceMapURL")); } (0, _prettyPrint.startPrettyPrintWorker)((0, _devtoolsConfig.getValue)("workers.prettyPrintURL")); (0, _parser.startParserWorker)((0, _devtoolsConfig.getValue)("workers.parserURL")); (0, _search.startSearchWorker)((0, _devtoolsConfig.getValue)("workers.searchURL")); @@ -11014,16 +9300,25 @@ function teardownWorkers() { // When used in Firefox, the toolbox manages the source map worker. (0, _devtoolsSourceMap.stopSourceMapWorker)(); } (0, _prettyPrint.stopPrettyPrintWorker)(); (0, _parser.stopParserWorker)(); (0, _search.stopSearchWorker)(); } +function bootstrapApp(store) { + if ((0, _devtoolsConfig.isFirefoxPanel)()) { + renderPanel(_App2.default, store); + } else { + const { renderRoot } = __webpack_require__(52); + renderRoot(_react2.default, _reactDom2.default, _App2.default, store); + } +} + function updatePrefs(state) { const pendingBreakpoints = selectors.getPendingBreakpoints(state); if (_prefs.prefs.pendingBreakpoints !== pendingBreakpoints) { _prefs.prefs.pendingBreakpoints = pendingBreakpoints; } } @@ -13218,31 +11513,43 @@ function FrameMenu(frame, frameworkGroup var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(4); var _reactDom2 = _interopRequireDefault(_reactDom); -var _devtoolsLaunchpad = __webpack_require__(1362); - var _devtoolsConfig = __webpack_require__(1355); var _client = __webpack_require__(1499); var _bootstrap = __webpack_require__(1430); var _sourceQueue = __webpack_require__(1795); var _sourceQueue2 = _interopRequireDefault(_sourceQueue); 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/>. */ + +/* global DebuggerConfig */ + +function unmountRoot() { + const mount = document.querySelector("#mount .launchpad-root"); + _reactDom2.default.unmountComponentAtNode(mount); +} + if ((0, _devtoolsConfig.isFirefoxPanel)()) { + // $FlowIgnore + (0, _devtoolsConfig.setConfig)({"environment":"firefox-panel","logging":false,"clientLogging":false,"firefox":{"mcPath":"./firefox"},"workers":{"parserURL":"resource://devtools/client/debugger/new/parser-worker.js","prettyPrintURL":"resource://devtools/client/debugger/new/pretty-print-worker.js","searchURL":"resource://devtools/client/debugger/new/search-worker.js"},"features":{}}); + module.exports = { bootstrap: ({ threadClient, tabTarget, debuggerClient, sourceMaps, toolboxActions }) => { @@ -13254,5042 +11561,35 @@ if ((0, _devtoolsConfig.isFirefoxPanel)( debuggerClient } }, { services: { sourceMaps }, toolboxActions }); }, destroy: () => { - (0, _devtoolsLaunchpad.unmountRoot)(_reactDom2.default); + unmountRoot(); _sourceQueue2.default.clear(); (0, _bootstrap.teardownWorkers)(); } }; } else { - window.L10N = _devtoolsLaunchpad.L10N; + const { bootstrap, L10N } = __webpack_require__(52); + + window.L10N = L10N; // $FlowIgnore: - window.L10N.setBundle(__webpack_require__(960)); - - (0, _devtoolsLaunchpad.bootstrap)(_react2.default, _reactDom2.default).then(connection => { + window.L10N.setBundle(__webpack_require__(52)); + + bootstrap(_react2.default, _reactDom2.default).then(connection => { (0, _client.onConnect)(connection, { services: { sourceMaps: __webpack_require__(1360) }, toolboxActions: {} }); }); -} /* 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/>. */ - -/***/ }), - -/***/ 146: -/***/ (function(module, exports, __webpack_require__) { - -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -(function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.Immutable = factory()); -}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice; - - function createClass(ctor, superClass) { - if (superClass) { - ctor.prototype = Object.create(superClass.prototype); - } - ctor.prototype.constructor = ctor; - } - - function Iterable(value) { - return isIterable(value) ? value : Seq(value); - } - - - createClass(KeyedIterable, Iterable); - function KeyedIterable(value) { - return isKeyed(value) ? value : KeyedSeq(value); - } - - - createClass(IndexedIterable, Iterable); - function IndexedIterable(value) { - return isIndexed(value) ? value : IndexedSeq(value); - } - - - createClass(SetIterable, Iterable); - function SetIterable(value) { - return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); - } - - - - function isIterable(maybeIterable) { - return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); - } - - function isKeyed(maybeKeyed) { - return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); - } - - function isIndexed(maybeIndexed) { - return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); - } - - function isAssociative(maybeAssociative) { - return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); - } - - function isOrdered(maybeOrdered) { - return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); - } - - Iterable.isIterable = isIterable; - Iterable.isKeyed = isKeyed; - Iterable.isIndexed = isIndexed; - Iterable.isAssociative = isAssociative; - Iterable.isOrdered = isOrdered; - - Iterable.Keyed = KeyedIterable; - Iterable.Indexed = IndexedIterable; - Iterable.Set = SetIterable; - - - var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; - var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; - var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; - var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; - - // Used for setting prototype methods that IE8 chokes on. - var DELETE = 'delete'; - - // Constants describing the size of trie nodes. - var SHIFT = 5; // Resulted in best performance after ______? - var SIZE = 1 << SHIFT; - var MASK = SIZE - 1; - - // A consistent shared value representing "not set" which equals nothing other - // than itself, and nothing that could be provided externally. - var NOT_SET = {}; - - // Boolean references, Rough equivalent of `bool &`. - var CHANGE_LENGTH = { value: false }; - var DID_ALTER = { value: false }; - - function MakeRef(ref) { - ref.value = false; - return ref; - } - - function SetRef(ref) { - ref && (ref.value = true); - } - - // A function which returns a value representing an "owner" for transient writes - // to tries. The return value will only ever equal itself, and will not equal - // the return of any subsequent call of this function. - function OwnerID() {} - - // http://jsperf.com/copy-array-inline - function arrCopy(arr, offset) { - offset = offset || 0; - var len = Math.max(0, arr.length - offset); - var newArr = new Array(len); - for (var ii = 0; ii < len; ii++) { - newArr[ii] = arr[ii + offset]; - } - return newArr; - } - - function ensureSize(iter) { - if (iter.size === undefined) { - iter.size = iter.__iterate(returnTrue); - } - return iter.size; - } - - function wrapIndex(iter, index) { - // This implements "is array index" which the ECMAString spec defines as: - // - // A String property name P is an array index if and only if - // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal - // to 2^32−1. - // - // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects - if (typeof index !== 'number') { - var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 - if ('' + uint32Index !== index || uint32Index === 4294967295) { - return NaN; - } - index = uint32Index; - } - return index < 0 ? ensureSize(iter) + index : index; - } - - function returnTrue() { - return true; - } - - function wholeSlice(begin, end, size) { - return (begin === 0 || (size !== undefined && begin <= -size)) && - (end === undefined || (size !== undefined && end >= size)); - } - - function resolveBegin(begin, size) { - return resolveIndex(begin, size, 0); - } - - function resolveEnd(end, size) { - return resolveIndex(end, size, size); - } - - function resolveIndex(index, size, defaultIndex) { - return index === undefined ? - defaultIndex : - index < 0 ? - Math.max(0, size + index) : - size === undefined ? - index : - Math.min(size, index); - } - - /* global Symbol */ - - var ITERATE_KEYS = 0; - var ITERATE_VALUES = 1; - var ITERATE_ENTRIES = 2; - - var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - - var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; - - - function Iterator(next) { - this.next = next; - } - - Iterator.prototype.toString = function() { - return '[Iterator]'; - }; - - - Iterator.KEYS = ITERATE_KEYS; - Iterator.VALUES = ITERATE_VALUES; - Iterator.ENTRIES = ITERATE_ENTRIES; - - Iterator.prototype.inspect = - Iterator.prototype.toSource = function () { return this.toString(); } - Iterator.prototype[ITERATOR_SYMBOL] = function () { - return this; - }; - - - function iteratorValue(type, k, v, iteratorResult) { - var value = type === 0 ? k : type === 1 ? v : [k, v]; - iteratorResult ? (iteratorResult.value = value) : (iteratorResult = { - value: value, done: false - }); - return iteratorResult; - } - - function iteratorDone() { - return { value: undefined, done: true }; - } - - function hasIterator(maybeIterable) { - return !!getIteratorFn(maybeIterable); - } - - function isIterator(maybeIterator) { - return maybeIterator && typeof maybeIterator.next === 'function'; - } - - function getIterator(iterable) { - var iteratorFn = getIteratorFn(iterable); - return iteratorFn && iteratorFn.call(iterable); - } - - function getIteratorFn(iterable) { - var iteratorFn = iterable && ( - (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || - iterable[FAUX_ITERATOR_SYMBOL] - ); - if (typeof iteratorFn === 'function') { - return iteratorFn; - } - } - - function isArrayLike(value) { - return value && typeof value.length === 'number'; - } - - createClass(Seq, Iterable); - function Seq(value) { - return value === null || value === undefined ? emptySequence() : - isIterable(value) ? value.toSeq() : seqFromValue(value); - } - - Seq.of = function(/*...values*/) { - return Seq(arguments); - }; - - Seq.prototype.toSeq = function() { - return this; - }; - - Seq.prototype.toString = function() { - return this.__toString('Seq {', '}'); - }; - - Seq.prototype.cacheResult = function() { - if (!this._cache && this.__iterateUncached) { - this._cache = this.entrySeq().toArray(); - this.size = this._cache.length; - } - return this; - }; - - // abstract __iterateUncached(fn, reverse) - - Seq.prototype.__iterate = function(fn, reverse) { - return seqIterate(this, fn, reverse, true); - }; - - // abstract __iteratorUncached(type, reverse) - - Seq.prototype.__iterator = function(type, reverse) { - return seqIterator(this, type, reverse, true); - }; - - - - createClass(KeyedSeq, Seq); - function KeyedSeq(value) { - return value === null || value === undefined ? - emptySequence().toKeyedSeq() : - isIterable(value) ? - (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) : - keyedSeqFromValue(value); - } - - KeyedSeq.prototype.toKeyedSeq = function() { - return this; - }; - - - - createClass(IndexedSeq, Seq); - function IndexedSeq(value) { - return value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value.toIndexedSeq(); - } - - IndexedSeq.of = function(/*...values*/) { - return IndexedSeq(arguments); - }; - - IndexedSeq.prototype.toIndexedSeq = function() { - return this; - }; - - IndexedSeq.prototype.toString = function() { - return this.__toString('Seq [', ']'); - }; - - IndexedSeq.prototype.__iterate = function(fn, reverse) { - return seqIterate(this, fn, reverse, false); - }; - - IndexedSeq.prototype.__iterator = function(type, reverse) { - return seqIterator(this, type, reverse, false); - }; - - - - createClass(SetSeq, Seq); - function SetSeq(value) { - return ( - value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value - ).toSetSeq(); - } - - SetSeq.of = function(/*...values*/) { - return SetSeq(arguments); - }; - - SetSeq.prototype.toSetSeq = function() { - return this; - }; - - - - Seq.isSeq = isSeq; - Seq.Keyed = KeyedSeq; - Seq.Set = SetSeq; - Seq.Indexed = IndexedSeq; - - var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; - - Seq.prototype[IS_SEQ_SENTINEL] = true; - - - - createClass(ArraySeq, IndexedSeq); - function ArraySeq(array) { - this._array = array; - this.size = array.length; - } - - ArraySeq.prototype.get = function(index, notSetValue) { - return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue; - }; - - ArraySeq.prototype.__iterate = function(fn, reverse) { - var array = this._array; - var maxIndex = array.length - 1; - for (var ii = 0; ii <= maxIndex; ii++) { - if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) { - return ii + 1; - } - } - return ii; - }; - - ArraySeq.prototype.__iterator = function(type, reverse) { - var array = this._array; - var maxIndex = array.length - 1; - var ii = 0; - return new Iterator(function() - {return ii > maxIndex ? - iteratorDone() : - iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])} - ); - }; - - - - createClass(ObjectSeq, KeyedSeq); - function ObjectSeq(object) { - var keys = Object.keys(object); - this._object = object; - this._keys = keys; - this.size = keys.length; - } - - ObjectSeq.prototype.get = function(key, notSetValue) { - if (notSetValue !== undefined && !this.has(key)) { - return notSetValue; - } - return this._object[key]; - }; - - ObjectSeq.prototype.has = function(key) { - return this._object.hasOwnProperty(key); - }; - - ObjectSeq.prototype.__iterate = function(fn, reverse) { - var object = this._object; - var keys = this._keys; - var maxIndex = keys.length - 1; - for (var ii = 0; ii <= maxIndex; ii++) { - var key = keys[reverse ? maxIndex - ii : ii]; - if (fn(object[key], key, this) === false) { - return ii + 1; - } - } - return ii; - }; - - ObjectSeq.prototype.__iterator = function(type, reverse) { - var object = this._object; - var keys = this._keys; - var maxIndex = keys.length - 1; - var ii = 0; - return new Iterator(function() { - var key = keys[reverse ? maxIndex - ii : ii]; - return ii++ > maxIndex ? - iteratorDone() : - iteratorValue(type, key, object[key]); - }); - }; - - ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true; - - - createClass(IterableSeq, IndexedSeq); - function IterableSeq(iterable) { - this._iterable = iterable; - this.size = iterable.length || iterable.size; - } - - IterableSeq.prototype.__iterateUncached = function(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterable = this._iterable; - var iterator = getIterator(iterable); - var iterations = 0; - if (isIterator(iterator)) { - var step; - while (!(step = iterator.next()).done) { - if (fn(step.value, iterations++, this) === false) { - break; - } - } - } - return iterations; - }; - - IterableSeq.prototype.__iteratorUncached = function(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterable = this._iterable; - var iterator = getIterator(iterable); - if (!isIterator(iterator)) { - return new Iterator(iteratorDone); - } - var iterations = 0; - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : iteratorValue(type, iterations++, step.value); - }); - }; - - - - createClass(IteratorSeq, IndexedSeq); - function IteratorSeq(iterator) { - this._iterator = iterator; - this._iteratorCache = []; - } - - IteratorSeq.prototype.__iterateUncached = function(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - while (iterations < cache.length) { - if (fn(cache[iterations], iterations++, this) === false) { - return iterations; - } - } - var step; - while (!(step = iterator.next()).done) { - var val = step.value; - cache[iterations] = val; - if (fn(val, iterations++, this) === false) { - break; - } - } - return iterations; - }; - - IteratorSeq.prototype.__iteratorUncached = function(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - return new Iterator(function() { - if (iterations >= cache.length) { - var step = iterator.next(); - if (step.done) { - return step; - } - cache[iterations] = step.value; - } - return iteratorValue(type, iterations, cache[iterations++]); - }); - }; - - - - - // # pragma Helper functions - - function isSeq(maybeSeq) { - return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]); - } - - var EMPTY_SEQ; - - function emptySequence() { - return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([])); - } - - function keyedSeqFromValue(value) { - var seq = - Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : - isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : - hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : - typeof value === 'object' ? new ObjectSeq(value) : - undefined; - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of [k, v] entries, '+ - 'or keyed object: ' + value - ); - } - return seq; - } - - function indexedSeqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values: ' + value - ); - } - return seq; - } - - function seqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value) || - (typeof value === 'object' && new ObjectSeq(value)); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values, or keyed object: ' + value - ); - } - return seq; - } - - function maybeIndexedSeqFromValue(value) { - return ( - isArrayLike(value) ? new ArraySeq(value) : - isIterator(value) ? new IteratorSeq(value) : - hasIterator(value) ? new IterableSeq(value) : - undefined - ); - } - - function seqIterate(seq, fn, reverse, useKeys) { - var cache = seq._cache; - if (cache) { - var maxIndex = cache.length - 1; - for (var ii = 0; ii <= maxIndex; ii++) { - var entry = cache[reverse ? maxIndex - ii : ii]; - if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) { - return ii + 1; - } - } - return ii; - } - return seq.__iterateUncached(fn, reverse); - } - - function seqIterator(seq, type, reverse, useKeys) { - var cache = seq._cache; - if (cache) { - var maxIndex = cache.length - 1; - var ii = 0; - return new Iterator(function() { - var entry = cache[reverse ? maxIndex - ii : ii]; - return ii++ > maxIndex ? - iteratorDone() : - iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]); - }); - } - return seq.__iteratorUncached(type, reverse); - } - - function fromJS(json, converter) { - return converter ? - fromJSWith(converter, json, '', {'': json}) : - fromJSDefault(json); - } - - function fromJSWith(converter, json, key, parentJSON) { - if (Array.isArray(json)) { - return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); - } - if (isPlainObj(json)) { - return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); - } - return json; - } - - function fromJSDefault(json) { - if (Array.isArray(json)) { - return IndexedSeq(json).map(fromJSDefault).toList(); - } - if (isPlainObj(json)) { - return KeyedSeq(json).map(fromJSDefault).toMap(); - } - return json; - } - - function isPlainObj(value) { - return value && (value.constructor === Object || value.constructor === undefined); - } - - /** - * An extension of the "same-value" algorithm as [described for use by ES6 Map - * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality) - * - * NaN is considered the same as NaN, however -0 and 0 are considered the same - * value, which is different from the algorithm described by - * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * This is extended further to allow Objects to describe the values they - * represent, by way of `valueOf` or `equals` (and `hashCode`). - * - * Note: because of this extension, the key equality of Immutable.Map and the - * value equality of Immutable.Set will differ from ES6 Map and Set. - * - * ### Defining custom values - * - * The easiest way to describe the value an object represents is by implementing - * `valueOf`. For example, `Date` represents a value by returning a unix - * timestamp for `valueOf`: - * - * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ... - * var date2 = new Date(1234567890000); - * date1.valueOf(); // 1234567890000 - * assert( date1 !== date2 ); - * assert( Immutable.is( date1, date2 ) ); - * - * Note: overriding `valueOf` may have other implications if you use this object - * where JavaScript expects a primitive, such as implicit string coercion. - * - * For more complex types, especially collections, implementing `valueOf` may - * not be performant. An alternative is to implement `equals` and `hashCode`. - * - * `equals` takes another object, presumably of similar type, and returns true - * if the it is equal. Equality is symmetrical, so the same result should be - * returned if this and the argument are flipped. - * - * assert( a.equals(b) === b.equals(a) ); - * - * `hashCode` returns a 32bit integer number representing the object which will - * be used to determine how to store the value object in a Map or Set. You must - * provide both or neither methods, one must not exist without the other. - * - * Also, an important relationship between these methods must be upheld: if two - * values are equal, they *must* return the same hashCode. If the values are not - * equal, they might have the same hashCode; this is called a hash collision, - * and while undesirable for performance reasons, it is acceptable. - * - * if (a.equals(b)) { - * assert( a.hashCode() === b.hashCode() ); - * } - * - * All Immutable collections implement `equals` and `hashCode`. - * - */ - function is(valueA, valueB) { - if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { - return true; - } - if (!valueA || !valueB) { - return false; - } - if (typeof valueA.valueOf === 'function' && - typeof valueB.valueOf === 'function') { - valueA = valueA.valueOf(); - valueB = valueB.valueOf(); - if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { - return true; - } - if (!valueA || !valueB) { - return false; - } - } - if (typeof valueA.equals === 'function' && - typeof valueB.equals === 'function' && - valueA.equals(valueB)) { - return true; - } - return false; - } - - function deepEqual(a, b) { - if (a === b) { - return true; - } - - if ( - !isIterable(b) || - a.size !== undefined && b.size !== undefined && a.size !== b.size || - a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || - isKeyed(a) !== isKeyed(b) || - isIndexed(a) !== isIndexed(b) || - isOrdered(a) !== isOrdered(b) - ) { - return false; - } - - if (a.size === 0 && b.size === 0) { - return true; - } - - var notAssociative = !isAssociative(a); - - if (isOrdered(a)) { - var entries = a.entries(); - return b.every(function(v, k) { - var entry = entries.next().value; - return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); - }) && entries.next().done; - } - - var flipped = false; - - if (a.size === undefined) { - if (b.size === undefined) { - if (typeof a.cacheResult === 'function') { - a.cacheResult(); - } - } else { - flipped = true; - var _ = a; - a = b; - b = _; - } - } - - var allEqual = true; - var bSize = b.__iterate(function(v, k) { - if (notAssociative ? !a.has(v) : - flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { - allEqual = false; - return false; - } - }); - - return allEqual && a.size === bSize; - } - - createClass(Repeat, IndexedSeq); - - function Repeat(value, times) { - if (!(this instanceof Repeat)) { - return new Repeat(value, times); - } - this._value = value; - this.size = times === undefined ? Infinity : Math.max(0, times); - if (this.size === 0) { - if (EMPTY_REPEAT) { - return EMPTY_REPEAT; - } - EMPTY_REPEAT = this; - } - } - - Repeat.prototype.toString = function() { - if (this.size === 0) { - return 'Repeat []'; - } - return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]'; - }; - - Repeat.prototype.get = function(index, notSetValue) { - return this.has(index) ? this._value : notSetValue; - }; - - Repeat.prototype.includes = function(searchValue) { - return is(this._value, searchValue); - }; - - Repeat.prototype.slice = function(begin, end) { - var size = this.size; - return wholeSlice(begin, end, size) ? this : - new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); - }; - - Repeat.prototype.reverse = function() { - return this; - }; - - Repeat.prototype.indexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return 0; - } - return -1; - }; - - Repeat.prototype.lastIndexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return this.size; - } - return -1; - }; - - Repeat.prototype.__iterate = function(fn, reverse) { - for (var ii = 0; ii < this.size; ii++) { - if (fn(this._value, ii, this) === false) { - return ii + 1; - } - } - return ii; - }; - - Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; - var ii = 0; - return new Iterator(function() - {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} - ); - }; - - Repeat.prototype.equals = function(other) { - return other instanceof Repeat ? - is(this._value, other._value) : - deepEqual(other); - }; - - - var EMPTY_REPEAT; - - function invariant(condition, error) { - if (!condition) throw new Error(error); - } - - createClass(Range, IndexedSeq); - - function Range(start, end, step) { - if (!(this instanceof Range)) { - return new Range(start, end, step); - } - invariant(step !== 0, 'Cannot step a Range by 0'); - start = start || 0; - if (end === undefined) { - end = Infinity; - } - step = step === undefined ? 1 : Math.abs(step); - if (end < start) { - step = -step; - } - this._start = start; - this._end = end; - this._step = step; - this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); - if (this.size === 0) { - if (EMPTY_RANGE) { - return EMPTY_RANGE; - } - EMPTY_RANGE = this; - } - } - - Range.prototype.toString = function() { - if (this.size === 0) { - return 'Range []'; - } - return 'Range [ ' + - this._start + '...' + this._end + - (this._step !== 1 ? ' by ' + this._step : '') + - ' ]'; - }; - - Range.prototype.get = function(index, notSetValue) { - return this.has(index) ? - this._start + wrapIndex(this, index) * this._step : - notSetValue; - }; - - Range.prototype.includes = function(searchValue) { - var possibleIndex = (searchValue - this._start) / this._step; - return possibleIndex >= 0 && - possibleIndex < this.size && - possibleIndex === Math.floor(possibleIndex); - }; - - Range.prototype.slice = function(begin, end) { - if (wholeSlice(begin, end, this.size)) { - return this; - } - begin = resolveBegin(begin, this.size); - end = resolveEnd(end, this.size); - if (end <= begin) { - return new Range(0, 0); - } - return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); - }; - - Range.prototype.indexOf = function(searchValue) { - var offsetValue = searchValue - this._start; - if (offsetValue % this._step === 0) { - var index = offsetValue / this._step; - if (index >= 0 && index < this.size) { - return index - } - } - return -1; - }; - - Range.prototype.lastIndexOf = function(searchValue) { - return this.indexOf(searchValue); - }; - - Range.prototype.__iterate = function(fn, reverse) { - var maxIndex = this.size - 1; - var step = this._step; - var value = reverse ? this._start + maxIndex * step : this._start; - for (var ii = 0; ii <= maxIndex; ii++) { - if (fn(value, ii, this) === false) { - return ii + 1; - } - value += reverse ? -step : step; - } - return ii; - }; - - Range.prototype.__iterator = function(type, reverse) { - var maxIndex = this.size - 1; - var step = this._step; - var value = reverse ? this._start + maxIndex * step : this._start; - var ii = 0; - return new Iterator(function() { - var v = value; - value += reverse ? -step : step; - return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v); - }); - }; - - Range.prototype.equals = function(other) { - return other instanceof Range ? - this._start === other._start && - this._end === other._end && - this._step === other._step : - deepEqual(this, other); - }; - - - var EMPTY_RANGE; - - createClass(Collection, Iterable); - function Collection() { - throw TypeError('Abstract'); - } - - - createClass(KeyedCollection, Collection);function KeyedCollection() {} - - createClass(IndexedCollection, Collection);function IndexedCollection() {} - - createClass(SetCollection, Collection);function SetCollection() {} - - - Collection.Keyed = KeyedCollection; - Collection.Indexed = IndexedCollection; - Collection.Set = SetCollection; - - var imul = - typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? - Math.imul : - function imul(a, b) { - a = a | 0; // int - b = b | 0; // int - var c = a & 0xffff; - var d = b & 0xffff; - // Shift by 0 fixes the sign on the high part. - return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int - }; - - // v8 has an optimization for storing 31-bit signed numbers. - // Values which have either 00 or 11 as the high order bits qualify. - // This function drops the highest order bit in a signed number, maintaining - // the sign bit. - function smi(i32) { - return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); - } - - function hash(o) { - if (o === false || o === null || o === undefined) { - return 0; - } - if (typeof o.valueOf === 'function') { - o = o.valueOf(); - if (o === false || o === null || o === undefined) { - return 0; - } - } - if (o === true) { - return 1; - } - var type = typeof o; - if (type === 'number') { - if (o !== o || o === Infinity) { - return 0; - } - var h = o | 0; - if (h !== o) { - h ^= o * 0xFFFFFFFF; - } - while (o > 0xFFFFFFFF) { - o /= 0xFFFFFFFF; - h ^= o; - } - return smi(h); - } - if (type === 'string') { - return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); - } - if (typeof o.hashCode === 'function') { - return o.hashCode(); - } - if (type === 'object') { - return hashJSObj(o); - } - if (typeof o.toString === 'function') { - return hashString(o.toString()); - } - throw new Error('Value type ' + type + ' cannot be hashed.'); - } - - function cachedHashString(string) { - var hash = stringHashCache[string]; - if (hash === undefined) { - hash = hashString(string); - if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { - STRING_HASH_CACHE_SIZE = 0; - stringHashCache = {}; - } - STRING_HASH_CACHE_SIZE++; - stringHashCache[string] = hash; - } - return hash; - } - - // http://jsperf.com/hashing-strings - function hashString(string) { - // This is the hash from JVM - // The hash code for a string is computed as - // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], - // where s[i] is the ith character of the string and n is the length of - // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 - // (exclusive) by dropping high bits. - var hash = 0; - for (var ii = 0; ii < string.length; ii++) { - hash = 31 * hash + string.charCodeAt(ii) | 0; - } - return smi(hash); - } - - function hashJSObj(obj) { - var hash; - if (usingWeakMap) { - hash = weakMap.get(obj); - if (hash !== undefined) { - return hash; - } - } - - hash = obj[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; - } - - if (!canDefineProperty) { - hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; - } - - hash = getIENodeHash(obj); - if (hash !== undefined) { - return hash; - } - } - - hash = ++objHashUID; - if (objHashUID & 0x40000000) { - objHashUID = 0; - } - - if (usingWeakMap) { - weakMap.set(obj, hash); - } else if (isExtensible !== undefined && isExtensible(obj) === false) { - throw new Error('Non-extensible objects are not allowed as keys.'); - } else if (canDefineProperty) { - Object.defineProperty(obj, UID_HASH_KEY, { - 'enumerable': false, - 'configurable': false, - 'writable': false, - 'value': hash - }); - } else if (obj.propertyIsEnumerable !== undefined && - obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { - // Since we can't define a non-enumerable property on the object - // we'll hijack one of the less-used non-enumerable properties to - // save our hash on it. Since this is a function it will not show up in - // `JSON.stringify` which is what we want. - obj.propertyIsEnumerable = function() { - return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); - }; - obj.propertyIsEnumerable[UID_HASH_KEY] = hash; - } else if (obj.nodeType !== undefined) { - // At this point we couldn't get the IE `uniqueID` to use as a hash - // and we couldn't use a non-enumerable property to exploit the - // dontEnum bug so we simply add the `UID_HASH_KEY` on the node - // itself. - obj[UID_HASH_KEY] = hash; - } else { - throw new Error('Unable to set a non-enumerable property on object.'); - } - - return hash; - } - - // Get references to ES5 object methods. - var isExtensible = Object.isExtensible; - - // True if Object.defineProperty works as expected. IE8 fails this test. - var canDefineProperty = (function() { - try { - Object.defineProperty({}, '@', {}); - return true; - } catch (e) { - return false; - } - }()); - - // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it - // and avoid memory leaks from the IE cloneNode bug. - function getIENodeHash(node) { - if (node && node.nodeType > 0) { - switch (node.nodeType) { - case 1: // Element - return node.uniqueID; - case 9: // Document - return node.documentElement && node.documentElement.uniqueID; - } - } - } - - // If possible, use a WeakMap. - var usingWeakMap = typeof WeakMap === 'function'; - var weakMap; - if (usingWeakMap) { - weakMap = new WeakMap(); - } - - var objHashUID = 0; - - var UID_HASH_KEY = '__immutablehash__'; - if (typeof Symbol === 'function') { - UID_HASH_KEY = Symbol(UID_HASH_KEY); - } - - var STRING_HASH_CACHE_MIN_STRLEN = 16; - var STRING_HASH_CACHE_MAX_SIZE = 255; - var STRING_HASH_CACHE_SIZE = 0; - var stringHashCache = {}; - - function assertNotInfinite(size) { - invariant( - size !== Infinity, - 'Cannot perform this action with an infinite size.' - ); - } - - createClass(Map, KeyedCollection); - - // @pragma Construction - - function Map(value) { - return value === null || value === undefined ? emptyMap() : - isMap(value) && !isOrdered(value) ? value : - emptyMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } - - Map.of = function() {var keyValues = SLICE$0.call(arguments, 0); - return emptyMap().withMutations(function(map ) { - for (var i = 0; i < keyValues.length; i += 2) { - if (i + 1 >= keyValues.length) { - throw new Error('Missing value for key: ' + keyValues[i]); - } - map.set(keyValues[i], keyValues[i + 1]); - } - }); - }; - - Map.prototype.toString = function() { - return this.__toString('Map {', '}'); - }; - - // @pragma Access - - Map.prototype.get = function(k, notSetValue) { - return this._root ? - this._root.get(0, undefined, k, notSetValue) : - notSetValue; - }; - - // @pragma Modification - - Map.prototype.set = function(k, v) { - return updateMap(this, k, v); - }; - - Map.prototype.setIn = function(keyPath, v) { - return this.updateIn(keyPath, NOT_SET, function() {return v}); - }; - - Map.prototype.remove = function(k) { - return updateMap(this, k, NOT_SET); - }; - - Map.prototype.deleteIn = function(keyPath) { - return this.updateIn(keyPath, function() {return NOT_SET}); - }; - - Map.prototype.update = function(k, notSetValue, updater) { - return arguments.length === 1 ? - k(this) : - this.updateIn([k], notSetValue, updater); - }; - - Map.prototype.updateIn = function(keyPath, notSetValue, updater) { - if (!updater) { - updater = notSetValue; - notSetValue = undefined; - } - var updatedValue = updateInDeepMap( - this, - forceIterator(keyPath), - notSetValue, - updater - ); - return updatedValue === NOT_SET ? undefined : updatedValue; - }; - - Map.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._root = null; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyMap(); - }; - - // @pragma Composition - - Map.prototype.merge = function(/*...iters*/) { - return mergeIntoMapWith(this, undefined, arguments); - }; - - Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoMapWith(this, merger, iters); - }; - - Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); - return this.updateIn( - keyPath, - emptyMap(), - function(m ) {return typeof m.merge === 'function' ? - m.merge.apply(m, iters) : - iters[iters.length - 1]} - ); - }; - - Map.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoMapWith(this, deepMerger, arguments); - }; - - Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoMapWith(this, deepMergerWith(merger), iters); - }; - - Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); - return this.updateIn( - keyPath, - emptyMap(), - function(m ) {return typeof m.mergeDeep === 'function' ? - m.mergeDeep.apply(m, iters) : - iters[iters.length - 1]} - ); - }; - - Map.prototype.sort = function(comparator) { - // Late binding - return OrderedMap(sortFactory(this, comparator)); - }; - - Map.prototype.sortBy = function(mapper, comparator) { - // Late binding - return OrderedMap(sortFactory(this, comparator, mapper)); - }; - - // @pragma Mutability - - Map.prototype.withMutations = function(fn) { - var mutable = this.asMutable(); - fn(mutable); - return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; - }; - - Map.prototype.asMutable = function() { - return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); - }; - - Map.prototype.asImmutable = function() { - return this.__ensureOwner(); - }; - - Map.prototype.wasAltered = function() { - return this.__altered; - }; - - Map.prototype.__iterator = function(type, reverse) { - return new MapIterator(this, type, reverse); - }; - - Map.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var iterations = 0; - this._root && this._root.iterate(function(entry ) { - iterations++; - return fn(entry[1], entry[0], this$0); - }, reverse); - return iterations; - }; - - Map.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - this.__altered = false; - return this; - } - return makeMap(this.size, this._root, ownerID, this.__hash); - }; - - - function isMap(maybeMap) { - return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]); - } - - Map.isMap = isMap; - - var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; - - var MapPrototype = Map.prototype; - MapPrototype[IS_MAP_SENTINEL] = true; - MapPrototype[DELETE] = MapPrototype.remove; - MapPrototype.removeIn = MapPrototype.deleteIn; - - - // #pragma Trie Nodes - - - - function ArrayMapNode(ownerID, entries) { - this.ownerID = ownerID; - this.entries = entries; - } - - ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { - if (is(key, entries[ii][0])) { - return entries[ii][1]; - } - } - return notSetValue; - }; - - ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; - - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { - if (is(key, entries[idx][0])) { - break; - } - } - var exists = idx < len; - - if (exists ? entries[idx][1] === value : removed) { - return this; - } - - SetRef(didAlter); - (removed || !exists) && SetRef(didChangeSize); - - if (removed && entries.length === 1) { - return; // undefined - } - - if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) { - return createNodes(ownerID, entries, key, value); - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); - - if (exists) { - if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); - } else { - newEntries[idx] = [key, value]; - } - } else { - newEntries.push([key, value]); - } - - if (isEditable) { - this.entries = newEntries; - return this; - } - - return new ArrayMapNode(ownerID, newEntries); - }; - - - - - function BitmapIndexedNode(ownerID, bitmap, nodes) { - this.ownerID = ownerID; - this.bitmap = bitmap; - this.nodes = nodes; - } - - BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK)); - var bitmap = this.bitmap; - return (bitmap & bit) === 0 ? notSetValue : - this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue); - }; - - BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var bit = 1 << keyHashFrag; - var bitmap = this.bitmap; - var exists = (bitmap & bit) !== 0; - - if (!exists && value === NOT_SET) { - return this; - } - - var idx = popCount(bitmap & (bit - 1)); - var nodes = this.nodes; - var node = exists ? nodes[idx] : undefined; - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); - - if (newNode === node) { - return this; - } - - if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) { - return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode); - } - - if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) { - return nodes[idx ^ 1]; - } - - if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) { - return newNode; - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit; - var newNodes = exists ? newNode ? - setIn(nodes, idx, newNode, isEditable) : - spliceOut(nodes, idx, isEditable) : - spliceIn(nodes, idx, newNode, isEditable); - - if (isEditable) { - this.bitmap = newBitmap; - this.nodes = newNodes; - return this; - } - - return new BitmapIndexedNode(ownerID, newBitmap, newNodes); - }; - - - - - function HashArrayMapNode(ownerID, count, nodes) { - this.ownerID = ownerID; - this.count = count; - this.nodes = nodes; - } - - HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var node = this.nodes[idx]; - return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue; - }; - - HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var removed = value === NOT_SET; - var nodes = this.nodes; - var node = nodes[idx]; - - if (removed && !node) { - return this; - } - - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); - if (newNode === node) { - return this; - } - - var newCount = this.count; - if (!node) { - newCount++; - } else if (!newNode) { - newCount--; - if (newCount < MIN_HASH_ARRAY_MAP_SIZE) { - return packNodes(ownerID, nodes, newCount, idx); - } - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newNodes = setIn(nodes, idx, newNode, isEditable); - - if (isEditable) { - this.count = newCount; - this.nodes = newNodes; - return this; - } - - return new HashArrayMapNode(ownerID, newCount, newNodes); - }; - - - - - function HashCollisionNode(ownerID, keyHash, entries) { - this.ownerID = ownerID; - this.keyHash = keyHash; - this.entries = entries; - } - - HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { - if (is(key, entries[ii][0])) { - return entries[ii][1]; - } - } - return notSetValue; - }; - - HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - - var removed = value === NOT_SET; - - if (keyHash !== this.keyHash) { - if (removed) { - return this; - } - SetRef(didAlter); - SetRef(didChangeSize); - return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]); - } - - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { - if (is(key, entries[idx][0])) { - break; - } - } - var exists = idx < len; - - if (exists ? entries[idx][1] === value : removed) { - return this; - } - - SetRef(didAlter); - (removed || !exists) && SetRef(didChangeSize); - - if (removed && len === 2) { - return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]); - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); - - if (exists) { - if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); - } else { - newEntries[idx] = [key, value]; - } - } else { - newEntries.push([key, value]); - } - - if (isEditable) { - this.entries = newEntries; - return this; - } - - return new HashCollisionNode(ownerID, this.keyHash, newEntries); - }; - - - - - function ValueNode(ownerID, keyHash, entry) { - this.ownerID = ownerID; - this.keyHash = keyHash; - this.entry = entry; - } - - ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) { - return is(key, this.entry[0]) ? this.entry[1] : notSetValue; - }; - - ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; - var keyMatch = is(key, this.entry[0]); - if (keyMatch ? value === this.entry[1] : removed) { - return this; - } - - SetRef(didAlter); - - if (removed) { - SetRef(didChangeSize); - return; // undefined - } - - if (keyMatch) { - if (ownerID && ownerID === this.ownerID) { - this.entry[1] = value; - return this; - } - return new ValueNode(ownerID, this.keyHash, [key, value]); - } - - SetRef(didChangeSize); - return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]); - }; - - - - // #pragma Iterators - - ArrayMapNode.prototype.iterate = - HashCollisionNode.prototype.iterate = function (fn, reverse) { - var entries = this.entries; - for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) { - if (fn(entries[reverse ? maxIndex - ii : ii]) === false) { - return false; - } - } - } - - BitmapIndexedNode.prototype.iterate = - HashArrayMapNode.prototype.iterate = function (fn, reverse) { - var nodes = this.nodes; - for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) { - var node = nodes[reverse ? maxIndex - ii : ii]; - if (node && node.iterate(fn, reverse) === false) { - return false; - } - } - } - - ValueNode.prototype.iterate = function (fn, reverse) { - return fn(this.entry); - } - - createClass(MapIterator, Iterator); - - function MapIterator(map, type, reverse) { - this._type = type; - this._reverse = reverse; - this._stack = map._root && mapIteratorFrame(map._root); - } - - MapIterator.prototype.next = function() { - var type = this._type; - var stack = this._stack; - while (stack) { - var node = stack.node; - var index = stack.index++; - var maxIndex; - if (node.entry) { - if (index === 0) { - return mapIteratorValue(type, node.entry); - } - } else if (node.entries) { - maxIndex = node.entries.length - 1; - if (index <= maxIndex) { - return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]); - } - } else { - maxIndex = node.nodes.length - 1; - if (index <= maxIndex) { - var subNode = node.nodes[this._reverse ? maxIndex - index : index]; - if (subNode) { - if (subNode.entry) { - return mapIteratorValue(type, subNode.entry); - } - stack = this._stack = mapIteratorFrame(subNode, stack); - } - continue; - } - } - stack = this._stack = this._stack.__prev; - } - return iteratorDone(); - }; - - - function mapIteratorValue(type, entry) { - return iteratorValue(type, entry[0], entry[1]); - } - - function mapIteratorFrame(node, prev) { - return { - node: node, - index: 0, - __prev: prev - }; - } - - function makeMap(size, root, ownerID, hash) { - var map = Object.create(MapPrototype); - map.size = size; - map._root = root; - map.__ownerID = ownerID; - map.__hash = hash; - map.__altered = false; - return map; - } - - var EMPTY_MAP; - function emptyMap() { - return EMPTY_MAP || (EMPTY_MAP = makeMap(0)); - } - - function updateMap(map, k, v) { - var newRoot; - var newSize; - if (!map._root) { - if (v === NOT_SET) { - return map; - } - newSize = 1; - newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]); - } else { - var didChangeSize = MakeRef(CHANGE_LENGTH); - var didAlter = MakeRef(DID_ALTER); - newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter); - if (!didAlter.value) { - return map; - } - newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0); - } - if (map.__ownerID) { - map.size = newSize; - map._root = newRoot; - map.__hash = undefined; - map.__altered = true; - return map; - } - return newRoot ? makeMap(newSize, newRoot) : emptyMap(); - } - - function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (!node) { - if (value === NOT_SET) { - return node; - } - SetRef(didAlter); - SetRef(didChangeSize); - return new ValueNode(ownerID, keyHash, [key, value]); - } - return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter); - } - - function isLeafNode(node) { - return node.constructor === ValueNode || node.constructor === HashCollisionNode; - } - - function mergeIntoNode(node, ownerID, shift, keyHash, entry) { - if (node.keyHash === keyHash) { - return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]); - } - - var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK; - var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - - var newNode; - var nodes = idx1 === idx2 ? - [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : - ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]); - - return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes); - } - - function createNodes(ownerID, entries, key, value) { - if (!ownerID) { - ownerID = new OwnerID(); - } - var node = new ValueNode(ownerID, hash(key), [key, value]); - for (var ii = 0; ii < entries.length; ii++) { - var entry = entries[ii]; - node = node.update(ownerID, 0, undefined, entry[0], entry[1]); - } - return node; - } - - function packNodes(ownerID, nodes, count, excluding) { - var bitmap = 0; - var packedII = 0; - var packedNodes = new Array(count); - for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) { - var node = nodes[ii]; - if (node !== undefined && ii !== excluding) { - bitmap |= bit; - packedNodes[packedII++] = node; - } - } - return new BitmapIndexedNode(ownerID, bitmap, packedNodes); - } - - function expandNodes(ownerID, nodes, bitmap, including, node) { - var count = 0; - var expandedNodes = new Array(SIZE); - for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) { - expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined; - } - expandedNodes[including] = node; - return new HashArrayMapNode(ownerID, count + 1, expandedNodes); - } - - function mergeIntoMapWith(map, merger, iterables) { - var iters = []; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = KeyedIterable(value); - if (!isIterable(value)) { - iter = iter.map(function(v ) {return fromJS(v)}); - } - iters.push(iter); - } - return mergeIntoCollectionWith(map, merger, iters); - } - - function deepMerger(existing, value, key) { - return existing && existing.mergeDeep && isIterable(value) ? - existing.mergeDeep(value) : - is(existing, value) ? existing : value; - } - - function deepMergerWith(merger) { - return function(existing, value, key) { - if (existing && existing.mergeDeepWith && isIterable(value)) { - return existing.mergeDeepWith(merger, value); - } - var nextValue = merger(existing, value, key); - return is(existing, nextValue) ? existing : nextValue; - }; - } - - function mergeIntoCollectionWith(collection, merger, iters) { - iters = iters.filter(function(x ) {return x.size !== 0}); - if (iters.length === 0) { - return collection; - } - if (collection.size === 0 && !collection.__ownerID && iters.length === 1) { - return collection.constructor(iters[0]); - } - return collection.withMutations(function(collection ) { - var mergeIntoMap = merger ? - function(value, key) { - collection.update(key, NOT_SET, function(existing ) - {return existing === NOT_SET ? value : merger(existing, value, key)} - ); - } : - function(value, key) { - collection.set(key, value); - } - for (var ii = 0; ii < iters.length; ii++) { - iters[ii].forEach(mergeIntoMap); - } - }); - } - - function updateInDeepMap(existing, keyPathIter, notSetValue, updater) { - var isNotSet = existing === NOT_SET; - var step = keyPathIter.next(); - if (step.done) { - var existingValue = isNotSet ? notSetValue : existing; - var newValue = updater(existingValue); - return newValue === existingValue ? existing : newValue; - } - invariant( - isNotSet || (existing && existing.set), - 'invalid keyPath' - ); - var key = step.value; - var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET); - var nextUpdated = updateInDeepMap( - nextExisting, - keyPathIter, - notSetValue, - updater - ); - return nextUpdated === nextExisting ? existing : - nextUpdated === NOT_SET ? existing.remove(key) : - (isNotSet ? emptyMap() : existing).set(key, nextUpdated); - } - - function popCount(x) { - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); - return x & 0x7f; - } - - function setIn(array, idx, val, canEdit) { - var newArray = canEdit ? array : arrCopy(array); - newArray[idx] = val; - return newArray; - } - - function spliceIn(array, idx, val, canEdit) { - var newLen = array.length + 1; - if (canEdit && idx + 1 === newLen) { - array[idx] = val; - return array; - } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { - if (ii === idx) { - newArray[ii] = val; - after = -1; - } else { - newArray[ii] = array[ii + after]; - } - } - return newArray; - } - - function spliceOut(array, idx, canEdit) { - var newLen = array.length - 1; - if (canEdit && idx === newLen) { - array.pop(); - return array; - } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { - if (ii === idx) { - after = 1; - } - newArray[ii] = array[ii + after]; - } - return newArray; - } - - var MAX_ARRAY_MAP_SIZE = SIZE / 4; - var MAX_BITMAP_INDEXED_SIZE = SIZE / 2; - var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4; - - createClass(List, IndexedCollection); - - // @pragma Construction - - function List(value) { - var empty = emptyList(); - if (value === null || value === undefined) { - return empty; - } - if (isList(value)) { - return value; - } - var iter = IndexedIterable(value); - var size = iter.size; - if (size === 0) { - return empty; - } - assertNotInfinite(size); - if (size > 0 && size < SIZE) { - return makeList(0, size, SHIFT, null, new VNode(iter.toArray())); - } - return empty.withMutations(function(list ) { - list.setSize(size); - iter.forEach(function(v, i) {return list.set(i, v)}); - }); - } - - List.of = function(/*...values*/) { - return this(arguments); - }; - - List.prototype.toString = function() { - return this.__toString('List [', ']'); - }; - - // @pragma Access - - List.prototype.get = function(index, notSetValue) { - index = wrapIndex(this, index); - if (index >= 0 && index < this.size) { - index += this._origin; - var node = listNodeFor(this, index); - return node && node.array[index & MASK]; - } - return notSetValue; - }; - - // @pragma Modification - - List.prototype.set = function(index, value) { - return updateList(this, index, value); - }; - - List.prototype.remove = function(index) { - return !this.has(index) ? this : - index === 0 ? this.shift() : - index === this.size - 1 ? this.pop() : - this.splice(index, 1); - }; - - List.prototype.insert = function(index, value) { - return this.splice(index, 0, value); - }; - - List.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = this._origin = this._capacity = 0; - this._level = SHIFT; - this._root = this._tail = null; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyList(); - }; - - List.prototype.push = function(/*...values*/) { - var values = arguments; - var oldSize = this.size; - return this.withMutations(function(list ) { - setListBounds(list, 0, oldSize + values.length); - for (var ii = 0; ii < values.length; ii++) { - list.set(oldSize + ii, values[ii]); - } - }); - }; - - List.prototype.pop = function() { - return setListBounds(this, 0, -1); - }; - - List.prototype.unshift = function(/*...values*/) { - var values = arguments; - return this.withMutations(function(list ) { - setListBounds(list, -values.length); - for (var ii = 0; ii < values.length; ii++) { - list.set(ii, values[ii]); - } - }); - }; - - List.prototype.shift = function() { - return setListBounds(this, 1); - }; - - // @pragma Composition - - List.prototype.merge = function(/*...iters*/) { - return mergeIntoListWith(this, undefined, arguments); - }; - - List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoListWith(this, merger, iters); - }; - - List.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoListWith(this, deepMerger, arguments); - }; - - List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoListWith(this, deepMergerWith(merger), iters); - }; - - List.prototype.setSize = function(size) { - return setListBounds(this, 0, size); - }; - - // @pragma Iteration - - List.prototype.slice = function(begin, end) { - var size = this.size; - if (wholeSlice(begin, end, size)) { - return this; - } - return setListBounds( - this, - resolveBegin(begin, size), - resolveEnd(end, size) - ); - }; - - List.prototype.__iterator = function(type, reverse) { - var index = 0; - var values = iterateList(this, reverse); - return new Iterator(function() { - var value = values(); - return value === DONE ? - iteratorDone() : - iteratorValue(type, index++, value); - }); - }; - - List.prototype.__iterate = function(fn, reverse) { - var index = 0; - var values = iterateList(this, reverse); - var value; - while ((value = values()) !== DONE) { - if (fn(value, index++, this) === false) { - break; - } - } - return index; - }; - - List.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - return this; - } - return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash); - }; - - - function isList(maybeList) { - return !!(maybeList && maybeList[IS_LIST_SENTINEL]); - } - - List.isList = isList; - - var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; - - var ListPrototype = List.prototype; - ListPrototype[IS_LIST_SENTINEL] = true; - ListPrototype[DELETE] = ListPrototype.remove; - ListPrototype.setIn = MapPrototype.setIn; - ListPrototype.deleteIn = - ListPrototype.removeIn = MapPrototype.removeIn; - ListPrototype.update = MapPrototype.update; - ListPrototype.updateIn = MapPrototype.updateIn; - ListPrototype.mergeIn = MapPrototype.mergeIn; - ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; - ListPrototype.withMutations = MapPrototype.withMutations; - ListPrototype.asMutable = MapPrototype.asMutable; - ListPrototype.asImmutable = MapPrototype.asImmutable; - ListPrototype.wasAltered = MapPrototype.wasAltered; - - - - function VNode(array, ownerID) { - this.array = array; - this.ownerID = ownerID; - } - - // TODO: seems like these methods are very similar - - VNode.prototype.removeBefore = function(ownerID, level, index) { - if (index === level ? 1 << level : 0 || this.array.length === 0) { - return this; - } - var originIndex = (index >>> level) & MASK; - if (originIndex >= this.array.length) { - return new VNode([], ownerID); - } - var removingFirst = originIndex === 0; - var newChild; - if (level > 0) { - var oldChild = this.array[originIndex]; - newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index); - if (newChild === oldChild && removingFirst) { - return this; - } - } - if (removingFirst && !newChild) { - return this; - } - var editable = editableVNode(this, ownerID); - if (!removingFirst) { - for (var ii = 0; ii < originIndex; ii++) { - editable.array[ii] = undefined; - } - } - if (newChild) { - editable.array[originIndex] = newChild; - } - return editable; - }; - - VNode.prototype.removeAfter = function(ownerID, level, index) { - if (index === (level ? 1 << level : 0) || this.array.length === 0) { - return this; - } - var sizeIndex = ((index - 1) >>> level) & MASK; - if (sizeIndex >= this.array.length) { - return this; - } - - var newChild; - if (level > 0) { - var oldChild = this.array[sizeIndex]; - newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index); - if (newChild === oldChild && sizeIndex === this.array.length - 1) { - return this; - } - } - - var editable = editableVNode(this, ownerID); - editable.array.splice(sizeIndex + 1); - if (newChild) { - editable.array[sizeIndex] = newChild; - } - return editable; - }; - - - - var DONE = {}; - - function iterateList(list, reverse) { - var left = list._origin; - var right = list._capacity; - var tailPos = getTailOffset(right); - var tail = list._tail; - - return iterateNodeOrLeaf(list._root, list._level, 0); - - function iterateNodeOrLeaf(node, level, offset) { - return level === 0 ? - iterateLeaf(node, offset) : - iterateNode(node, level, offset); - } - - function iterateLeaf(node, offset) { - var array = offset === tailPos ? tail && tail.array : node && node.array; - var from = offset > left ? 0 : left - offset; - var to = right - offset; - if (to > SIZE) { - to = SIZE; - } - return function() { - if (from === to) { - return DONE; - } - var idx = reverse ? --to : from++; - return array && array[idx]; - }; - } - - function iterateNode(node, level, offset) { - var values; - var array = node && node.array; - var from = offset > left ? 0 : (left - offset) >> level; - var to = ((right - offset) >> level) + 1; - if (to > SIZE) { - to = SIZE; - } - return function() { - do { - if (values) { - var value = values(); - if (value !== DONE) { - return value; - } - values = null; - } - if (from === to) { - return DONE; - } - var idx = reverse ? --to : from++; - values = iterateNodeOrLeaf( - array && array[idx], level - SHIFT, offset + (idx << level) - ); - } while (true); - }; - } - } - - function makeList(origin, capacity, level, root, tail, ownerID, hash) { - var list = Object.create(ListPrototype); - list.size = capacity - origin; - list._origin = origin; - list._capacity = capacity; - list._level = level; - list._root = root; - list._tail = tail; - list.__ownerID = ownerID; - list.__hash = hash; - list.__altered = false; - return list; - } - - var EMPTY_LIST; - function emptyList() { - return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT)); - } - - function updateList(list, index, value) { - index = wrapIndex(list, index); - - if (index !== index) { - return list; - } - - if (index >= list.size || index < 0) { - return list.withMutations(function(list ) { - index < 0 ? - setListBounds(list, index).set(0, value) : - setListBounds(list, 0, index + 1).set(index, value) - }); - } - - index += list._origin; - - var newTail = list._tail; - var newRoot = list._root; - var didAlter = MakeRef(DID_ALTER); - if (index >= getTailOffset(list._capacity)) { - newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter); - } else { - newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter); - } - - if (!didAlter.value) { - return list; - } - - if (list.__ownerID) { - list._root = newRoot; - list._tail = newTail; - list.__hash = undefined; - list.__altered = true; - return list; - } - return makeList(list._origin, list._capacity, list._level, newRoot, newTail); - } - - function updateVNode(node, ownerID, level, index, value, didAlter) { - var idx = (index >>> level) & MASK; - var nodeHas = node && idx < node.array.length; - if (!nodeHas && value === undefined) { - return node; - } - - var newNode; - - if (level > 0) { - var lowerNode = node && node.array[idx]; - var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter); - if (newLowerNode === lowerNode) { - return node; - } - newNode = editableVNode(node, ownerID); - newNode.array[idx] = newLowerNode; - return newNode; - } - - if (nodeHas && node.array[idx] === value) { - return node; - } - - SetRef(didAlter); - - newNode = editableVNode(node, ownerID); - if (value === undefined && idx === newNode.array.length - 1) { - newNode.array.pop(); - } else { - newNode.array[idx] = value; - } - return newNode; - } - - function editableVNode(node, ownerID) { - if (ownerID && node && ownerID === node.ownerID) { - return node; - } - return new VNode(node ? node.array.slice() : [], ownerID); - } - - function listNodeFor(list, rawIndex) { - if (rawIndex >= getTailOffset(list._capacity)) { - return list._tail; - } - if (rawIndex < 1 << (list._level + SHIFT)) { - var node = list._root; - var level = list._level; - while (node && level > 0) { - node = node.array[(rawIndex >>> level) & MASK]; - level -= SHIFT; - } - return node; - } - } - - function setListBounds(list, begin, end) { - // Sanitize begin & end using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - if (begin !== undefined) { - begin = begin | 0; - } - if (end !== undefined) { - end = end | 0; - } - var owner = list.__ownerID || new OwnerID(); - var oldOrigin = list._origin; - var oldCapacity = list._capacity; - var newOrigin = oldOrigin + begin; - var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end; - if (newOrigin === oldOrigin && newCapacity === oldCapacity) { - return list; - } - - // If it's going to end after it starts, it's empty. - if (newOrigin >= newCapacity) { - return list.clear(); - } - - var newLevel = list._level; - var newRoot = list._root; - - // New origin might need creating a higher root. - var offsetShift = 0; - while (newOrigin + offsetShift < 0) { - newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner); - newLevel += SHIFT; - offsetShift += 1 << newLevel; - } - if (offsetShift) { - newOrigin += offsetShift; - oldOrigin += offsetShift; - newCapacity += offsetShift; - oldCapacity += offsetShift; - } - - var oldTailOffset = getTailOffset(oldCapacity); - var newTailOffset = getTailOffset(newCapacity); - - // New size might need creating a higher root. - while (newTailOffset >= 1 << (newLevel + SHIFT)) { - newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner); - newLevel += SHIFT; - } - - // Locate or create the new tail. - var oldTail = list._tail; - var newTail = newTailOffset < oldTailOffset ? - listNodeFor(list, newCapacity - 1) : - newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; - - // Merge Tail into tree. - if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) { - newRoot = editableVNode(newRoot, owner); - var node = newRoot; - for (var level = newLevel; level > SHIFT; level -= SHIFT) { - var idx = (oldTailOffset >>> level) & MASK; - node = node.array[idx] = editableVNode(node.array[idx], owner); - } - node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail; - } - - // If the size has been reduced, there's a chance the tail needs to be trimmed. - if (newCapacity < oldCapacity) { - newTail = newTail && newTail.removeAfter(owner, 0, newCapacity); - } - - // If the new origin is within the tail, then we do not need a root. - if (newOrigin >= newTailOffset) { - newOrigin -= newTailOffset; - newCapacity -= newTailOffset; - newLevel = SHIFT; - newRoot = null; - newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); - - // Otherwise, if the root has been trimmed, garbage collect. - } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) { - offsetShift = 0; - - // Identify the new top root node of the subtree of the old root. - while (newRoot) { - var beginIndex = (newOrigin >>> newLevel) & MASK; - if (beginIndex !== (newTailOffset >>> newLevel) & MASK) { - break; - } - if (beginIndex) { - offsetShift += (1 << newLevel) * beginIndex; - } - newLevel -= SHIFT; - newRoot = newRoot.array[beginIndex]; - } - - // Trim the new sides of the new root. - if (newRoot && newOrigin > oldOrigin) { - newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift); - } - if (newRoot && newTailOffset < oldTailOffset) { - newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift); - } - if (offsetShift) { - newOrigin -= offsetShift; - newCapacity -= offsetShift; - } - } - - if (list.__ownerID) { - list.size = newCapacity - newOrigin; - list._origin = newOrigin; - list._capacity = newCapacity; - list._level = newLevel; - list._root = newRoot; - list._tail = newTail; - list.__hash = undefined; - list.__altered = true; - return list; - } - return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail); - } - - function mergeIntoListWith(list, merger, iterables) { - var iters = []; - var maxSize = 0; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = IndexedIterable(value); - if (iter.size > maxSize) { - maxSize = iter.size; - } - if (!isIterable(value)) { - iter = iter.map(function(v ) {return fromJS(v)}); - } - iters.push(iter); - } - if (maxSize > list.size) { - list = list.setSize(maxSize); - } - return mergeIntoCollectionWith(list, merger, iters); - } - - function getTailOffset(size) { - return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); - } - - createClass(OrderedMap, Map); - - // @pragma Construction - - function OrderedMap(value) { - return value === null || value === undefined ? emptyOrderedMap() : - isOrderedMap(value) ? value : - emptyOrderedMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } - - OrderedMap.of = function(/*...values*/) { - return this(arguments); - }; - - OrderedMap.prototype.toString = function() { - return this.__toString('OrderedMap {', '}'); - }; - - // @pragma Access - - OrderedMap.prototype.get = function(k, notSetValue) { - var index = this._map.get(k); - return index !== undefined ? this._list.get(index)[1] : notSetValue; - }; - - // @pragma Modification - - OrderedMap.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._map.clear(); - this._list.clear(); - return this; - } - return emptyOrderedMap(); - }; - - OrderedMap.prototype.set = function(k, v) { - return updateOrderedMap(this, k, v); - }; - - OrderedMap.prototype.remove = function(k) { - return updateOrderedMap(this, k, NOT_SET); - }; - - OrderedMap.prototype.wasAltered = function() { - return this._map.wasAltered() || this._list.wasAltered(); - }; - - OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._list.__iterate( - function(entry ) {return entry && fn(entry[1], entry[0], this$0)}, - reverse - ); - }; - - OrderedMap.prototype.__iterator = function(type, reverse) { - return this._list.fromEntrySeq().__iterator(type, reverse); - }; - - OrderedMap.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map.__ensureOwner(ownerID); - var newList = this._list.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - this._list = newList; - return this; - } - return makeOrderedMap(newMap, newList, ownerID, this.__hash); - }; - - - function isOrderedMap(maybeOrderedMap) { - return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); - } - - OrderedMap.isOrderedMap = isOrderedMap; - - OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; - OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; - - - - function makeOrderedMap(map, list, ownerID, hash) { - var omap = Object.create(OrderedMap.prototype); - omap.size = map ? map.size : 0; - omap._map = map; - omap._list = list; - omap.__ownerID = ownerID; - omap.__hash = hash; - return omap; - } - - var EMPTY_ORDERED_MAP; - function emptyOrderedMap() { - return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); - } - - function updateOrderedMap(omap, k, v) { - var map = omap._map; - var list = omap._list; - var i = map.get(k); - var has = i !== undefined; - var newMap; - var newList; - if (v === NOT_SET) { // removed - if (!has) { - return omap; - } - if (list.size >= SIZE && list.size >= map.size * 2) { - newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx}); - newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap(); - if (omap.__ownerID) { - newMap.__ownerID = newList.__ownerID = omap.__ownerID; - } - } else { - newMap = map.remove(k); - newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); - } - } else { - if (has) { - if (v === list.get(i)[1]) { - return omap; - } - newMap = map; - newList = list.set(i, [k, v]); - } else { - newMap = map.set(k, list.size); - newList = list.set(list.size, [k, v]); - } - } - if (omap.__ownerID) { - omap.size = newMap.size; - omap._map = newMap; - omap._list = newList; - omap.__hash = undefined; - return omap; - } - return makeOrderedMap(newMap, newList); - } - - createClass(ToKeyedSequence, KeyedSeq); - function ToKeyedSequence(indexed, useKeys) { - this._iter = indexed; - this._useKeys = useKeys; - this.size = indexed.size; - } - - ToKeyedSequence.prototype.get = function(key, notSetValue) { - return this._iter.get(key, notSetValue); - }; - - ToKeyedSequence.prototype.has = function(key) { - return this._iter.has(key); - }; - - ToKeyedSequence.prototype.valueSeq = function() { - return this._iter.valueSeq(); - }; - - ToKeyedSequence.prototype.reverse = function() {var this$0 = this; - var reversedSequence = reverseFactory(this, true); - if (!this._useKeys) { - reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()}; - } - return reversedSequence; - }; - - ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this; - var mappedSequence = mapFactory(this, mapper, context); - if (!this._useKeys) { - mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)}; - } - return mappedSequence; - }; - - ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var ii; - return this._iter.__iterate( - this._useKeys ? - function(v, k) {return fn(v, k, this$0)} : - ((ii = reverse ? resolveSize(this) : 0), - function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}), - reverse - ); - }; - - ToKeyedSequence.prototype.__iterator = function(type, reverse) { - if (this._useKeys) { - return this._iter.__iterator(type, reverse); - } - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var ii = reverse ? resolveSize(this) : 0; - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, reverse ? --ii : ii++, step.value, step); - }); - }; - - ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; - - - createClass(ToIndexedSequence, IndexedSeq); - function ToIndexedSequence(iter) { - this._iter = iter; - this.size = iter.size; - } - - ToIndexedSequence.prototype.includes = function(value) { - return this._iter.includes(value); - }; - - ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var iterations = 0; - return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse); - }; - - ToIndexedSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var iterations = 0; - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, iterations++, step.value, step) - }); - }; - - - - createClass(ToSetSequence, SetSeq); - function ToSetSequence(iter) { - this._iter = iter; - this.size = iter.size; - } - - ToSetSequence.prototype.has = function(key) { - return this._iter.includes(key); - }; - - ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse); - }; - - ToSetSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, step.value, step.value, step); - }); - }; - - - - createClass(FromEntriesSequence, KeyedSeq); - function FromEntriesSequence(entries) { - this._iter = entries; - this.size = entries.size; - } - - FromEntriesSequence.prototype.entrySeq = function() { - return this._iter.toSeq(); - }; - - FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(entry ) { - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return fn( - indexedIterable ? entry.get(1) : entry[1], - indexedIterable ? entry.get(0) : entry[0], - this$0 - ); - } - }, reverse); - }; - - FromEntriesSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return iteratorValue( - type, - indexedIterable ? entry.get(0) : entry[0], - indexedIterable ? entry.get(1) : entry[1], - step - ); - } - } - }); - }; - - - ToIndexedSequence.prototype.cacheResult = - ToKeyedSequence.prototype.cacheResult = - ToSetSequence.prototype.cacheResult = - FromEntriesSequence.prototype.cacheResult = - cacheResultThrough; - - - function flipFactory(iterable) { - var flipSequence = makeSequence(iterable); - flipSequence._iter = iterable; - flipSequence.size = iterable.size; - flipSequence.flip = function() {return iterable}; - flipSequence.reverse = function () { - var reversedSequence = iterable.reverse.apply(this); // super.reverse() - reversedSequence.flip = function() {return iterable.reverse()}; - return reversedSequence; - }; - flipSequence.has = function(key ) {return iterable.includes(key)}; - flipSequence.includes = function(key ) {return iterable.has(key)}; - flipSequence.cacheResult = cacheResultThrough; - flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse); - } - flipSequence.__iteratorUncached = function(type, reverse) { - if (type === ITERATE_ENTRIES) { - var iterator = iterable.__iterator(type, reverse); - return new Iterator(function() { - var step = iterator.next(); - if (!step.done) { - var k = step.value[0]; - step.value[0] = step.value[1]; - step.value[1] = k; - } - return step; - }); - } - return iterable.__iterator( - type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, - reverse - ); - } - return flipSequence; - } - - - function mapFactory(iterable, mapper, context) { - var mappedSequence = makeSequence(iterable); - mappedSequence.size = iterable.size; - mappedSequence.has = function(key ) {return iterable.has(key)}; - mappedSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v === NOT_SET ? - notSetValue : - mapper.call(context, v, key, iterable); - }; - mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate( - function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false}, - reverse - ); - } - mappedSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - return new Iterator(function() { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - return iteratorValue( - type, - key, - mapper.call(context, entry[1], key, iterable), - step - ); - }); - } - return mappedSequence; - } - - - function reverseFactory(iterable, useKeys) { - var reversedSequence = makeSequence(iterable); - reversedSequence._iter = iterable; - reversedSequence.size = iterable.size; - reversedSequence.reverse = function() {return iterable}; - if (iterable.flip) { - reversedSequence.flip = function () { - var flipSequence = flipFactory(iterable); - flipSequence.reverse = function() {return iterable.flip()}; - return flipSequence; - }; - } - reversedSequence.get = function(key, notSetValue) - {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; - reversedSequence.has = function(key ) - {return iterable.has(useKeys ? key : -1 - key)}; - reversedSequence.includes = function(value ) {return iterable.includes(value)}; - reversedSequence.cacheResult = cacheResultThrough; - reversedSequence.__iterate = function (fn, reverse) {var this$0 = this; - return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse); - }; - reversedSequence.__iterator = - function(type, reverse) {return iterable.__iterator(type, !reverse)}; - return reversedSequence; - } - - - function filterFactory(iterable, predicate, context, useKeys) { - var filterSequence = makeSequence(iterable); - if (useKeys) { - filterSequence.has = function(key ) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && !!predicate.call(context, v, key, iterable); - }; - filterSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && predicate.call(context, v, key, iterable) ? - v : notSetValue; - }; - } - filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - var iterations = 0; - iterable.__iterate(function(v, k, c) { - if (predicate.call(context, v, k, c)) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0); - } - }, reverse); - return iterations; - }; - filterSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterations = 0; - return new Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - var value = entry[1]; - if (predicate.call(context, value, key, iterable)) { - return iteratorValue(type, useKeys ? key : iterations++, value, step); - } - } - }); - } - return filterSequence; - } - - - function countByFactory(iterable, grouper, context) { - var groups = Map().asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - 0, - function(a ) {return a + 1} - ); - }); - return groups.asImmutable(); - } - - - function groupByFactory(iterable, grouper, context) { - var isKeyedIter = isKeyed(iterable); - var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)} - ); - }); - var coerce = iterableClass(iterable); - return groups.map(function(arr ) {return reify(iterable, coerce(arr))}); - } - - - function sliceFactory(iterable, begin, end, useKeys) { - var originalSize = iterable.size; - - // Sanitize begin & end using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - if (begin !== undefined) { - begin = begin | 0; - } - if (end !== undefined) { - if (end === Infinity) { - end = originalSize; - } else { - end = end | 0; - } - } - - if (wholeSlice(begin, end, originalSize)) { - return iterable; - } - - var resolvedBegin = resolveBegin(begin, originalSize); - var resolvedEnd = resolveEnd(end, originalSize); - - // begin or end will be NaN if they were provided as negative numbers and - // this iterable's size is unknown. In that case, cache first so there is - // a known size and these do not resolve to NaN. - if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { - return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); - } - - // Note: resolvedEnd is undefined when the original sequence's length is - // unknown and this slice did not supply an end and should contain all - // elements after resolvedBegin. - // In that case, resolvedSize will be NaN and sliceSize will remain undefined. - var resolvedSize = resolvedEnd - resolvedBegin; - var sliceSize; - if (resolvedSize === resolvedSize) { - sliceSize = resolvedSize < 0 ? 0 : resolvedSize; - } - - var sliceSeq = makeSequence(iterable); - - // If iterable.size is undefined, the size of the realized sliceSeq is - // unknown at this point unless the number of items to slice is 0 - sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; - - if (!useKeys && isSeq(iterable) && sliceSize >= 0) { - sliceSeq.get = function (index, notSetValue) { - index = wrapIndex(this, index); - return index >= 0 && index < sliceSize ? - iterable.get(index + resolvedBegin, notSetValue) : - notSetValue; - } - } - - sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this; - if (sliceSize === 0) { - return 0; - } - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var skipped = 0; - var isSkipping = true; - var iterations = 0; - iterable.__iterate(function(v, k) { - if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0) !== false && - iterations !== sliceSize; - } - }); - return iterations; - }; - - sliceSeq.__iteratorUncached = function(type, reverse) { - if (sliceSize !== 0 && reverse) { - return this.cacheResult().__iterator(type, reverse); - } - // Don't bother instantiating parent iterator if taking 0. - var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); - var skipped = 0; - var iterations = 0; - return new Iterator(function() { - while (skipped++ < resolvedBegin) { - iterator.next(); - } - if (++iterations > sliceSize) { - return iteratorDone(); - } - var step = iterator.next(); - if (useKeys || type === ITERATE_VALUES) { - return step; - } else if (type === ITERATE_KEYS) { - return iteratorValue(type, iterations - 1, undefined, step); - } else { - return iteratorValue(type, iterations - 1, step.value[1], step); - } - }); - } - - return sliceSeq; - } - - - function takeWhileFactory(iterable, predicate, context) { - var takeSequence = makeSequence(iterable);