diff --git a/.eslintignore b/.eslintignore index b3e5d0ab6ae2..d6ee3cf3fac4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,7 +9,6 @@ obj*/** # below. addon-sdk/** build/** -caps/** chrome/** config/** db/** @@ -78,6 +77,9 @@ browser/extensions/activity-stream/vendor/** # imported from chromium browser/extensions/mortar/** +# caps/ exclusions +caps/tests/mochitest/browser_checkloaduri.js + # devtools/ exclusions devtools/client/canvasdebugger/** devtools/client/commandline/** diff --git a/accessible/tests/mochitest/treeupdate/test_ariaowns.html b/accessible/tests/mochitest/treeupdate/test_ariaowns.html index 8b756bec3d63..8382699653a1 100644 --- a/accessible/tests/mochitest/treeupdate/test_ariaowns.html +++ b/accessible/tests/mochitest/treeupdate/test_ariaowns.html @@ -676,6 +676,58 @@ } } + /** + * Put ARIA owned child back when ARIA owner removed. + */ + function test10_removeARIAOwner() + { + this.eventSeq = [ + new invokerChecker(EVENT_HIDE, getAccessible('t10_owner')) + ]; + + this.invoke = () => { + let tree = + { SECTION: [ // t10_container + { SECTION: [ // t10_owner + { ENTRY: [] } // t10_child + ] } + ] }; + testAccessibleTree('t10_container', tree); + + getNode('t10_owner').remove(); + } + + this.getID = () => { + return 'Put aria owned child back when aria owner removed'; + } + } + + function test10_finishTest() + { + this.eventSeq = [ + new invokerChecker(EVENT_REORDER, 't10_container') + ]; + + this.invoke = () => { + // trigger a tree update. + getNode('t10_container').append(document.createElement('p')); + } + + this.finalCheck = () => { + let tree = + { SECTION: [ // t10_container + // { ENTRY: [] }, // t10_child + { PARAGRAPH: [] } + ] }; + testAccessibleTree('t10_container', tree); + todo(false, 'Input accessible has be moved back in the tree'); + } + + this.getID = () => { + return `Put aria owned child back when aria owner removed (finish test)`; + } + } + //////////////////////////////////////////////////////////////////////////// // Test //////////////////////////////////////////////////////////////////////////// @@ -728,6 +780,9 @@ gQueue.push(new test9_setARIAOwns()); gQueue.push(new test9_finish()); + gQueue.push(new test10_removeARIAOwner()); + gQueue.push(new test10_finishTest()); + gQueue.invoke(); // SimpleTest.finish() will be called in the end } @@ -792,6 +847,11 @@ + +
+
+ +
diff --git a/browser/app/blocklist.xml b/browser/app/blocklist.xml index bf2868c88a87..c556110a64e0 100644 --- a/browser/app/blocklist.xml +++ b/browser/app/blocklist.xml @@ -117,6 +117,10 @@ + + + + @@ -181,6 +185,10 @@ + + + + diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index ebac7c05cfcd..19dc4101560c 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -360,12 +360,6 @@ pref("browser.download.folderList", 1); pref("browser.download.manager.addToRecentDocs", true); pref("browser.download.manager.resumeOnWakeDelay", 10000); -#ifdef RELEASE_OR_BETA -pref("browser.download.showPanelDropmarker", false); -#else -pref("browser.download.showPanelDropmarker", true); -#endif - // This allows disabling the animated notifications shown by // the Downloads Indicator when a download starts or completes. pref("browser.download.animateNotifications", true); diff --git a/browser/components/downloads/DownloadsCommon.jsm b/browser/components/downloads/DownloadsCommon.jsm index b33b4e1bbf98..08488f6156ce 100644 --- a/browser/components/downloads/DownloadsCommon.jsm +++ b/browser/components/downloads/DownloadsCommon.jsm @@ -71,8 +71,6 @@ XPCOMUtils.defineLazyGetter(this, "DownloadsLogger", () => { return new ConsoleAPI(consoleOptions); }); -const nsIDM = Ci.nsIDownloadManager; - const kDownloadsStringBundleUrl = "chrome://browser/locale/downloads/downloads.properties"; @@ -124,7 +122,6 @@ var PrefObserver = { PrefObserver.register({ // prefName: defaultValue animateNotifications: true, - showPanelDropmarker: true, }); @@ -135,6 +132,19 @@ PrefObserver.register({ * and provides shared methods for all the instances of the user interface. */ this.DownloadsCommon = { + // The following legacy constants are still returned by stateOfDownload, but + // individual properties of the Download object should normally be used. + DOWNLOAD_NOTSTARTED: -1, + DOWNLOAD_DOWNLOADING: 0, + DOWNLOAD_FINISHED: 1, + DOWNLOAD_FAILED: 2, + DOWNLOAD_CANCELED: 3, + DOWNLOAD_PAUSED: 4, + DOWNLOAD_BLOCKED_PARENTAL: 6, + DOWNLOAD_DIRTY: 8, + DOWNLOAD_BLOCKED_POLICY: 9, + + // The following are the possible values of the "attention" property. ATTENTION_NONE: "", ATTENTION_SUCCESS: "success", ATTENTION_WARNING: "warning", @@ -183,13 +193,6 @@ this.DownloadsCommon = { return PrefObserver.animateNotifications; }, - /** - * Indicates whether we should show the dropmarker in the Downloads Panel. - */ - get showPanelDropmarker() { - return PrefObserver.showPanelDropmarker; - }, - /** * Get access to one of the DownloadsData or PrivateDownloadsData objects, * depending on the privacy status of the window in question. @@ -256,27 +259,27 @@ this.DownloadsCommon = { stateOfDownload(download) { // Collapse state using the correct priority. if (!download.stopped) { - return nsIDM.DOWNLOAD_DOWNLOADING; + return DownloadsCommon.DOWNLOAD_DOWNLOADING; } if (download.succeeded) { - return nsIDM.DOWNLOAD_FINISHED; + return DownloadsCommon.DOWNLOAD_FINISHED; } if (download.error) { if (download.error.becauseBlockedByParentalControls) { - return nsIDM.DOWNLOAD_BLOCKED_PARENTAL; + return DownloadsCommon.DOWNLOAD_BLOCKED_PARENTAL; } if (download.error.becauseBlockedByReputationCheck) { - return nsIDM.DOWNLOAD_DIRTY; + return DownloadsCommon.DOWNLOAD_DIRTY; } - return nsIDM.DOWNLOAD_FAILED; + return DownloadsCommon.DOWNLOAD_FAILED; } if (download.canceled) { if (download.hasPartialData) { - return nsIDM.DOWNLOAD_PAUSED; + return DownloadsCommon.DOWNLOAD_PAUSED; } - return nsIDM.DOWNLOAD_CANCELED; + return DownloadsCommon.DOWNLOAD_CANCELED; } - return nsIDM.DOWNLOAD_NOTSTARTED; + return DownloadsCommon.DOWNLOAD_NOTSTARTED; }, /** diff --git a/browser/components/downloads/DownloadsViewUI.jsm b/browser/components/downloads/DownloadsViewUI.jsm index fcb55a2dbd4a..95943ca0515a 100644 --- a/browser/components/downloads/DownloadsViewUI.jsm +++ b/browser/components/downloads/DownloadsViewUI.jsm @@ -325,18 +325,18 @@ this.DownloadsViewUI.DownloadElementShell.prototype = { */ get currentDefaultCommandName() { switch (DownloadsCommon.stateOfDownload(this.download)) { - case Ci.nsIDownloadManager.DOWNLOAD_NOTSTARTED: + case DownloadsCommon.DOWNLOAD_NOTSTARTED: return "downloadsCmd_cancel"; - case Ci.nsIDownloadManager.DOWNLOAD_FAILED: - case Ci.nsIDownloadManager.DOWNLOAD_CANCELED: + case DownloadsCommon.DOWNLOAD_FAILED: + case DownloadsCommon.DOWNLOAD_CANCELED: return "downloadsCmd_retry"; - case Ci.nsIDownloadManager.DOWNLOAD_PAUSED: + case DownloadsCommon.DOWNLOAD_PAUSED: return "downloadsCmd_pauseResume"; - case Ci.nsIDownloadManager.DOWNLOAD_FINISHED: + case DownloadsCommon.DOWNLOAD_FINISHED: return "downloadsCmd_open"; - case Ci.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL: + case DownloadsCommon.DOWNLOAD_BLOCKED_PARENTAL: return "downloadsCmd_openReferrer"; - case Ci.nsIDownloadManager.DOWNLOAD_DIRTY: + case DownloadsCommon.DOWNLOAD_DIRTY: return "downloadsCmd_showBlockedInfo"; } return ""; diff --git a/browser/components/downloads/content/allDownloadsViewOverlay.js b/browser/components/downloads/content/allDownloadsViewOverlay.js index e93ef3ef59a6..ebce00e4865b 100644 --- a/browser/components/downloads/content/allDownloadsViewOverlay.js +++ b/browser/components/downloads/content/allDownloadsViewOverlay.js @@ -30,8 +30,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Services", XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); -const nsIDM = Ci.nsIDownloadManager; - const DESTINATION_FILE_URI_ANNO = "downloads/destinationFileURI"; const DOWNLOAD_META_DATA_ANNO = "downloads/metaData"; @@ -72,17 +70,17 @@ HistoryDownload.prototype = { } if ("state" in metaData) { - this.succeeded = metaData.state == nsIDM.DOWNLOAD_FINISHED; - this.canceled = metaData.state == nsIDM.DOWNLOAD_CANCELED || - metaData.state == nsIDM.DOWNLOAD_PAUSED; + this.succeeded = metaData.state == DownloadsCommon.DOWNLOAD_FINISHED; + this.canceled = metaData.state == DownloadsCommon.DOWNLOAD_CANCELED || + metaData.state == DownloadsCommon.DOWNLOAD_PAUSED; this.endTime = metaData.endTime; // Recreate partial error information from the state saved in history. - if (metaData.state == nsIDM.DOWNLOAD_FAILED) { + if (metaData.state == DownloadsCommon.DOWNLOAD_FAILED) { this.error = { message: "History download failed." }; - } else if (metaData.state == nsIDM.DOWNLOAD_BLOCKED_PARENTAL) { + } else if (metaData.state == DownloadsCommon.DOWNLOAD_BLOCKED_PARENTAL) { this.error = { becauseBlockedByParentalControls: true }; - } else if (metaData.state == nsIDM.DOWNLOAD_DIRTY) { + } else if (metaData.state == DownloadsCommon.DOWNLOAD_DIRTY) { this.error = { becauseBlockedByReputationCheck: true, reputationCheckVerdict: metaData.reputationCheckVerdict || "", diff --git a/browser/components/downloads/content/downloads.css b/browser/components/downloads/content/downloads.css index 5f9f9257a903..695c75d12aeb 100644 --- a/browser/components/downloads/content/downloads.css +++ b/browser/components/downloads/content/downloads.css @@ -13,11 +13,6 @@ richlistitem[type="download"]:not([selected]) button { -moz-user-focus: none; } -.downloadsHideDropmarker > #downloadsFooterButtonsSplitter, -.downloadsHideDropmarker > #downloadsFooterDropmarker { - display: none; -} - richlistitem[type="download"].download-state[state="1"]:not([exists]) > .downloadButtonArea, richlistitem[type="download"].download-state[state="1"]:not([exists]) > toolbarseparator { display: none; @@ -29,9 +24,8 @@ richlistitem[type="download"].download-state[state="1"]:not([exists]) > toolbars display: none; } -#downloadsFooter[showingdropdown] > stack > #downloadsSummary, #downloadsFooter[showingsummary] > stack:hover > #downloadsSummary, -#downloadsFooter[showingsummary]:not([showingdropdown]) > stack:not(:hover) > #downloadsFooterButtons { +#downloadsFooter[showingsummary] > stack:not(:hover) > #downloadsFooterButtons { /* If we used "visibility: hidden;" then the mouseenter event of #downloadsHistory wouldn't be triggered immediately, and the hover styling of the button would not apply until the mouse is moved again. diff --git a/browser/components/downloads/content/downloads.js b/browser/components/downloads/content/downloads.js index 830219c9da14..23503de2efbb 100644 --- a/browser/components/downloads/content/downloads.js +++ b/browser/components/downloads/content/downloads.js @@ -224,14 +224,6 @@ const DownloadsPanel = { } this.initialize(() => { - let downloadsFooterButtons = - document.getElementById("downloadsFooterButtons"); - if (DownloadsCommon.showPanelDropmarker) { - downloadsFooterButtons.classList.remove("downloadsHideDropmarker"); - } else { - downloadsFooterButtons.classList.add("downloadsHideDropmarker"); - } - // Delay displaying the panel because this function will sometimes be // called while another window is closing (like the window for selecting // whether to save or open the file), and that would cause the panel to @@ -387,24 +379,6 @@ const DownloadsPanel = { this._state = this.kStateHidden; }, - onFooterPopupShowing(aEvent) { - let itemClearList = document.getElementById("downloadsDropdownItemClearList"); - if (DownloadsCommon.getData(window).canRemoveFinished) { - itemClearList.removeAttribute("hidden"); - } else { - itemClearList.setAttribute("hidden", "true"); - } - DownloadsViewController.updateCommands(); - - document.getElementById("downloadsFooter") - .setAttribute("showingdropdown", true); - }, - - onFooterPopupHidden(aEvent) { - document.getElementById("downloadsFooter") - .removeAttribute("showingdropdown"); - }, - // Related operations /** @@ -419,13 +393,6 @@ const DownloadsPanel = { BrowserDownloadsUI(); }, - openDownloadsFolder() { - Downloads.getPreferredDownloadsDirectory().then(downloadsPath => { - DownloadsCommon.showDirectory(new FileUtils.File(downloadsPath)); - }).catch(Cu.reportError); - this.hidePanel(); - }, - // Internal functions /** diff --git a/browser/components/downloads/content/downloadsOverlay.xul b/browser/components/downloads/content/downloadsOverlay.xul index 702244ddf0f6..f985d506c50e 100644 --- a/browser/components/downloads/content/downloadsOverlay.xul +++ b/browser/components/downloads/content/downloadsOverlay.xul @@ -154,23 +154,6 @@ accesskey="&downloadsHistory.accesskey;" flex="1" oncommand="DownloadsPanel.showDownloadsHistory();"/> - - diff --git a/browser/components/downloads/test/browser/browser.ini b/browser/components/downloads/test/browser/browser.ini index cfe65e855bd5..9875d3fe5d88 100644 --- a/browser/components/downloads/test/browser/browser.ini +++ b/browser/components/downloads/test/browser/browser.ini @@ -12,5 +12,4 @@ skip-if = os == "linux" # Bug 952422 [browser_libraryDrop.js] [browser_downloads_panel_block.js] skip-if = true # Bug 1352792 -[browser_downloads_panel_footer.js] [browser_downloads_panel_height.js] diff --git a/browser/components/downloads/test/browser/browser_basic_functionality.js b/browser/components/downloads/test/browser/browser_basic_functionality.js index 4f2deaf8e47f..d6706e5252dc 100644 --- a/browser/components/downloads/test/browser/browser_basic_functionality.js +++ b/browser/components/downloads/test/browser/browser_basic_functionality.js @@ -14,11 +14,11 @@ registerCleanupFunction(function*() { add_task(function* test_basic_functionality() { // Display one of each download state. const DownloadData = [ - { state: nsIDM.DOWNLOAD_NOTSTARTED }, - { state: nsIDM.DOWNLOAD_PAUSED }, - { state: nsIDM.DOWNLOAD_FINISHED }, - { state: nsIDM.DOWNLOAD_FAILED }, - { state: nsIDM.DOWNLOAD_CANCELED }, + { state: DownloadsCommon.DOWNLOAD_NOTSTARTED }, + { state: DownloadsCommon.DOWNLOAD_PAUSED }, + { state: DownloadsCommon.DOWNLOAD_FINISHED }, + { state: DownloadsCommon.DOWNLOAD_FAILED }, + { state: DownloadsCommon.DOWNLOAD_CANCELED }, ]; // Wait for focus first diff --git a/browser/components/downloads/test/browser/browser_downloads_panel_block.js b/browser/components/downloads/test/browser/browser_downloads_panel_block.js index e4f6532035b6..c2992d76dd09 100644 --- a/browser/components/downloads/test/browser/browser_downloads_panel_block.js +++ b/browser/components/downloads/test/browser/browser_downloads_panel_block.js @@ -139,7 +139,7 @@ function promisePanelHidden() { function makeDownload(verdict) { return { - state: nsIDM.DOWNLOAD_DIRTY, + state: DownloadsCommon.DOWNLOAD_DIRTY, hasBlockedData: true, errorObj: { result: Components.results.NS_ERROR_FAILURE, diff --git a/browser/components/downloads/test/browser/browser_downloads_panel_footer.js b/browser/components/downloads/test/browser/browser_downloads_panel_footer.js deleted file mode 100644 index ce1fc07e456e..000000000000 --- a/browser/components/downloads/test/browser/browser_downloads_panel_footer.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; - -function *task_openDownloadsSubPanel() { - let downloadSubPanel = document.getElementById("downloadSubPanel"); - let popupShownPromise = BrowserTestUtils.waitForEvent(downloadSubPanel, "popupshown"); - - let downloadsDropmarker = document.getElementById("downloadsFooterDropmarker"); - EventUtils.synthesizeMouseAtCenter(downloadsDropmarker, {}, window); - - yield popupShownPromise; -} - -add_task(function* test_openDownloadsFolder() { - yield SpecialPowers.pushPrefEnv({"set": [["browser.download.showPanelDropmarker", true]]}); - yield task_openPanel(); - - yield task_openDownloadsSubPanel(); - - yield new Promise(resolve => { - sinon.stub(DownloadsCommon, "showDirectory", file => { - resolve(Downloads.getPreferredDownloadsDirectory().then(downloadsPath => { - is(file.path, downloadsPath, "Check the download folder path."); - })); - }); - - let itemOpenDownloadsFolder = - document.getElementById("downloadsDropdownItemOpenDownloadsFolder"); - EventUtils.synthesizeMouseAtCenter(itemOpenDownloadsFolder, {}, window); - }); - - yield task_resetState(); -}); - -add_task(function* test_clearList() { - const kTestCases = [{ - downloads: [ - { state: nsIDM.DOWNLOAD_NOTSTARTED }, - { state: nsIDM.DOWNLOAD_FINISHED }, - { state: nsIDM.DOWNLOAD_FAILED }, - { state: nsIDM.DOWNLOAD_CANCELED }, - ], - expectClearListShown: true, - expectedItemNumber: 0, - }, { - downloads: [ - { state: nsIDM.DOWNLOAD_NOTSTARTED }, - { state: nsIDM.DOWNLOAD_FINISHED }, - { state: nsIDM.DOWNLOAD_FAILED }, - { state: nsIDM.DOWNLOAD_PAUSED }, - { state: nsIDM.DOWNLOAD_CANCELED }, - ], - expectClearListShown: true, - expectedItemNumber: 1, - }, { - downloads: [ - { state: nsIDM.DOWNLOAD_PAUSED }, - ], - expectClearListShown: false, - expectedItemNumber: 1, - }]; - - for (let testCase of kTestCases) { - yield verify_clearList(testCase); - } -}); - -function *verify_clearList(testCase) { - let downloads = testCase.downloads; - yield task_addDownloads(downloads); - - yield task_openPanel(); - is(DownloadsView._downloads.length, downloads.length, - "Expect the number of download items"); - - yield task_openDownloadsSubPanel(); - - let itemClearList = document.getElementById("downloadsDropdownItemClearList"); - let itemNumberPromise = BrowserTestUtils.waitForCondition(() => { - return DownloadsView._downloads.length === testCase.expectedItemNumber; - }); - if (testCase.expectClearListShown) { - isnot("true", itemClearList.getAttribute("hidden"), - "Should show Clear Preview Panel button"); - EventUtils.synthesizeMouseAtCenter(itemClearList, {}, window); - } else { - is("true", itemClearList.getAttribute("hidden"), - "Should not show Clear Preview Panel button"); - } - - yield itemNumberPromise; - is(DownloadsView._downloads.length, testCase.expectedItemNumber, - "Download items remained."); - - yield task_resetState(); -} diff --git a/browser/components/downloads/test/browser/browser_downloads_panel_height.js b/browser/components/downloads/test/browser/browser_downloads_panel_height.js index 1638e4f0e88e..ba9e67776fc5 100644 --- a/browser/components/downloads/test/browser/browser_downloads_panel_height.js +++ b/browser/components/downloads/test/browser/browser_downloads_panel_height.js @@ -10,7 +10,7 @@ */ add_task(function* test_height_reduced_after_removal() { yield task_addDownloads([ - { state: nsIDM.DOWNLOAD_FINISHED }, + { state: DownloadsCommon.DOWNLOAD_FINISHED }, ]); yield task_openPanel(); diff --git a/browser/components/downloads/test/browser/head.js b/browser/components/downloads/test/browser/head.js index 2db53ef7028c..4e31dbe2b147 100644 --- a/browser/components/downloads/test/browser/head.js +++ b/browser/components/downloads/test/browser/head.js @@ -24,8 +24,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", XPCOMUtils.defineLazyModuleGetter(this, "HttpServer", "resource://testing-common/httpd.js"); -const nsIDM = Ci.nsIDownloadManager; - var gTestTargetFile = FileUtils.getFile("TmpD", ["dm-ui-test.file"]); gTestTargetFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); @@ -163,11 +161,12 @@ function* task_addDownloads(aItems) { target: { path: gTestTargetFile.path, }, - succeeded: item.state == nsIDM.DOWNLOAD_FINISHED, - canceled: item.state == nsIDM.DOWNLOAD_CANCELED || - item.state == nsIDM.DOWNLOAD_PAUSED, - error: item.state == nsIDM.DOWNLOAD_FAILED ? new Error("Failed.") : null, - hasPartialData: item.state == nsIDM.DOWNLOAD_PAUSED, + succeeded: item.state == DownloadsCommon.DOWNLOAD_FINISHED, + canceled: item.state == DownloadsCommon.DOWNLOAD_CANCELED || + item.state == DownloadsCommon.DOWNLOAD_PAUSED, + error: item.state == DownloadsCommon.DOWNLOAD_FAILED ? + new Error("Failed.") : null, + hasPartialData: item.state == DownloadsCommon.DOWNLOAD_PAUSED, hasBlockedData: item.hasBlockedData || false, startTime: new Date(startTimeMs++), }; diff --git a/browser/extensions/pdfjs/README.mozilla b/browser/extensions/pdfjs/README.mozilla index 79c6f345d0ef..64e4d65f898b 100644 --- a/browser/extensions/pdfjs/README.mozilla +++ b/browser/extensions/pdfjs/README.mozilla @@ -1,5 +1,5 @@ This is the PDF.js project output, https://github.com/mozilla/pdf.js -Current extension version is: 1.8.314 +Current extension version is: 1.8.331 -Taken from upstream commit: 3adda80f +Taken from upstream commit: 0dbc68a6 diff --git a/browser/extensions/pdfjs/content/build/pdf.js b/browser/extensions/pdfjs/content/build/pdf.js index f10739144652..61b5d486475f 100644 --- a/browser/extensions/pdfjs/content/build/pdf.js +++ b/browser/extensions/pdfjs/content/build/pdf.js @@ -98,7 +98,13 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; /* WEBPACK VAR INJECTION */(function(global) { -var compatibility = __w_pdfjs_require__(14); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isInt = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.isArray = exports.info = exports.globalScope = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.error = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.StatTimer = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; + +__w_pdfjs_require__(14); + var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : undefined; var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; var TextRenderingMode = { @@ -3386,8 +3392,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { }(); var version, build; { - exports.version = version = '1.8.314'; - exports.build = build = '3adda80f'; + exports.version = version = '1.8.331'; + exports.build = build = '0dbc68a6'; } exports.getDocument = getDocument; exports.LoopbackPort = LoopbackPort; @@ -4389,8 +4395,8 @@ if (!_util.globalScope.PDFJS) { } var PDFJS = _util.globalScope.PDFJS; { - PDFJS.version = '1.8.314'; - PDFJS.build = '3adda80f'; + PDFJS.version = '1.8.331'; + PDFJS.build = '0dbc68a6'; } PDFJS.pdfBug = false; if (PDFJS.verbosity !== undefined) { @@ -6704,8 +6710,8 @@ exports.TilingPattern = TilingPattern; "use strict"; -var pdfjsVersion = '1.8.314'; -var pdfjsBuild = '3adda80f'; +var pdfjsVersion = '1.8.331'; +var pdfjsBuild = '0dbc68a6'; var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsDisplayGlobal = __w_pdfjs_require__(8); var pdfjsDisplayAPI = __w_pdfjs_require__(3); @@ -6717,7 +6723,7 @@ exports.PDFJS = pdfjsDisplayGlobal.PDFJS; exports.build = pdfjsDisplayAPI.build; exports.version = pdfjsDisplayAPI.version; exports.getDocument = pdfjsDisplayAPI.getDocument; -exports.LoobpackPort = pdfjsDisplayAPI.LoopbackPort; +exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort; exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport; exports.PDFWorker = pdfjsDisplayAPI.PDFWorker; exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer; @@ -6748,6 +6754,8 @@ exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; "use strict"; +; + /***/ }) /******/ ]); }); \ No newline at end of file diff --git a/browser/extensions/pdfjs/content/build/pdf.worker.js b/browser/extensions/pdfjs/content/build/pdf.worker.js index f27b9b2dedbe..a4277642a438 100644 --- a/browser/extensions/pdfjs/content/build/pdf.worker.js +++ b/browser/extensions/pdfjs/content/build/pdf.worker.js @@ -98,7 +98,13 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; /* WEBPACK VAR INJECTION */(function(global) { -var compatibility = __w_pdfjs_require__(36); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isInt = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.isArray = exports.info = exports.globalScope = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.error = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.StatTimer = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; + +__w_pdfjs_require__(36); + var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : undefined; var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; var TextRenderingMode = { @@ -36626,8 +36632,8 @@ exports.Type1Parser = Type1Parser; "use strict"; -var pdfjsVersion = '1.8.314'; -var pdfjsBuild = '3adda80f'; +var pdfjsVersion = '1.8.331'; +var pdfjsBuild = '0dbc68a6'; var pdfjsCoreWorker = __w_pdfjs_require__(17); ; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; @@ -36639,6 +36645,8 @@ exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; "use strict"; +; + /***/ }) /******/ ]); }); \ No newline at end of file diff --git a/browser/extensions/pdfjs/content/web/debugger.js b/browser/extensions/pdfjs/content/web/debugger.js index 71a2955b1ebe..6720e1c0dcbb 100644 --- a/browser/extensions/pdfjs/content/web/debugger.js +++ b/browser/extensions/pdfjs/content/web/debugger.js @@ -149,11 +149,11 @@ var FontInspector = (function FontInspectorClosure() { fonts.appendChild(font); // Somewhat of a hack, should probably add a hook for when the text layer // is done rendering. - setTimeout(function() { + setTimeout(() => { if (this.active) { resetSelection(); } - }.bind(this), 2000); + }, 2000); } }; })(); diff --git a/browser/extensions/pdfjs/content/web/viewer.js b/browser/extensions/pdfjs/content/web/viewer.js index da72a3530930..c11d4f510d4f 100644 --- a/browser/extensions/pdfjs/content/web/viewer.js +++ b/browser/extensions/pdfjs/content/web/viewer.js @@ -91,7 +91,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.mozL10n = exports.RendererType = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined; +exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.mozL10n = exports.RendererType = exports.cloneObj = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined; var _pdfjs = __webpack_require__(1); @@ -359,6 +359,15 @@ function normalizeWheelEventDelta(evt) { } return delta; } +function cloneObj(obj) { + var result = {}; + for (var i in obj) { + if (Object.prototype.hasOwnProperty.call(obj, i)) { + result[i] = obj[i]; + } + } + return result; +} var animationStarted = new Promise(function (resolve) { window.requestAnimationFrame(resolve); }); @@ -479,6 +488,7 @@ exports.UNKNOWN_SCALE = UNKNOWN_SCALE; exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING; exports.VERTICAL_PADDING = VERTICAL_PADDING; +exports.cloneObj = cloneObj; exports.RendererType = RendererType; exports.mozL10n = mozL10n; exports.EventBus = EventBus; @@ -1167,6 +1177,7 @@ var PDFViewerApplication = { this.pdfThumbnailViewer.setDocument(null); this.pdfViewer.setDocument(null); this.pdfLinkService.setDocument(null, null); + this.pdfDocumentProperties.setDocument(null, null); } this.store = null; this.isInitialViewSet = false; @@ -1310,10 +1321,10 @@ var PDFViewerApplication = { this.disableAutoFetchLoadingBarTimeout = null; } this.loadingBar.show(); - this.disableAutoFetchLoadingBarTimeout = setTimeout(function () { + this.disableAutoFetchLoadingBarTimeout = setTimeout(() => { this.loadingBar.hide(); this.disableAutoFetchLoadingBarTimeout = null; - }.bind(this), DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT); + }, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT); } } }, @@ -1321,7 +1332,6 @@ var PDFViewerApplication = { var self = this; scale = scale || _ui_utils.UNKNOWN_SCALE; this.pdfDocument = pdfDocument; - this.pdfDocumentProperties.setDocumentAndUrl(pdfDocument, this.url); var downloadedPromise = pdfDocument.getDownloadInfo().then(function () { self.downloadComplete = true; self.loadingBar.hide(); @@ -1333,6 +1343,7 @@ var PDFViewerApplication = { var baseDocumentUrl; baseDocumentUrl = this.baseUrl; this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl); + this.pdfDocumentProperties.setDocument(pdfDocument, this.url); var pdfViewer = this.pdfViewer; pdfViewer.currentScale = scale; pdfViewer.setDocument(pdfDocument); @@ -2273,8 +2284,8 @@ Object.defineProperty(exports, "__esModule", { var OverlayManager = { overlays: {}, active: null, - register: function overlayManagerRegister(name, element, callerCloseMethod, canForceClose) { - return new Promise(function (resolve) { + register(name, element, callerCloseMethod, canForceClose) { + return new Promise(resolve => { var container; if (!name || !element || !(container = element.parentNode)) { throw new Error('Not enough parameters.'); @@ -2288,10 +2299,10 @@ var OverlayManager = { canForceClose: canForceClose || false }; resolve(); - }.bind(this)); + }); }, - unregister: function overlayManagerUnregister(name) { - return new Promise(function (resolve) { + unregister(name) { + return new Promise(resolve => { if (!this.overlays[name]) { throw new Error('The overlay does not exist.'); } else if (this.active === name) { @@ -2299,10 +2310,10 @@ var OverlayManager = { } delete this.overlays[name]; resolve(); - }.bind(this)); + }); }, - open: function overlayManagerOpen(name) { - return new Promise(function (resolve) { + open(name) { + return new Promise(resolve => { if (!this.overlays[name]) { throw new Error('The overlay does not exist.'); } else if (this.active) { @@ -2319,10 +2330,10 @@ var OverlayManager = { this.overlays[this.active].container.classList.remove('hidden'); window.addEventListener('keydown', this._keyDown); resolve(); - }.bind(this)); + }); }, - close: function overlayManagerClose(name) { - return new Promise(function (resolve) { + close(name) { + return new Promise(resolve => { if (!this.overlays[name]) { throw new Error('The overlay does not exist.'); } else if (!this.active) { @@ -2335,16 +2346,16 @@ var OverlayManager = { this.active = null; window.removeEventListener('keydown', this._keyDown); resolve(); - }.bind(this)); + }); }, - _keyDown: function overlayManager_keyDown(evt) { + _keyDown(evt) { var self = OverlayManager; if (self.active && evt.keyCode === 27) { self._closeThroughCaller(); evt.preventDefault(); } }, - _closeThroughCaller: function overlayManager_closeThroughCaller() { + _closeThroughCaller() { if (this.overlays[this.active].callerCloseMethod) { this.overlays[this.active].callerCloseMethod(); } @@ -2895,7 +2906,7 @@ var PDFFindController = function PDFFindControllerClosure() { } this.state = state; this.updateUIState(FindStates.FIND_PENDING); - this._firstPagePromise.then(function () { + this._firstPagePromise.then(() => { this.extractText(); clearTimeout(this.findTimeout); if (cmd === 'find') { @@ -2903,7 +2914,7 @@ var PDFFindController = function PDFFindControllerClosure() { } else { this.nextMatch(); } - }.bind(this)); + }); }, updatePage: function PDFFindController_updatePage(index) { if (this.selected.pageIdx === index) { @@ -3212,17 +3223,18 @@ var DownloadManager = function DownloadManagerClosure() { }); }, download: function DownloadManager_download(blob, url, filename) { - var blobUrl = window.URL.createObjectURL(blob); - FirefoxCom.request('download', { - blobUrl, - originalUrl: url, - filename - }, function response(err) { + let blobUrl = window.URL.createObjectURL(blob); + let onResponse = err => { if (err && this.onerror) { this.onerror(err); } window.URL.revokeObjectURL(blobUrl); - }.bind(this)); + }; + FirefoxCom.request('download', { + blobUrl, + originalUrl: url, + filename + }, onResponse); } }; return DownloadManager; @@ -3608,16 +3620,16 @@ var HandTool = function HandToolClosure() { this.handTool.activate(); } }).catch(function rejected(reason) {}); - this.eventBus.on('presentationmodechanged', function (e) { - if (e.switchInProgress) { + this.eventBus.on('presentationmodechanged', evt => { + if (evt.switchInProgress) { return; } - if (e.active) { + if (evt.active) { this.enterPresentationMode(); } else { this.exitPresentationMode(); } - }.bind(this)); + }); } HandTool.prototype = { get isActive() { @@ -3800,8 +3812,8 @@ class PDFAttachmentViewer { } this._dispatchEvent(attachmentsCount); } - _appendAttachment(item) { - this._renderedCapability.promise.then(function (id, filename, content) { + _appendAttachment({ id, filename, content }) { + this._renderedCapability.promise.then(() => { var attachments = this.attachments; if (!attachments) { attachments = Object.create(null); @@ -3820,7 +3832,7 @@ class PDFAttachmentViewer { attachments, keepRenderedCapability: true }); - }.bind(this, item.id, item.filename, item.content)); + }); } } exports.PDFAttachmentViewer = PDFAttachmentViewer; @@ -3843,77 +3855,101 @@ var _pdfjs = __webpack_require__(1); var _overlay_manager = __webpack_require__(5); +const DEFAULT_FIELD_CONTENT = '-'; class PDFDocumentProperties { - constructor(options) { - this.overlayName = options.overlayName; - this.fields = options.fields; - this.container = options.container; - this.rawFileSize = 0; - this.url = null; - this.pdfDocument = null; - if (options.closeButton) { - options.closeButton.addEventListener('click', this.close.bind(this)); + constructor({ overlayName, fields, container, closeButton }) { + this.overlayName = overlayName; + this.fields = fields; + this.container = container; + this._reset(); + if (closeButton) { + closeButton.addEventListener('click', this.close.bind(this)); } - this._dataAvailableCapability = (0, _pdfjs.createPromiseCapability)(); _overlay_manager.OverlayManager.register(this.overlayName, this.container, this.close.bind(this)); } open() { + let freezeFieldData = data => { + Object.defineProperty(this, 'fieldData', { + value: Object.freeze(data), + writable: false, + enumerable: true, + configurable: true + }); + }; Promise.all([_overlay_manager.OverlayManager.open(this.overlayName), this._dataAvailableCapability.promise]).then(() => { - this._getProperties(); + if (this.fieldData) { + this._updateUI(); + return; + } + this.pdfDocument.getMetadata().then(({ info, metadata }) => { + freezeFieldData({ + 'fileName': (0, _ui_utils.getPDFFileNameFromURL)(this.url), + 'fileSize': this._parseFileSize(this.maybeFileSize), + 'title': info.Title, + 'author': info.Author, + 'subject': info.Subject, + 'keywords': info.Keywords, + 'creationDate': this._parseDate(info.CreationDate), + 'modificationDate': this._parseDate(info.ModDate), + 'creator': info.Creator, + 'producer': info.Producer, + 'version': info.PDFFormatVersion, + 'pageCount': this.pdfDocument.numPages + }); + this._updateUI(); + return this.pdfDocument.getDownloadInfo(); + }).then(({ length }) => { + let data = (0, _ui_utils.cloneObj)(this.fieldData); + data['fileSize'] = this._parseFileSize(length); + freezeFieldData(data); + this._updateUI(); + }); }); } close() { _overlay_manager.OverlayManager.close(this.overlayName); } - setFileSize(fileSize) { - if (fileSize > 0) { - this.rawFileSize = fileSize; + setDocument(pdfDocument, url) { + if (this.pdfDocument) { + this._reset(); + this._updateUI(true); + } + if (!pdfDocument) { + return; } - } - setDocumentAndUrl(pdfDocument, url) { this.pdfDocument = pdfDocument; this.url = url; this._dataAvailableCapability.resolve(); } - _getProperties() { - if (!_overlay_manager.OverlayManager.active) { + setFileSize(fileSize) { + if (typeof fileSize === 'number' && fileSize > 0) { + this.maybeFileSize = fileSize; + } + } + _reset() { + this.pdfDocument = null; + this.url = null; + this.maybeFileSize = 0; + delete this.fieldData; + this._dataAvailableCapability = (0, _pdfjs.createPromiseCapability)(); + } + _updateUI(reset = false) { + if (reset || !this.fieldData) { + for (let id in this.fields) { + this.fields[id].textContent = DEFAULT_FIELD_CONTENT; + } return; } - this.pdfDocument.getDownloadInfo().then(data => { - if (data.length === this.rawFileSize) { - return; - } - this.setFileSize(data.length); - this._updateUI(this.fields['fileSize'], this._parseFileSize()); - }); - this.pdfDocument.getMetadata().then(data => { - var content = { - 'fileName': (0, _ui_utils.getPDFFileNameFromURL)(this.url), - 'fileSize': this._parseFileSize(), - 'title': data.info.Title, - 'author': data.info.Author, - 'subject': data.info.Subject, - 'keywords': data.info.Keywords, - 'creationDate': this._parseDate(data.info.CreationDate), - 'modificationDate': this._parseDate(data.info.ModDate), - 'creator': data.info.Creator, - 'producer': data.info.Producer, - 'version': data.info.PDFFormatVersion, - 'pageCount': this.pdfDocument.numPages - }; - for (var identifier in content) { - this._updateUI(this.fields[identifier], content[identifier]); - } - }); - } - _updateUI(field, content) { - if (field && content !== undefined && content !== '') { - field.textContent = content; + if (_overlay_manager.OverlayManager.active !== this.overlayName) { + return; + } + for (let id in this.fields) { + let content = this.fieldData[id]; + this.fields[id].textContent = content || content === 0 ? content : DEFAULT_FIELD_CONTENT; } } - _parseFileSize() { - var fileSize = this.rawFileSize, - kb = fileSize / 1024; + _parseFileSize(fileSize = 0) { + let kb = fileSize / 1024; if (!kb) { return; } else if (kb < 1024) { @@ -3928,10 +3964,10 @@ class PDFDocumentProperties { }, '{{size_mb}} MB ({{size_b}} bytes)'); } _parseDate(inputDate) { - var dateToParse = inputDate; - if (dateToParse === undefined) { - return ''; + if (!inputDate) { + return; } + let dateToParse = inputDate; if (dateToParse.substring(0, 2) === 'D:') { dateToParse = dateToParse.substring(2); } @@ -6020,10 +6056,10 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() { if (!pdfDocument) { return Promise.resolve(); } - return pdfDocument.getPage(1).then(function (firstPage) { + return pdfDocument.getPage(1).then(firstPage => { var pagesCount = pdfDocument.numPages; var viewport = firstPage.getViewport(1.0); - for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { + for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { var thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({ container: this.container, id: pageNum, @@ -6034,7 +6070,7 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() { }); this.thumbnails.push(thumbnail); } - }.bind(this)); + }); }, _cancelRendering: function PDFThumbnailViewer_cancelRendering() { for (var i = 0, ii = this.thumbnails.length; i < ii; i++) { @@ -6354,8 +6390,8 @@ var PDFViewer = function pdfViewer() { return; } var getPagesLeft = pagesCount; - for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { - pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) { + for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { + pdfDocument.getPage(pageNum).then(pdfPage => { var pageView = this._pages[pageNum - 1]; if (!pageView.pdfPage) { pageView.setPdfPage(pdfPage); @@ -6364,7 +6400,7 @@ var PDFViewer = function pdfViewer() { if (--getPagesLeft === 0) { pagesCapability.resolve(); } - }.bind(this, pageNum)); + }); } }); this.eventBus.dispatch('pagesinit', { source: this }); @@ -6785,6 +6821,10 @@ exports.PDFViewer = PDFViewer; Object.defineProperty(exports, "__esModule", { value: true }); +exports.BasePreferences = undefined; + +var _ui_utils = __webpack_require__(0); + var defaultPreferences = null; function getDefaultPreferences() { if (!defaultPreferences) { @@ -6811,15 +6851,6 @@ function getDefaultPreferences() { } return defaultPreferences; } -function cloneObj(obj) { - var result = {}; - for (var i in obj) { - if (Object.prototype.hasOwnProperty.call(obj, i)) { - result[i] = obj[i]; - } - } - return result; -} class BasePreferences { constructor() { if (this.constructor === BasePreferences) { @@ -6833,7 +6864,7 @@ class BasePreferences { enumerable: true, configurable: false }); - this.prefs = cloneObj(defaults); + this.prefs = (0, _ui_utils.cloneObj)(defaults); return this._readFromStorage(defaults); }).then(prefObj => { if (prefObj) { @@ -6849,7 +6880,7 @@ class BasePreferences { } reset() { return this._initializedPromise.then(() => { - this.prefs = cloneObj(this.defaults); + this.prefs = (0, _ui_utils.cloneObj)(this.defaults); return this._writeToStorage(this.defaults); }); } @@ -7009,18 +7040,16 @@ var SecondaryToolbar = function SecondaryToolbarClosure() { }, _bindClickListeners: function SecondaryToolbar_bindClickListeners() { this.toggleButton.addEventListener('click', this.toggle.bind(this)); - for (var button in this.buttons) { - var element = this.buttons[button].element; - var eventName = this.buttons[button].eventName; - var close = this.buttons[button].close; - element.addEventListener('click', function (eventName, close) { + for (let button in this.buttons) { + let { element, eventName, close } = this.buttons[button]; + element.addEventListener('click', evt => { if (eventName !== null) { this.eventBus.dispatch(eventName, { source: this }); } if (close) { this.close(); } - }.bind(this, eventName, close)); + }); } }, _bindHandToolListener: function SecondaryToolbar_bindHandToolListener(toggleHandToolButton) { @@ -7141,11 +7170,11 @@ var TextLayerBuilder = function TextLayerBuilderClosure() { timeout, enhanceTextSelection: this.enhanceTextSelection }); - this.textLayerRenderTask.promise.then(function () { + this.textLayerRenderTask.promise.then(() => { this.textLayerDiv.appendChild(textLayerFrag); this._finishRendering(); this.updateMatches(); - }.bind(this), function (reason) {}); + }, function (reason) {}); }, cancel: function TextLayerBuilder_cancel() { if (this.textLayerRenderTask) { diff --git a/browser/locales/en-US/chrome/browser/downloads/downloads.dtd b/browser/locales/en-US/chrome/browser/downloads/downloads.dtd index d749fdc0ef23..abb96955d8c6 100644 --- a/browser/locales/en-US/chrome/browser/downloads/downloads.dtd +++ b/browser/locales/en-US/chrome/browser/downloads/downloads.dtd @@ -134,7 +134,11 @@ - + + diff --git a/browser/themes/shared/downloads/downloads.inc.css b/browser/themes/shared/downloads/downloads.inc.css index 65a198256a6b..8b61a4310bfd 100644 --- a/browser/themes/shared/downloads/downloads.inc.css +++ b/browser/themes/shared/downloads/downloads.inc.css @@ -97,54 +97,14 @@ padding-inline-end: 10px; } -#downloadsPanel[hasdownloads] #downloadsFooterButtons:not(.downloadsHideDropmarker) > #downloadsHistory { - padding-inline-start: 68px; -} - -toolbarseparator.downloadsDropmarkerSplitter { - margin: 7px 0; -} - @item@ > toolbarseparator { margin: 10px 0; } -@item@:hover > toolbarseparator, -#downloadsFooter:hover toolbarseparator.downloadsDropmarkerSplitter, -#downloadsFooter[showingdropdown] toolbarseparator { +@item@:hover > toolbarseparator { margin: 0; } -.downloadsDropmarker { - padding: 0 21px; -} - -.downloadsDropmarker > .button-box > hbox { - display: none; -} - -.downloadsDropmarker > .button-box > .button-menu-dropmarker { - /* This is to override the linux !important */ - -moz-appearance: none !important; - display: -moz-box; - padding: 0; - margin: 0; -} - -.downloadsDropmarker > .button-box > .button-menu-dropmarker > .dropmarker-icon { - width: 16px; - height: 16px; - list-style-image: url("chrome://global/skin/icons/menubutton-dropmarker.svg"); - filter: url("chrome://global/skin/filters.svg#fill"); - fill: currentColor; -} - -/* Override default icon size which is too small for this dropdown */ -.downloadsDropmarker > .button-box > .button-menu-dropmarker { - width: 16px; - height: 16px; -} - #downloadsSummary { -moz-user-focus: normal; } diff --git a/caps/.eslintrc.js b/caps/.eslintrc.js new file mode 100644 index 000000000000..810a54bd55f7 --- /dev/null +++ b/caps/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "plugin:mozilla/recommended" + ] +}; diff --git a/caps/tests/mochitest/.eslintrc.js b/caps/tests/mochitest/.eslintrc.js new file mode 100644 index 000000000000..ff1b5b846239 --- /dev/null +++ b/caps/tests/mochitest/.eslintrc.js @@ -0,0 +1,8 @@ +"use strict"; + +module.exports = { + "extends": [ + "plugin:mozilla/mochitest-test", + "plugin:mozilla/browser-test" + ] +}; diff --git a/caps/tests/mochitest/test_addonMayLoad.html b/caps/tests/mochitest/test_addonMayLoad.html index 235944c0b506..a777c82021b7 100644 --- a/caps/tests/mochitest/test_addonMayLoad.html +++ b/caps/tests/mochitest/test_addonMayLoad.html @@ -22,8 +22,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1180921 SimpleTest.waitForExplicitFinish(); let oldAddonIdCallback = aps.setExtensionURIToAddonIdCallback(uri => uri.host); SimpleTest.registerCleanupFunction(function() { - aps.setAddonLoadURICallback('addona', null); - aps.setAddonLoadURICallback('addonb', null); + aps.setAddonLoadURICallback("addona", null); + aps.setAddonLoadURICallback("addonb", null); aps.setExtensionURIToAddonIdCallback(oldAddonIdCallback); }); @@ -41,28 +41,28 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1180921 return p; } - let addonA = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI('moz-extension://addonA/'), {}), - {wantGlobalProperties: ['XMLHttpRequest']}); - let addonB = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI('moz-extension://addonB/'), {}), - {wantGlobalProperties: ['XMLHttpRequest']}); + let addonA = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI("moz-extension://addonA/"), {}), + {wantGlobalProperties: ["XMLHttpRequest"]}); + let addonB = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI("moz-extension://addonB/"), {}), + {wantGlobalProperties: ["XMLHttpRequest"]}); - function uriForDomain(d) { return d + '/tests/caps/tests/mochitest/file_data.txt' } + function uriForDomain(d) { return d + "/tests/caps/tests/mochitest/file_data.txt" } - tryLoad(addonA, uriForDomain('http://test1.example.org')) + tryLoad(addonA, uriForDomain("http://test1.example.org")) .then(function(success) { ok(!success, "cross-origin load should fail for addon A"); - aps.setAddonLoadURICallback('addona', function(uri) { return /test1/.test(uri.host); }); - aps.setAddonLoadURICallback('addonb', function(uri) { return /test2/.test(uri.host); }); - return tryLoad(addonA, uriForDomain('http://test1.example.org')); + aps.setAddonLoadURICallback("addona", function(uri) { return /test1/.test(uri.host); }); + aps.setAddonLoadURICallback("addonb", function(uri) { return /test2/.test(uri.host); }); + return tryLoad(addonA, uriForDomain("http://test1.example.org")); }).then(function(success) { ok(success, "whitelisted cross-origin load of test1 should succeed for addon A"); - return tryLoad(addonB, uriForDomain('http://test1.example.org')); + return tryLoad(addonB, uriForDomain("http://test1.example.org")); }).then(function(success) { ok(!success, "non-whitelisted cross-origin load of test1 should fail for addon B"); - return tryLoad(addonB, uriForDomain('http://test2.example.org')); + return tryLoad(addonB, uriForDomain("http://test2.example.org")); }).then(function(success) { ok(success, "whitelisted cross-origin load of test2 should succeed for addon B"); - return tryLoad(addonA, uriForDomain('http://test2.example.org')); + return tryLoad(addonA, uriForDomain("http://test2.example.org")); }).then(function(success) { ok(!success, "non-whitelisted cross-origin load of test2 should fail for addon A"); SimpleTest.finish(); diff --git a/caps/tests/mochitest/test_bug246699.html b/caps/tests/mochitest/test_bug246699.html index bb733e5dfba3..93af24ad82c3 100644 --- a/caps/tests/mochitest/test_bug246699.html +++ b/caps/tests/mochitest/test_bug246699.html @@ -21,35 +21,31 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=246699 ** Test for Bug 246699 ** (should produce stack information for caps errors) **/ -function isError(e) -{ +function isError(e) { return e.constructor.name === "Error" || e.constructor.name === "TypeError"; } -function hasStack(e) -{ +function hasStack(e) { return isError(e) && /inciteCaps/.test(e.stack); } -function inciteCaps(f) -{ +function inciteCaps(f) { try { f(); return "operation succeeded"; - } catch (e if hasStack(e)) { - return "denied-stack"; } catch (e) { + if (hasStack(e)) { + return "denied-stack"; + } return "unexpected: " + e; } } -function tryChromeLoad() -{ +function tryChromeLoad() { window.frames[0].location = "chrome://global/content/mozilla.xhtml"; } -function tryComponentsClasses() -{ +function tryComponentsClasses() { return SpecialPowers.Components.classes["@mozilla.org/dummy;1"]; } diff --git a/caps/tests/mochitest/test_bug292789.html b/caps/tests/mochitest/test_bug292789.html index 88bdbd1c6d02..190420883ead 100644 --- a/caps/tests/mochitest/test_bug292789.html +++ b/caps/tests/mochitest/test_bug292789.html @@ -25,6 +25,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=292789 ** even for ALLOW_CHROME mechanisms (" + +/***/ }, +/* 997 */ +/***/ function(module, exports) { + + module.exports = "" + +/***/ }, +/* 998 */ /***/ function(module, exports) { module.exports = "" /***/ }, -/* 971 */ +/* 999 */ +/***/ function(module, exports) { + + module.exports = "icon" + +/***/ }, +/* 1000 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + var Tree = __webpack_require__(1001); + + module.exports = { + Tree + }; + +/***/ }, +/* 1001 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + var _require = __webpack_require__(2), + dom = _require.DOM, + createClass = _require.createClass, + createFactory = _require.createFactory, + PropTypes = _require.PropTypes; + + var AUTO_EXPAND_DEPTH = 0; // depth + + /** + * An arrow that displays whether its node is expanded (▼) or collapsed + * (▶). When its node has no children, it is hidden. + */ + var ArrowExpander = createFactory(createClass({ + displayName: "ArrowExpander", + + shouldComponentUpdate(nextProps, nextState) { + return this.props.item !== nextProps.item || this.props.visible !== nextProps.visible || this.props.expanded !== nextProps.expanded; + }, + + render() { + var attrs = { + className: "arrow theme-twisty", + onClick: this.props.expanded ? () => this.props.onCollapse(this.props.item) : e => this.props.onExpand(this.props.item, e.altKey) + }; + + if (this.props.expanded) { + attrs.className += " open"; + } + + if (!this.props.visible) { + attrs.style = Object.assign({}, this.props.style || {}, { + visibility: "hidden" + }); + } + + return dom.div(attrs, this.props.children); + } + })); + + var TreeNode = createFactory(createClass({ + displayName: "TreeNode", + + componentDidMount() { + if (this.props.focused) { + this.refs.button.focus(); + } + }, + + componentDidUpdate() { + if (this.props.focused) { + this.refs.button.focus(); + } + }, + + shouldComponentUpdate(nextProps) { + return this.props.item !== nextProps.item || this.props.focused !== nextProps.focused || this.props.expanded !== nextProps.expanded; + }, + + render() { + var arrow = ArrowExpander({ + item: this.props.item, + expanded: this.props.expanded, + visible: this.props.hasChildren, + onExpand: this.props.onExpand, + onCollapse: this.props.onCollapse + }); + + var isOddRow = this.props.index % 2; + return dom.div({ + className: `tree-node div ${isOddRow ? "tree-node-odd" : ""}`, + onFocus: this.props.onFocus, + onClick: this.props.onFocus, + onBlur: this.props.onBlur, + style: { + padding: 0, + margin: 0 + } + }, this.props.renderItem(this.props.item, this.props.depth, this.props.focused, arrow, this.props.expanded), + + // XXX: OSX won't focus/blur regular elements even if you set tabindex + // unless there is an input/button child. + dom.button(this._buttonAttrs)); + }, + + _buttonAttrs: { + ref: "button", + style: { + opacity: 0, + width: "0 !important", + height: "0 !important", + padding: "0 !important", + outline: "none", + MozAppearance: "none", + // XXX: Despite resetting all of the above properties (and margin), the + // button still ends up with ~79px width, so we set a large negative + // margin to completely hide it. + MozMarginStart: "-1000px !important" + } + } + })); + + /** + * Create a function that calls the given function `fn` only once per animation + * frame. + * + * @param {Function} fn + * @returns {Function} + */ + function oncePerAnimationFrame(fn) { + var animationId = null; + var argsToPass = null; + return function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + argsToPass = args; + if (animationId !== null) { + return; + } + + animationId = requestAnimationFrame(() => { + fn.call.apply(fn, [this].concat(_toConsumableArray(argsToPass))); + animationId = null; + argsToPass = null; + }); + }; + } + + var NUMBER_OF_OFFSCREEN_ITEMS = 1; + + /** + * A generic tree component. See propTypes for the public API. + * + * @see `devtools/client/memory/components/test/mochitest/head.js` for usage + * @see `devtools/client/memory/components/heap.js` for usage + */ + var Tree = module.exports = createClass({ + displayName: "Tree", + + propTypes: { + // Required props + + // A function to get an item's parent, or null if it is a root. + getParent: PropTypes.func.isRequired, + // A function to get an item's children. + getChildren: PropTypes.func.isRequired, + // A function which takes an item and ArrowExpander and returns a + // component. + renderItem: PropTypes.func.isRequired, + // A function which returns the roots of the tree (forest). + getRoots: PropTypes.func.isRequired, + // A function to get a unique key for the given item. + getKey: PropTypes.func.isRequired, + // A function to get whether an item is expanded or not. If an item is not + // expanded, then it must be collapsed. + isExpanded: PropTypes.func.isRequired, + // The height of an item in the tree including margin and padding, in + // pixels. + itemHeight: PropTypes.number.isRequired, + + // Optional props + + // The currently focused item, if any such item exists. + focused: PropTypes.any, + // Handle when a new item is focused. + onFocus: PropTypes.func, + // The depth to which we should automatically expand new items. + autoExpandDepth: PropTypes.number, + // Should auto expand all new items or just the new items under the first + // root item. + autoExpandAll: PropTypes.bool, + // Optional event handlers for when items are expanded or collapsed. + onExpand: PropTypes.func, + onCollapse: PropTypes.func + }, + + getDefaultProps() { + return { + autoExpandDepth: AUTO_EXPAND_DEPTH, + autoExpandAll: true + }; + }, + + getInitialState() { + return { + scroll: 0, + height: window.innerHeight, + seen: new Set() + }; + }, + + componentDidMount() { + window.addEventListener("resize", this._updateHeight); + this._autoExpand(this.props); + this._updateHeight(); + }, + + componentWillUnmount() { + window.removeEventListener("resize", this._updateHeight); + }, + + componentWillReceiveProps(nextProps) { + this._autoExpand(nextProps); + this._updateHeight(); + }, + + _autoExpand(props) { + if (!props.autoExpandDepth) { + return; + } + + // Automatically expand the first autoExpandDepth levels for new items. Do + // not use the usual DFS infrastructure because we don't want to ignore + // collapsed nodes. + var autoExpand = (item, currentDepth) => { + if (currentDepth >= props.autoExpandDepth || this.state.seen.has(item)) { + return; + } + + props.onExpand(item); + this.state.seen.add(item); + + var children = props.getChildren(item); + var length = children.length; + for (var i = 0; i < length; i++) { + autoExpand(children[i], currentDepth + 1); + } + }; + + var roots = props.getRoots(); + var length = roots.length; + if (props.autoExpandAll) { + for (var i = 0; i < length; i++) { + autoExpand(roots[i], 0); + } + } else if (length != 0) { + autoExpand(roots[0], 0); + } + }, + + render() { + var traversal = this._dfsFromRoots(); + + var renderItem = i => { + var _traversal$i = traversal[i], + item = _traversal$i.item, + depth = _traversal$i.depth; + + return TreeNode({ + key: this.props.getKey(item, i), + index: i, + item: item, + depth: depth, + renderItem: this.props.renderItem, + focused: this.props.focused === item, + expanded: this.props.isExpanded(item), + hasChildren: !!this.props.getChildren(item).length, + onExpand: this._onExpand, + onCollapse: this._onCollapse, + onFocus: () => this._focus(i, item) + }); + }; + + var style = Object.assign({}, this.props.style || {}, { + padding: 0, + margin: 0 + }); + + return dom.div({ + className: "tree", + ref: "tree", + onKeyDown: this._onKeyDown, + onKeyPress: this._preventArrowKeyScrolling, + onKeyUp: this._preventArrowKeyScrolling, + onScroll: this._onScroll, + style + }, traversal.map((v, i) => renderItem(i))); + }, + + _preventArrowKeyScrolling(e) { + switch (e.key) { + case "ArrowUp": + case "ArrowDown": + case "ArrowLeft": + case "ArrowRight": + e.preventDefault(); + e.stopPropagation(); + if (e.nativeEvent) { + if (e.nativeEvent.preventDefault) { + e.nativeEvent.preventDefault(); + } + if (e.nativeEvent.stopPropagation) { + e.nativeEvent.stopPropagation(); + } + } + } + }, + + /** + * Updates the state's height based on clientHeight. + */ + _updateHeight() { + this.setState({ + height: this.refs.tree.clientHeight + }); + }, + + /** + * Perform a pre-order depth-first search from item. + */ + _dfs(item) { + var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity; + var traversal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + + var _depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + + traversal.push({ item, depth: _depth }); + + if (!this.props.isExpanded(item)) { + return traversal; + } + + var nextDepth = _depth + 1; + + if (nextDepth > maxDepth) { + return traversal; + } + + var children = this.props.getChildren(item); + var length = children.length; + for (var i = 0; i < length; i++) { + this._dfs(children[i], maxDepth, traversal, nextDepth); + } + + return traversal; + }, + + /** + * Perform a pre-order depth-first search over the whole forest. + */ + _dfsFromRoots() { + var maxDepth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity; + + var traversal = []; + + var roots = this.props.getRoots(); + var length = roots.length; + for (var i = 0; i < length; i++) { + this._dfs(roots[i], maxDepth, traversal); + } + + return traversal; + }, + + /** + * Expands current row. + * + * @param {Object} item + * @param {Boolean} expandAllChildren + */ + _onExpand: oncePerAnimationFrame(function (item, expandAllChildren) { + if (this.props.onExpand) { + this.props.onExpand(item); + + if (expandAllChildren) { + var children = this._dfs(item); + var length = children.length; + for (var i = 0; i < length; i++) { + this.props.onExpand(children[i].item); + } + } + } + }), + + /** + * Collapses current row. + * + * @param {Object} item + */ + _onCollapse: oncePerAnimationFrame(function (item) { + if (this.props.onCollapse) { + this.props.onCollapse(item); + } + }), + + /** + * Sets the passed in item to be the focused item. + * + * @param {Number} index + * The index of the item in a full DFS traversal (ignoring collapsed + * nodes). Ignored if `item` is undefined. + * + * @param {Object|undefined} item + * The item to be focused, or undefined to focus no item. + */ + _focus(index, item) { + if (item !== undefined) { + var itemStartPosition = index * this.props.itemHeight; + var itemEndPosition = (index + 1) * this.props.itemHeight; + + // Note that if the height of the viewport (this.state.height) is less than + // `this.props.itemHeight`, we could accidentally try and scroll both up and + // down in a futile attempt to make both the item's start and end positions + // visible. Instead, give priority to the start of the item by checking its + // position first, and then using an "else if", rather than a separate "if", + // for the end position. + if (this.state.scroll > itemStartPosition) { + this.refs.tree.scrollTop = itemStartPosition; + } else if (this.state.scroll + this.state.height < itemEndPosition) { + this.refs.tree.scrollTop = itemEndPosition - this.state.height; + } + } + + if (this.props.onFocus) { + this.props.onFocus(item); + } + }, + + /** + * Sets the state to have no focused item. + */ + _onBlur() { + this._focus(0, undefined); + }, + + /** + * Fired on a scroll within the tree's container, updates + * the stored position of the view port to handle virtual view rendering. + * + * @param {Event} e + */ + _onScroll: oncePerAnimationFrame(function (e) { + this.setState({ + scroll: Math.max(this.refs.tree.scrollTop, 0), + height: this.refs.tree.clientHeight + }); + }), + + /** + * Handles key down events in the tree's container. + * + * @param {Event} e + */ + _onKeyDown(e) { + if (this.props.focused == null) { + return; + } + + // Allow parent nodes to use navigation arrows with modifiers. + if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) { + return; + } + + this._preventArrowKeyScrolling(e); + + switch (e.key) { + case "ArrowUp": + this._focusPrevNode(); + return; + + case "ArrowDown": + this._focusNextNode(); + return; + + case "ArrowLeft": + if (this.props.isExpanded(this.props.focused) && this.props.getChildren(this.props.focused).length) { + this._onCollapse(this.props.focused); + } else { + this._focusParentNode(); + } + return; + + case "ArrowRight": + if (!this.props.isExpanded(this.props.focused)) { + this._onExpand(this.props.focused); + } + return; + } + }, + + /** + * Sets the previous node relative to the currently focused item, to focused. + */ + _focusPrevNode: oncePerAnimationFrame(function () { + // Start a depth first search and keep going until we reach the currently + // focused node. Focus the previous node in the DFS, if it exists. If it + // doesn't exist, we're at the first node already. + + var prev = void 0; + var prevIndex = void 0; + + var traversal = this._dfsFromRoots(); + var length = traversal.length; + for (var i = 0; i < length; i++) { + var item = traversal[i].item; + if (item === this.props.focused) { + break; + } + prev = item; + prevIndex = i; + } + + if (prev === undefined) { + return; + } + + this._focus(prevIndex, prev); + }), + + /** + * Handles the down arrow key which will focus either the next child + * or sibling row. + */ + _focusNextNode: oncePerAnimationFrame(function () { + // Start a depth first search and keep going until we reach the currently + // focused node. Focus the next node in the DFS, if it exists. If it + // doesn't exist, we're at the last node already. + + var traversal = this._dfsFromRoots(); + var length = traversal.length; + var i = 0; + + while (i < length) { + if (traversal[i].item === this.props.focused) { + break; + } + i++; + } + + if (i + 1 < traversal.length) { + this._focus(i + 1, traversal[i + 1].item); + } + }), + + /** + * Handles the left arrow key, going back up to the current rows' + * parent row. + */ + _focusParentNode: oncePerAnimationFrame(function () { + var parent = this.props.getParent(this.props.focused); + if (!parent) { + return; + } + + var traversal = this._dfsFromRoots(); + var length = traversal.length; + var parentIndex = 0; + for (; parentIndex < length; parentIndex++) { + if (traversal[parentIndex].item === parent) { + break; + } + } + + this._focus(parentIndex, parent); + }) + }); + +/***/ }, +/* 1002 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, -/* 972 */, -/* 973 */ -/***/ function(module, exports) { +/* 1003 */, +/* 1004 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = simplifyDisplayName; + + var _react = __webpack_require__(2); + + var _devtoolsConfig = __webpack_require__(828); + + var _Svg = __webpack_require__(344); + + var _Svg2 = _interopRequireDefault(_Svg); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var ReactDOM = __webpack_require__(22); + + + var breakpointSvg = document.createElement("div"); + ReactDOM.render((0, _Svg2.default)("breakpoint"), breakpointSvg); + + function makeBookmark() { + var widget = document.createElement("span"); + widget.innerText = "+"; + widget.classList.add("inline-bp"); + return widget; + } + + class ColumnBreakpoint extends _react.Component { + + constructor() { + super(); + + this.bookmark = undefined; + var self = this; + self.addBreakpoint = this.addBreakpoint.bind(this); + } + + addBreakpoint() { + if (!(0, _devtoolsConfig.isEnabled)("columnBreakpoints")) { + return; + } + + var bp = this.props.breakpoint; + var line = bp.location.line - 1; + var column = bp.location.column; + var editor = this.props.editor; + + var widget = makeBookmark(); + var bookmark = editor.setBookmark({ line, ch: column }, { widget }); + this.bookmark = bookmark; + } + shouldComponentUpdate(nextProps) { + return this.props.editor !== nextProps.editor || this.props.breakpoint.disabled !== nextProps.breakpoint.disabled || this.props.breakpoint.condition !== nextProps.breakpoint.condition; + } + componentDidMount() { + if (!this.props.editor) { + return; + } + + this.addBreakpoint(); + } + componentDidUpdate() { + this.addBreakpoint(); + } + componentWillUnmount() { + if (!this.props.editor || !this.bookmark) { + return; + } + + this.bookmark.clear(); + } + render() { + return null; + } + } + + ColumnBreakpoint.propTypes = { + breakpoint: _react.PropTypes.object.isRequired, + editor: _react.PropTypes.object.isRequired + }; + + ColumnBreakpoint.displayName = "ColumnBreakpoint"; + + exports.default = ColumnBreakpoint; + +/***/ }, +/* 1005 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _redux = __webpack_require__(3); + + var _reactRedux = __webpack_require__(151); + + var _Frame = __webpack_require__(1006); + + var _Frame2 = _interopRequireDefault(_Frame); + + var _Group2 = __webpack_require__(1008); + + var _Group3 = _interopRequireDefault(_Group2); + + var _actions = __webpack_require__(244); + + var _actions2 = _interopRequireDefault(_actions); + + var _frame = __webpack_require__(1007); + + var _selectors = __webpack_require__(242); + + __webpack_require__(1011); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + // NOTE: using require because `import get` breaks atom's syntax highlighting + var get = __webpack_require__(67); + + var FrameComponent = (0, _react.createFactory)(_Frame2.default); + + var Group = (0, _react.createFactory)(_Group3.default); + + var NUM_FRAMES_SHOWN = 7; + + class Frames extends _react.Component { + + constructor() { + super(...arguments); + + this.state = { + showAllFrames: false + }; + + this.toggleFramesDisplay = this.toggleFramesDisplay.bind(this); + } + + shouldComponentUpdate(nextProps, nextState) { + var _props = this.props, + frames = _props.frames, + selectedFrame = _props.selectedFrame; + var showAllFrames = this.state.showAllFrames; + + return frames !== nextProps.frames || selectedFrame !== nextProps.selectedFrame || showAllFrames !== nextState.showAllFrames; + } + + toggleFramesDisplay() { + this.setState({ + showAllFrames: !this.state.showAllFrames + }); + } + + truncateFrames(frames) { + var numFramesToShow = this.state.showAllFrames ? frames.length : NUM_FRAMES_SHOWN; + + return frames.slice(0, numFramesToShow); + } + + renderFrames(frames) { + var _props2 = this.props, + selectFrame = _props2.selectFrame, + selectedFrame = _props2.selectedFrame; + + + var framesOrGroups = this.truncateFrames((0, _frame.collapseFrames)(frames)); + + return _react.DOM.ul({}, framesOrGroups.map(frameOrGroup => frameOrGroup.id ? FrameComponent({ + frame: frameOrGroup, + frames, + selectFrame, + selectedFrame, + key: frameOrGroup.id + }) : Group({ + group: frameOrGroup, + selectFrame, + selectedFrame, + key: frameOrGroup[0].id + }))); + } + + renderToggleButton(frames) { + var buttonMessage = this.state.showAllFrames ? L10N.getStr("callStack.collapse") : L10N.getStr("callStack.expand"); + + frames = (0, _frame.collapseFrames)(frames); + if (frames.length < NUM_FRAMES_SHOWN) { + return null; + } + + return _react.DOM.div({ className: "show-more", onClick: this.toggleFramesDisplay }, buttonMessage); + } + + render() { + var frames = this.props.frames; + + + if (!frames) { + return _react.DOM.div({ className: "pane frames" }, _react.DOM.div({ className: "pane-info empty" }, L10N.getStr("callStack.notPaused"))); + } + + return _react.DOM.div({ className: "pane frames" }, this.renderFrames(frames), this.renderToggleButton(frames)); + } + } + + Frames.propTypes = { + frames: _react.PropTypes.array, + selectedFrame: _react.PropTypes.object, + selectFrame: _react.PropTypes.func.isRequired + }; + + Frames.displayName = "Frames"; + + function getSourceForFrame(state, frame) { + return (0, _selectors.getSource)(state, frame.location.sourceId); + } + + function appendSource(state, frame) { + return Object.assign({}, frame, { + source: getSourceForFrame(state, frame).toJS() + }); + } + + function getAndProcessFrames(state) { + var frames = (0, _selectors.getFrames)(state); + if (!frames) { + return null; + } + + frames = frames.toJS().filter(frame => getSourceForFrame(state, frame)).filter(frame => !get(frame, "source.isBlackBoxed")).map(frame => appendSource(state, frame)).map(_frame.annotateFrame); + + // frames = filterFrameworkFrames(frames); + return frames; + } + + exports.default = (0, _reactRedux.connect)(state => ({ + frames: getAndProcessFrames(state), + selectedFrame: (0, _selectors.getSelectedFrame)(state) + }), dispatch => (0, _redux.bindActionCreators)(_actions2.default, dispatch))(Frames); + +/***/ }, +/* 1006 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _devtoolsLaunchpad = __webpack_require__(131); + + var _classnames = __webpack_require__(175); + + var _classnames2 = _interopRequireDefault(_classnames); + + var _Svg = __webpack_require__(344); + + var _Svg2 = _interopRequireDefault(_Svg); + + var _clipboard = __webpack_require__(423); + + var _frame = __webpack_require__(1007); + + var _source = __webpack_require__(233); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function renderFrameTitle(frame, options) { + var displayName = (0, _frame.formatDisplayName)(frame, options); + return _react.DOM.div({ className: "title" }, displayName); + } + + + function renderFrameLocation(_ref) { + var source = _ref.source, + location = _ref.location, + library = _ref.library; + + if (!source) { + return; + } + + if (library) { + return _react.DOM.div({ className: "location" }, library, (0, _Svg2.default)(library.toLowerCase(), { className: "annotation-logo" })); + } + + var filename = (0, _source.getFilename)(source); + return _react.DOM.div({ className: "location" }, `${filename}: ${location.line}`); + } + + class FrameComponent extends _react.Component { + + constructor() { + super(...arguments); + } + + onContextMenu(event, frame, frames) { + var copySourceUrlLabel = L10N.getStr("copySourceUrl"); + var copySourceUrlKey = L10N.getStr("copySourceUrl.accesskey"); + var copyStackTraceLabel = L10N.getStr("copyStackTrace"); + var copyStackTraceKey = L10N.getStr("copyStackTrace.accesskey"); + + event.stopPropagation(); + event.preventDefault(); + + var menuOptions = []; + + var source = frame.source; + if (source) { + var copySourceUrl = { + id: "node-menu-copy-source", + label: copySourceUrlLabel, + accesskey: copySourceUrlKey, + disabled: false, + click: () => (0, _clipboard.copyToTheClipboard)(source.url) + }; + + menuOptions.push(copySourceUrl); + } + + var framesToCopy = frames.map(f => (0, _frame.formatCopyName)(f)).join("\n"); + var copyStackTrace = { + id: "node-menu-copy-source", + label: copyStackTraceLabel, + accesskey: copyStackTraceKey, + disabled: false, + click: () => (0, _clipboard.copyToTheClipboard)(framesToCopy) + }; + + menuOptions.push(copyStackTrace); + + (0, _devtoolsLaunchpad.showMenu)(event, menuOptions); + } + + onMouseDown(e, frame, selectedFrame) { + if (e.nativeEvent.which == 3 && selectedFrame.id != frame.id) { + return; + } + this.props.selectFrame(frame); + } + + onKeyUp(event, frame, selectedFrame) { + if (event.key != "Enter" || selectedFrame.id == frame.id) { + return; + } + this.props.selectFrame(frame); + } + + render() { + var _props = this.props, + frame = _props.frame, + frames = _props.frames, + selectedFrame = _props.selectedFrame, + hideLocation = _props.hideLocation, + shouldMapDisplayName = _props.shouldMapDisplayName; + + + return _react.DOM.li({ + key: frame.id, + className: (0, _classnames2.default)("frame", { + selected: selectedFrame && selectedFrame.id === frame.id + }), + onMouseDown: e => this.onMouseDown(e, frame, selectedFrame), + onKeyUp: e => this.onKeyUp(e, frame, selectedFrame), + onContextMenu: e => this.onContextMenu(e, frame, frames), + tabIndex: 0 + }, renderFrameTitle(frame, { shouldMapDisplayName }), !hideLocation ? renderFrameLocation(frame) : null); + } + } + + exports.default = FrameComponent; + FrameComponent.propTypes = { + frame: _react.PropTypes.object.isRequired, + frames: _react.PropTypes.array, + selectedFrame: _react.PropTypes.object, + selectFrame: _react.PropTypes.func.isRequired, + hideLocation: _react.PropTypes.bool, + shouldMapDisplayName: _react.PropTypes.bool + }; + + FrameComponent.defaultProps = { + hideLocation: false, + shouldMapDisplayName: true + }; + + FrameComponent.displayName = "Frame"; + +/***/ }, +/* 1007 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getLibraryFromUrl = getLibraryFromUrl; + exports.annotateFrame = annotateFrame; + exports.simplifyDisplayName = simplifyDisplayName; + exports.formatDisplayName = formatDisplayName; + exports.formatCopyName = formatCopyName; + exports.collapseFrames = collapseFrames; + + var _devtoolsConfig = __webpack_require__(828); + + var _utils = __webpack_require__(234); + + var _source = __webpack_require__(233); + + var _findIndex = __webpack_require__(262); + + var _findIndex2 = _interopRequireDefault(_findIndex); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var get = __webpack_require__(67); + + + function getFrameUrl(frame) { + return get(frame, "source.url", "") || ""; + } + + function isBackbone(frame) { + return getFrameUrl(frame).match(/backbone/i); + } + + function isJQuery(frame) { + return getFrameUrl(frame).match(/jquery/i); + } + + function isReact(frame) { + return getFrameUrl(frame).match(/react/i); + } + + function isWebpack(frame) { + return getFrameUrl(frame).match(/webpack\/bootstrap/i); + } + + function getLibraryFromUrl(frame) { + if (isBackbone(frame)) { + return "Backbone"; + } + + if (isJQuery(frame)) { + return "jQuery"; + } + + if (isReact(frame)) { + return "React"; + } + + if (isWebpack(frame)) { + return "Webpack"; + } + } + + var displayNameMap = { + Backbone: { + "extend/child": "Create Class", + ".create": "Create Model" + }, + jQuery: { + "jQuery.event.dispatch": "Dispatch Event" + }, + React: { + // eslint-disable-next-line max-len + "ReactCompositeComponent._renderValidatedComponentWithoutOwnerOrContext/renderedElement<": "Render" + }, + Webpack: { + // eslint-disable-next-line camelcase + __webpack_require__: "Bootstrap" + } + }; + + function mapDisplayNames(frame, library) { + var map = displayNameMap[library]; + var displayName = frame.displayName; + + return map && map[displayName] || displayName; + } + + function annotateFrame(frame) { + if (!(0, _devtoolsConfig.isEnabled)("collapseFrame")) { + return frame; + } + + var library = getLibraryFromUrl(frame); + if (library) { + return Object.assign({}, frame, { library }); + } + + return frame; + } + // Decodes an anonymous naming scheme that // spider monkey implements based on "Naming Anonymous JavaScript Functions" // http://johnjbarton.github.io/nonymous/index.html @@ -71099,6 +47277,11 @@ return /******/ (function(modules) { // webpackBootstrap var annonymousProperty = /([\w\d]+)\(\^\)$/; function simplifyDisplayName(displayName) { + // if the display name has a space it has already been mapped + if (/\s/.exec(displayName)) { + return displayName; + } + var scenarios = [objectProperty, arrayProperty, functionProperty, annonymousProperty]; for (var reg of scenarios) { @@ -71111,6 +47294,201 @@ return /******/ (function(modules) { // webpackBootstrap return displayName; } + function formatDisplayName(frame) { + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$shouldMapDisplay = _ref.shouldMapDisplayName, + shouldMapDisplayName = _ref$shouldMapDisplay === undefined ? true : _ref$shouldMapDisplay; + + var displayName = frame.displayName, + library = frame.library; + + if (library && shouldMapDisplayName) { + displayName = mapDisplayNames(frame, library); + } + + displayName = simplifyDisplayName(displayName); + return (0, _utils.endTruncateStr)(displayName, 25); + } + + function formatCopyName(frame) { + var displayName = formatDisplayName(frame); + var fileName = (0, _source.getFilename)(frame.source); + var frameLocation = frame.location.line; + + return `${displayName} (${fileName}#${frameLocation})`; + } + + function collapseFrames(frames) { + // We collapse groups of one so that user frames + // are not in a group of one + function addGroupToList(group, list) { + if (!group) { + return list; + } + + if (group.length > 1) { + list.push(group); + } else { + list = list.concat(group); + } + + return list; + } + + var _collapseLastFrames = collapseLastFrames(frames), + newFrames = _collapseLastFrames.newFrames, + lastGroup = _collapseLastFrames.lastGroup; + + frames = newFrames; + var items = []; + var currentGroup = null; + var prevItem = null; + for (var frame of frames) { + var prevLibrary = get(prevItem, "library"); + + if (!currentGroup) { + currentGroup = [frame]; + } else if (prevLibrary && prevLibrary == frame.library) { + currentGroup.push(frame); + } else { + items = addGroupToList(currentGroup, items); + currentGroup = [frame]; + } + + prevItem = frame; + } + + items = addGroupToList(currentGroup, items); + items = addGroupToList(lastGroup, items); + return items; + } + + function collapseLastFrames(frames) { + var index = (0, _findIndex2.default)(frames, isWebpack); + + if (index == -1) { + return { newFrames: frames, lastGroup: [] }; + } + + var newFrames = frames.slice(0, index); + var lastGroup = frames.slice(index); + return { newFrames, lastGroup }; + } + +/***/ }, +/* 1008 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(2); + + var _classnames = __webpack_require__(175); + + var _classnames2 = _interopRequireDefault(_classnames); + + var _Svg = __webpack_require__(344); + + var _Svg2 = _interopRequireDefault(_Svg); + + var _frame = __webpack_require__(1007); + + __webpack_require__(1009); + + var _Frame = __webpack_require__(1006); + + var _Frame2 = _interopRequireDefault(_Frame); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var FrameComponent = (0, _react.createFactory)(_Frame2.default); + + function renderFrameLocation(frame) { + var library = (0, _frame.getLibraryFromUrl)(frame); + if (!library) { + return null; + } + + return _react.DOM.div({ className: "location" }, library, (0, _Svg2.default)(library.toLowerCase(), { className: "annotation-logo" })); + } + + class Group extends _react.Component { + + constructor() { + super(...arguments); + this.state = { expanded: false }; + var self = this; + + self.toggleFrames = this.toggleFrames.bind(this); + } + + toggleFrames() { + this.setState({ expanded: !this.state.expanded }); + } + + renderFrames() { + var _props = this.props, + group = _props.group, + selectFrame = _props.selectFrame, + selectedFrame = _props.selectedFrame; + var expanded = this.state.expanded; + + if (!expanded) { + return null; + } + return _react.DOM.div({ className: "frames-list" }, group.map(frame => FrameComponent({ + frame, + selectFrame, + selectedFrame, + key: frame.id, + hideLocation: true, + shouldMapDisplayName: false + }))); + } + + renderDescription() { + var frame = this.props.group[0]; + var displayName = (0, _frame.formatDisplayName)(frame); + return _react.DOM.li({ + key: frame.id, + className: (0, _classnames2.default)("group"), + onClick: this.toggleFrames, + tabIndex: 0 + }, _react.DOM.div({ className: "title" }, displayName), renderFrameLocation(frame)); + } + + render() { + var expanded = this.state.expanded; + + return _react.DOM.div({ className: (0, _classnames2.default)("frames-group", { expanded }) }, this.renderDescription(), this.renderFrames()); + } + } + + exports.default = Group; + Group.propTypes = { + group: _react.PropTypes.array.isRequired, + selectFrame: _react.PropTypes.func.isRequired, + selectedFrame: _react.PropTypes.object + }; + Group.displayName = "Group"; + +/***/ }, +/* 1009 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, +/* 1010 */, +/* 1011 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + /***/ } /******/ ]) }); diff --git a/devtools/client/debugger/new/index.html b/devtools/client/debugger/new/index.html index bec8bbd5ff10..b91308809651 100644 --- a/devtools/client/debugger/new/index.html +++ b/devtools/client/debugger/new/index.html @@ -17,7 +17,7 @@
- + +

Returns

+ + + + + + + + + +

Throws

+ + + + + + + + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html b/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html new file mode 100644 index 000000000000..dc3a28f8c8b1 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html @@ -0,0 +1,17 @@ + + + + + + + Debugger test page - Mutate object + + + + + + + + + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html b/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html index 14cc86701aca..68eccbd87023 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html @@ -6,16 +6,17 @@ Debugger test page - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/script-mutate.js b/devtools/client/debugger/new/test/mochitest/examples/script-mutate.js new file mode 100644 index 000000000000..c47a523d60e6 --- /dev/null +++ b/devtools/client/debugger/new/test/mochitest/examples/script-mutate.js @@ -0,0 +1,20 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +function mutate() { + const phonebook = { + S: { + sarah: { + lastName: "Doe" + }, + serena: { + lastName: "Williams" + } + } + }; + + debugger; + phonebook.S.sarah.lastName = "Pierce"; + debugger; + phonebook.S.sarah.timezone = "PST"; + debugger; +} diff --git a/devtools/client/debugger/new/test/mochitest/head.js b/devtools/client/debugger/new/test/mochitest/head.js index 7b551a2887d7..22548da4c738 100644 --- a/devtools/client/debugger/new/test/mochitest/head.js +++ b/devtools/client/debugger/new/test/mochitest/head.js @@ -38,7 +38,8 @@ Services.scriptloader.loadSubScript( this ); var { Toolbox } = require("devtools/client/framework/toolbox"); -const EXAMPLE_URL = "http://example.com/browser/devtools/client/debugger/new/test/mochitest/examples/"; +const EXAMPLE_URL = + "http://example.com/browser/devtools/client/debugger/new/test/mochitest/examples/"; Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", true); @@ -336,7 +337,7 @@ window.resumeTest = undefined; */ function pauseTest() { info("Test paused. Invoke resumeTest to continue."); - return new Promise(resolve => resumeTest = resolve); + return new Promise(resolve => (resumeTest = resolve)); } // Actions @@ -563,12 +564,12 @@ const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true }; // On Mac, going to beginning/end only works with meta+left/right. On // Windows, it only works with home/end. On Linux, apparently, either // ctrl+left/right or home/end work. -const endKey = isMac ? - { code: "VK_RIGHT", modifiers: cmdOrCtrl } : - { code: "VK_END" }; -const startKey = isMac ? - { code: "VK_LEFT", modifiers: cmdOrCtrl } : - { code: "VK_HOME" }; +const endKey = isMac + ? { code: "VK_RIGHT", modifiers: cmdOrCtrl } + : { code: "VK_END" }; +const startKey = isMac + ? { code: "VK_LEFT", modifiers: cmdOrCtrl } + : { code: "VK_HOME" }; const keyMappings = { sourceSearch: { code: "p", modifiers: cmdOrCtrl }, fileSearch: { code: "f", modifiers: cmdOrCtrl }, @@ -622,16 +623,14 @@ function isVisibleWithin(outerEl, innerEl) { const selectors = { callStackHeader: ".call-stack-pane ._header", callStackBody: ".call-stack-pane .pane", - expressionNode: i => - `.expressions-list .tree-node:nth-child(${i}) .object-label`, - expressionValue: i => - `.expressions-list .tree-node:nth-child(${i}) .object-value`, - expressionClose: i => - `.expressions-list .expression-container:nth-child(${i}) .close`, + expressionNode: i => `.expressions-list .tree-node:nth-child(${i}) .object-label`, + expressionValue: i => `.expressions-list .tree-node:nth-child(${i}) .object-value`, + expressionClose: i => `.expressions-list .expression-container:nth-child(${i}) .close`, expressionNodes: ".expressions-list .tree-node", scopesHeader: ".scopes-pane ._header", breakpointItem: i => `.breakpoints-list .breakpoint:nth-child(${i})`, scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`, + scopeValue: i => `.scopes-list .tree-node:nth-child(${i}) .object-value`, frame: i => `.frames ul li:nth-child(${i})`, frames: ".frames ul li", gutter: i => `.CodeMirror-code *:nth-child(${i}) .CodeMirror-linenumber`, diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js index 24edb78d1d8e..1320653e34b9 100644 --- a/devtools/client/framework/toolbox.js +++ b/devtools/client/framework/toolbox.js @@ -2408,14 +2408,17 @@ Toolbox.prototype = { .then(() => { this._removeHostListeners(); - // `location` may already be null if the toolbox document is already - // in process of destruction. Otherwise if it is still around, ensure - // releasing toolbox document and triggering cleanup thanks to unload - // event. We do that precisely here, before nullifying the target as - // various cleanup code depends on the target attribute to be still + // `location` may already be 'invalid' if the toolbox document is + // already in process of destruction. Otherwise if it is still + // around, ensure releasing toolbox document and triggering cleanup + // thanks to unload event. We do that precisely here, before + // nullifying the target as various cleanup code depends on the + // target attribute to be still // defined. - if (win.location) { + try { win.location.replace("about:blank"); + } catch (e) { + // Do nothing; } // Targets need to be notified that the toolbox is being torn down. diff --git a/devtools/client/locales/en-US/debugger.properties b/devtools/client/locales/en-US/debugger.properties index 2c579a0addb8..ef515810a2b8 100644 --- a/devtools/client/locales/en-US/debugger.properties +++ b/devtools/client/locales/en-US/debugger.properties @@ -22,6 +22,14 @@ copySourceUrl=Copy Source Url # the context menu. copySourceUrl.accesskey=u +# LOCALIZATION NOTE (copyStackTrace): This is the text that appears in the +# context menu to copy the stack trace methods, file names and row number. +copyStackTrace=Copy Stack Trace + +# LOCALIZATION NOTE (copyStackTrace.accesskey): Access key to copy the stack trace data from +# the context menu. +copyStackTrace.accesskey=c + # LOCALIZATION NOTE (expandPanes): This is the tooltip for the button # that expands the left and right panes in the debugger UI. expandPanes=Expand panes @@ -128,10 +136,6 @@ sources.search.key=P # does not have any sources. sources.noSourcesAvailable=This page has no sources -# LOCALIZATION NOTE (sources.searchAlt.key): Alternate key shortcut to open -# the search for searching all the source files the debugger has seen. -sources.searchAlt.key=O - # LOCALIZATION NOTE (sourceSearch.search.key): Key shortcut to open the search # for searching within a the currently opened files in the editor sourceSearch.search.key=F @@ -246,6 +250,14 @@ editor.singleResult=1 result # for when no results found. editor.noResults=no results +# LOCALIZATION NOTE (editor.searchResults.nextResult): Editor Search bar +# tooltip for traversing to the Next Result +editor.searchResults.nextResult=Next Result + +# LOCALIZATION NOTE (editor.searchResults.prevResult): Editor Search bar +# tooltip for traversing to the Previous Result +editor.searchResults.prevResult=Previous Result + # LOCALIZATION NOTE (editor.searchTypeToggleTitle): Search bar title for # toggling search type buttons(function search, variable search) editor.searchTypeToggleTitle=Search for: diff --git a/dom/base/ImportManager.cpp b/dom/base/ImportManager.cpp index d0e514b59161..1f4d376b37b5 100644 --- a/dom/base/ImportManager.cpp +++ b/dom/base/ImportManager.cpp @@ -6,6 +6,7 @@ #include "ImportManager.h" +#include "mozilla/dom/ScriptLoader.h" #include "mozilla/EventListenerManager.h" #include "HTMLLinkElement.h" #include "nsContentPolicyUtils.h" @@ -18,7 +19,6 @@ #include "nsIDOMEvent.h" #include "nsIPrincipal.h" #include "nsIScriptObjectPrincipal.h" -#include "nsScriptLoader.h" #include "nsNetUtil.h" //----------------------------------------------------------------------------- @@ -156,7 +156,7 @@ ImportLoader::Updater::UpdateMainReferrer(uint32_t aNewIdx) // Our nearest predecessor has changed. So let's add the ScriptLoader to the // new one if there is any. And remove it from the old one. RefPtr manager = mLoader->Manager(); - nsScriptLoader* loader = mLoader->mDocument->ScriptLoader(); + ScriptLoader* loader = mLoader->mDocument->ScriptLoader(); ImportLoader*& pred = mLoader->mBlockingPredecessor; ImportLoader* newPred = manager->GetNearestPredecessor(newMainReferrer); if (pred) { @@ -339,7 +339,7 @@ ImportLoader::DispatchEventIfFinished(nsINode* aNode) } void -ImportLoader::AddBlockedScriptLoader(nsScriptLoader* aScriptLoader) +ImportLoader::AddBlockedScriptLoader(ScriptLoader* aScriptLoader) { if (mBlockedScriptLoaders.Contains(aScriptLoader)) { return; @@ -352,7 +352,7 @@ ImportLoader::AddBlockedScriptLoader(nsScriptLoader* aScriptLoader) } bool -ImportLoader::RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader) +ImportLoader::RemoveBlockedScriptLoader(ScriptLoader* aScriptLoader) { aScriptLoader->RemoveParserBlockingScriptExecutionBlocker(); return mBlockedScriptLoaders.RemoveElement(aScriptLoader); diff --git a/dom/base/ImportManager.h b/dom/base/ImportManager.h index 258d4691cf7f..ccc00125ae58 100644 --- a/dom/base/ImportManager.h +++ b/dom/base/ImportManager.h @@ -45,8 +45,8 @@ #include "nsIStreamListener.h" #include "nsIWeakReferenceUtils.h" #include "nsRefPtrHashtable.h" -#include "nsScriptLoader.h" #include "nsURIHashKey.h" +#include "mozilla/dom/ScriptLoader.h" class nsIDocument; class nsIPrincipal; @@ -184,8 +184,8 @@ public: // and wait for that to run its scripts. We keep track of all the // ScriptRunners that are waiting for this import. NOTE: updating // the main referrer might change this list. - void AddBlockedScriptLoader(nsScriptLoader* aScriptLoader); - bool RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader); + void AddBlockedScriptLoader(ScriptLoader* aScriptLoader); + bool RemoveBlockedScriptLoader(ScriptLoader* aScriptLoader); void SetBlockingPredecessor(ImportLoader* aLoader); private: @@ -230,7 +230,7 @@ private: // List of pending ScriptLoaders that are waiting for this import // to finish. - nsTArray> mBlockedScriptLoaders; + nsTArray> mBlockedScriptLoaders; // There is always exactly one referrer link that is flagged as // the main referrer the primary link. This is the one that is diff --git a/dom/base/Location.cpp b/dom/base/Location.cpp index 6a269fe631e4..d21199596bcb 100644 --- a/dom/base/Location.cpp +++ b/dom/base/Location.cpp @@ -32,9 +32,9 @@ #include "mozilla/Likely.h" #include "nsCycleCollectionParticipant.h" #include "NullPrincipal.h" -#include "ScriptSettings.h" #include "mozilla/Unused.h" #include "mozilla/dom/LocationBinding.h" +#include "mozilla/dom/ScriptSettings.h" namespace mozilla { namespace dom { @@ -87,19 +87,6 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Location) NS_IMPL_CYCLE_COLLECTING_ADDREF(Location) NS_IMPL_CYCLE_COLLECTING_RELEASE(Location) -void -Location::SetDocShell(nsIDocShell *aDocShell) -{ - mDocShell = do_GetWeakReference(aDocShell); -} - -nsIDocShell * -Location::GetDocShell() -{ - nsCOMPtr docshell(do_QueryReferent(mDocShell)); - return docshell; -} - nsresult Location::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo) { @@ -210,8 +197,12 @@ Location::GetURI(nsIURI** aURI, bool aGetInnermostURI) { *aURI = nullptr; - nsresult rv; nsCOMPtr docShell(do_QueryReferent(mDocShell)); + if (!mDocShell) { + return NS_OK; + } + + nsresult rv; nsCOMPtr webNav(do_QueryInterface(docShell, &rv)); if (NS_FAILED(rv)) { return rv; @@ -896,9 +887,10 @@ Location::GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL) // this happens, try falling back on the current document associated with the // docshell. If that fails, just return null and hope that the caller passed // an absolute URI. - if (!doc && GetDocShell()) { + nsCOMPtr docShell(do_QueryReferent(mDocShell)); + if (!doc && docShell) { nsCOMPtr docShellWin = - do_QueryInterface(GetDocShell()->GetScriptGlobalObject()); + do_QueryInterface(docShell->GetScriptGlobalObject()); if (docShellWin) { doc = docShellWin->GetDoc(); } diff --git a/dom/base/Location.h b/dom/base/Location.h index cc96ce55808d..5924cc5f3e00 100644 --- a/dom/base/Location.h +++ b/dom/base/Location.h @@ -37,9 +37,6 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Location, nsIDOMLocation) - void SetDocShell(nsIDocShell *aDocShell); - nsIDocShell *GetDocShell(); - // nsIDOMLocation NS_DECL_NSIDOMLOCATION @@ -233,7 +230,11 @@ protected: // In the case of jar: uris, we sometimes want the place the jar was // fetched from as the URI instead of the jar: uri itself. Pass in // true for aGetInnermostURI when that's the case. + // Note, this method can return NS_OK with a null value for aURL. This happens + // if the docShell is null. nsresult GetURI(nsIURI** aURL, bool aGetInnermostURI = false); + // Note, this method can return NS_OK with a null value for aURL. This happens + // if the docShell is null. nsresult GetWritableURI(nsIURI** aURL, // If not null, give it the new ref const nsACString* aNewRef = nullptr); diff --git a/dom/base/moz.build b/dom/base/moz.build index cc41636b3fbe..4b4f0063f49d 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -27,7 +27,6 @@ XPIDL_SOURCES += [ 'nsIObjectLoadingContent.idl', 'nsIRemoteWindowContext.idl', 'nsIScriptChannel.idl', - 'nsIScriptLoaderObserver.idl', 'nsISelection.idl', 'nsISelectionController.idl', 'nsISelectionDisplay.idl', @@ -92,7 +91,6 @@ EXPORTS += [ 'nsINode.h', 'nsINodeList.h', 'nsIScriptContext.h', - 'nsIScriptElement.h', 'nsIScriptGlobalObject.h', 'nsIScriptNameSpaceManager.h', 'nsIScriptObjectPrincipal.h', @@ -113,7 +111,6 @@ EXPORTS += [ 'nsRange.h', 'nsReferencedElement.h', 'nsSandboxFlags.h', - 'nsScriptLoader.h', 'nsStructuredCloneContainer.h', 'nsStubAnimationObserver.h', 'nsStubDocumentObserver.h', @@ -198,7 +195,6 @@ EXPORTS.mozilla.dom += [ 'ResponsiveImageSelector.h', 'SameProcessMessageQueue.h', 'ScreenOrientation.h', - 'ScriptSettings.h', 'ShadowRoot.h', 'StructuredCloneHolder.h', 'StructuredCloneTags.h', @@ -315,8 +311,6 @@ UNIFIED_SOURCES += [ 'nsRange.cpp', 'nsReferencedElement.cpp', 'nsScreen.cpp', - 'nsScriptElement.cpp', - 'nsScriptLoader.cpp', 'nsScriptNameSpaceManager.cpp', 'nsStructuredCloneContainer.cpp', 'nsStubAnimationObserver.cpp', @@ -343,7 +337,6 @@ UNIFIED_SOURCES += [ 'ResponsiveImageSelector.cpp', 'SameProcessMessageQueue.cpp', 'ScreenOrientation.cpp', - 'ScriptSettings.cpp', 'ShadowRoot.cpp', 'StructuredCloneHolder.cpp', 'StyleSheetList.cpp', diff --git a/dom/base/nsCCUncollectableMarker.cpp b/dom/base/nsCCUncollectableMarker.cpp index be7611f9beeb..8e54b38c1fd0 100644 --- a/dom/base/nsCCUncollectableMarker.cpp +++ b/dom/base/nsCCUncollectableMarker.cpp @@ -29,6 +29,7 @@ #include "nsInProcessTabChildGlobal.h" #include "nsFrameLoader.h" #include "mozilla/CycleCollectedJSContext.h" +#include "mozilla/CycleCollectedJSRuntime.h" #include "mozilla/EventListenerManager.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/ProcessGlobal.h" diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp index 49b58aebed10..535262a3f437 100644 --- a/dom/base/nsContentPermissionHelper.cpp +++ b/dom/base/nsContentPermissionHelper.cpp @@ -32,7 +32,6 @@ #include "nsIDocument.h" #include "nsIDOMEvent.h" #include "nsWeakPtr.h" -#include "ScriptSettings.h" using mozilla::Unused; // using namespace mozilla::dom; diff --git a/dom/base/nsContentPolicy.cpp b/dom/base/nsContentPolicy.cpp index 98a92c6dec92..cf0da32bab18 100644 --- a/dom/base/nsContentPolicy.cpp +++ b/dom/base/nsContentPolicy.cpp @@ -125,8 +125,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod, * their permissions. */ nsresult rv; - nsCOMArray entries; - mPolicies.GetEntries(entries); + const nsCOMArray& entries = mPolicies.GetCachedEntries(); nsCOMPtr window; if (nsCOMPtr node = do_QueryInterface(requestingContext)) { @@ -187,8 +186,8 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod, } } - nsCOMArray simpleEntries; - mSimplePolicies.GetEntries(simpleEntries); + const nsCOMArray& simpleEntries = + mSimplePolicies.GetCachedEntries(); count = simpleEntries.Count(); for (int32_t i = 0; i < count; i++) { /* check the appropriate policy */ diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index 762b49ab8883..0c94aec06920 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -10,7 +10,6 @@ */ #include "nsContentSink.h" -#include "nsScriptLoader.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" #include "mozilla/css/Loader.h" @@ -49,6 +48,7 @@ #include "nsHTMLDNSPrefetch.h" #include "nsIObserverService.h" #include "mozilla/Preferences.h" +#include "mozilla/dom/ScriptLoader.h" #include "nsParserConstants.h" #include "nsSandboxFlags.h" diff --git a/dom/base/nsContentSink.h b/dom/base/nsContentSink.h index af211ae462a2..ae5c5e92eab7 100644 --- a/dom/base/nsContentSink.h +++ b/dom/base/nsContentSink.h @@ -36,13 +36,16 @@ class nsIAtom; class nsIChannel; class nsIContent; class nsNodeInfoManager; -class nsScriptLoader; class nsIApplicationCache; namespace mozilla { namespace css { class Loader; } // namespace css + +namespace dom { +class ScriptLoader; +} // namespace dom } // namespace mozilla #ifdef DEBUG @@ -276,7 +279,7 @@ protected: nsCOMPtr mDocShell; RefPtr mCSSLoader; RefPtr mNodeInfoManager; - RefPtr mScriptLoader; + RefPtr mScriptLoader; // back off timer notification after count int32_t mBackoffCount; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 7068149e2f48..dbbf749e3f4a 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -2026,7 +2026,7 @@ nsDocument::Init() mScopeObject = do_GetWeakReference(global); MOZ_ASSERT(mScopeObject); - mScriptLoader = new nsScriptLoader(this); + mScriptLoader = new dom::ScriptLoader(this); mozilla::HoldJSObjects(this); @@ -5011,7 +5011,7 @@ nsDocument::GetWindowInternal() const return win; } -nsScriptLoader* +ScriptLoader* nsDocument::ScriptLoader() { return mScriptLoader; @@ -6877,9 +6877,7 @@ nsIDocument::GetLocation() const } nsGlobalWindow* window = nsGlobalWindow::Cast(w); - ErrorResult dummy; - RefPtr loc = window->GetLocation(dummy); - dummy.SuppressException(); + RefPtr loc = window->Location(); return loc.forget(); } diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index c3efcef6f1a4..8a1663e4c78b 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -31,7 +31,6 @@ #include "nsJSThingHashtable.h" #include "nsIScriptObjectPrincipal.h" #include "nsIURI.h" -#include "nsScriptLoader.h" #include "nsIRadioGroupContainer.h" #include "nsILayoutHistoryState.h" #include "nsIRequest.h" @@ -60,6 +59,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/PendingAnimationTracker.h" #include "mozilla/dom/DOMImplementation.h" +#include "mozilla/dom/ScriptLoader.h" #include "mozilla/dom/StyleSheetList.h" #include "nsDataHashtable.h" #include "mozilla/TimeStamp.h" @@ -742,7 +742,7 @@ public: /** * Get the script loader for this document */ - virtual nsScriptLoader* ScriptLoader() override; + virtual mozilla::dom::ScriptLoader* ScriptLoader() override; /** * Add/Remove an element to the document's id and name hashes @@ -1492,7 +1492,7 @@ public: RefPtr mListenerManager; RefPtr mDOMStyleSheets; RefPtr mStyleSheetSetList; - RefPtr mScriptLoader; + RefPtr mScriptLoader; nsDocHeaderData* mHeaderData; /* mIdentifierMap works as follows for IDs: * 1) Attribute changes affect the table immediately (removing and adding diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index ae3c54f3f322..1854e5c1b937 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -18,7 +18,7 @@ #include "nsJSUtils.h" #include "nsJSPrincipals.h" #include "nsNetUtil.h" -#include "nsScriptLoader.h" +#include "mozilla/dom/ScriptLoader.h" #include "nsFrameLoader.h" #include "nsIInputStream.h" #include "nsIXULRuntime.h" @@ -256,17 +256,13 @@ nsFrameMessageManager::AddMessageListener(const nsAString& aMessage, nsIMessageListener* aListener, bool aListenWhenClosed) { - nsAutoTObserverArray* listeners = - mListeners.Get(aMessage); - if (!listeners) { - listeners = new nsAutoTObserverArray(); - mListeners.Put(aMessage, listeners); - } else { - uint32_t len = listeners->Length(); - for (uint32_t i = 0; i < len; ++i) { - if (listeners->ElementAt(i).mStrongListener == aListener) { - return NS_OK; - } + auto listeners = mListeners.LookupForAdd(aMessage).OrInsert([]() { + return new nsAutoTObserverArray(); + }); + uint32_t len = listeners->Length(); + for (uint32_t i = 0; i < len; ++i) { + if (listeners->ElementAt(i).mStrongListener == aListener) { + return NS_OK; } } @@ -323,17 +319,13 @@ nsFrameMessageManager::AddWeakMessageListener(const nsAString& aMessage, } #endif - nsAutoTObserverArray* listeners = - mListeners.Get(aMessage); - if (!listeners) { - listeners = new nsAutoTObserverArray(); - mListeners.Put(aMessage, listeners); - } else { - uint32_t len = listeners->Length(); - for (uint32_t i = 0; i < len; ++i) { - if (listeners->ElementAt(i).mWeakListener == weak) { - return NS_OK; - } + auto listeners = mListeners.LookupForAdd(aMessage).OrInsert([]() { + return new nsAutoTObserverArray(); + }); + uint32_t len = listeners->Length(); + for (uint32_t i = 0; i < len; ++i) { + if (listeners->ElementAt(i).mWeakListener == weak) { + return NS_OK; } } @@ -1640,9 +1632,9 @@ nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript( if (NS_FAILED(NS_ReadInputStreamToString(input, buffer, avail))) { return; } - nsScriptLoader::ConvertToUTF16(channel, (uint8_t*)buffer.get(), avail, - EmptyString(), nullptr, - dataStringBuf, dataStringLength); + ScriptLoader::ConvertToUTF16(channel, (uint8_t*)buffer.get(), avail, + EmptyString(), nullptr, + dataStringBuf, dataStringLength); } JS::SourceBufferHolder srcBuf(dataStringBuf, dataStringLength, diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index d9fc5f615495..ed163644f547 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -64,7 +64,7 @@ #include "nsReadableUtils.h" #include "nsDOMClassInfo.h" #include "nsJSEnvironment.h" -#include "ScriptSettings.h" +#include "mozilla/dom/ScriptSettings.h" #include "mozilla/Preferences.h" #include "mozilla/Likely.h" #include "mozilla/Sprintf.h" @@ -1933,7 +1933,6 @@ nsGlobalWindow::CleanUp() mPersonalbar = nullptr; mStatusbar = nullptr; mScrollbars = nullptr; - mLocation = nullptr; mHistory = nullptr; mCustomElements = nullptr; mFrames = nullptr; @@ -2096,7 +2095,6 @@ nsGlobalWindow::FreeInnerObjects() mListenerManager = nullptr; } - mLocation = nullptr; mHistory = nullptr; mCustomElements = nullptr; @@ -10440,28 +10438,17 @@ nsGlobalWindow::GetPrivateRoot() } Location* -nsGlobalWindow::GetLocation(ErrorResult& aError) +nsGlobalWindow::Location() { MOZ_RELEASE_ASSERT(IsInnerWindow()); - nsIDocShell *docShell = GetDocShell(); - if (!mLocation && docShell) { - mLocation = new Location(AsInner(), docShell); + if (!mLocation) { + mLocation = new dom::Location(AsInner(), GetDocShell()); } + return mLocation; } -nsIDOMLocation* -nsGlobalWindow::GetLocation() -{ - FORWARD_TO_INNER(GetLocation, (), nullptr); - - ErrorResult dummy; - nsIDOMLocation* location = GetLocation(dummy); - dummy.SuppressException(); - return location; -} - void nsGlobalWindow::ActivateOrDeactivate(bool aActivate) { diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index a2886a173d1c..8601041d3749 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -855,8 +855,7 @@ public: void GetName(nsAString& aName, mozilla::ErrorResult& aError); void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError); void SetName(const nsAString& aName, mozilla::ErrorResult& aError); - mozilla::dom::Location* GetLocation(mozilla::ErrorResult& aError); - nsIDOMLocation* GetLocation() override; + mozilla::dom::Location* Location() override; nsHistory* GetHistory(mozilla::ErrorResult& aError); mozilla::dom::CustomElementRegistry* CustomElements() override; mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError); diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 5b4955952fd2..930943082cbe 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -92,7 +92,6 @@ class nsIVariant; class nsViewManager; class nsPresContext; class nsRange; -class nsScriptLoader; class nsSMILAnimationController; class nsSVGElement; class nsTextNode; @@ -154,6 +153,7 @@ class NodeIterator; enum class OrientationType : uint8_t; class ProcessingInstruction; class Promise; +class ScriptLoader; class StyleSheetList; class SVGDocument; class SVGSVGElement; @@ -1368,7 +1368,7 @@ public: /** * Get the script loader for this document */ - virtual nsScriptLoader* ScriptLoader() = 0; + virtual mozilla::dom::ScriptLoader* ScriptLoader() = 0; /** * Add/Remove an element to the document's id and name hashes diff --git a/dom/base/nsInProcessTabChildGlobal.cpp b/dom/base/nsInProcessTabChildGlobal.cpp index ca2f4be6f9cd..302e6eaef1fd 100644 --- a/dom/base/nsInProcessTabChildGlobal.cpp +++ b/dom/base/nsInProcessTabChildGlobal.cpp @@ -11,13 +11,13 @@ #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "nsComponentManagerUtils.h" -#include "nsScriptLoader.h" #include "nsFrameLoader.h" #include "xpcpublic.h" #include "nsIMozBrowserFrame.h" #include "nsDOMClassInfoID.h" #include "mozilla/EventDispatcher.h" #include "mozilla/dom/SameProcessMessageQueue.h" +#include "mozilla/dom/ScriptLoader.h" using namespace mozilla; using namespace mozilla::dom; diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 8946d75a9833..606f76859314 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -37,7 +37,6 @@ #include "nsXPCOMCIDInternal.h" #include "nsIXULRuntime.h" #include "nsTextFormatter.h" -#include "ScriptSettings.h" #ifdef XP_WIN #include #define getpid _getpid @@ -60,6 +59,7 @@ #include "mozilla/dom/DOMException.h" #include "mozilla/dom/DOMExceptionBinding.h" #include "mozilla/dom/ErrorEvent.h" +#include "mozilla/dom/ScriptSettings.h" #include "nsAXPCNativeCallContext.h" #include "mozilla/CycleCollectedJSRuntime.h" #include "mozilla/SystemGroup.h" diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index 5518a9270301..2ba183470243 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -91,6 +91,9 @@ enum class FullscreenReason namespace mozilla { namespace dom { + +class Location; + // The states in this enum represent the different possible outcomes which the // window could be experiencing of loading a document with the // Large-Allocation header. The NONE case represents the case where no @@ -570,7 +573,7 @@ public: virtual nsIDOMScreen* GetScreen() = 0; virtual nsIDOMNavigator* GetNavigator() = 0; - virtual nsIDOMLocation* GetLocation() = 0; + virtual mozilla::dom::Location* Location() = 0; virtual nsresult GetPrompter(nsIPrompt** aPrompt) = 0; virtual nsresult GetControllers(nsIControllers** aControllers) = 0; virtual already_AddRefed GetSelection() = 0; diff --git a/dom/base/nsPlainTextSerializer.h b/dom/base/nsPlainTextSerializer.h index 8cad03b6f7f0..26cced0cedce 100644 --- a/dom/base/nsPlainTextSerializer.h +++ b/dom/base/nsPlainTextSerializer.h @@ -16,6 +16,7 @@ #include "mozilla/Attributes.h" #include "nsCOMPtr.h" #include "nsIAtom.h" +#include "nsCycleCollectionParticipant.h" #include "nsIContentSerializer.h" #include "nsIDocumentEncoder.h" #include "nsILineBreaker.h" diff --git a/dom/base/test/test_script_loader_js_cache.html b/dom/base/test/test_script_loader_js_cache.html index 8ca2012f3943..e3f881109dbb 100644 --- a/dom/base/test/test_script_loader_js_cache.html +++ b/dom/base/test/test_script_loader_js_cache.html @@ -2,7 +2,7 @@