diff --git a/browser/config/mozconfigs/linux64/beta b/browser/config/mozconfigs/linux64/beta
index 29ceee4f49536..a523db851dc46 100644
--- a/browser/config/mozconfigs/linux64/beta
+++ b/browser/config/mozconfigs/linux64/beta
@@ -1,4 +1,4 @@
-export MOZ_PGO=1
+. "$topsrcdir/build/mozconfig.pgo"
. "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
diff --git a/browser/config/mozconfigs/linux64/release b/browser/config/mozconfigs/linux64/release
index bf2af71d3a307..a7a075950161d 100644
--- a/browser/config/mozconfigs/linux64/release
+++ b/browser/config/mozconfigs/linux64/release
@@ -1,7 +1,7 @@
# This make file should be identical to the beta mozconfig, apart from the
# safeguard below
-export MOZ_PGO=1
+. "$topsrcdir/build/mozconfig.pgo"
. "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
diff --git a/browser/config/mozconfigs/whitelist b/browser/config/mozconfigs/whitelist
index d6659f89b5737..d66055cd23705 100644
--- a/browser/config/mozconfigs/whitelist
+++ b/browser/config/mozconfigs/whitelist
@@ -42,7 +42,7 @@ whitelist['release']['linux32'] += [
whitelist['release']['linux64'] += [
'export MOZILLA_OFFICIAL=1',
'export MOZ_TELEMETRY_REPORTING=1',
- 'export MOZ_PGO=1',
+ '. "$topsrcdir/build/mozconfig.pgo"',
]
if __name__ == '__main__':
diff --git a/browser/config/mozconfigs/win32/common-opt b/browser/config/mozconfigs/win32/common-opt
index cec7b0b6e75a5..9aa2658aea469 100644
--- a/browser/config/mozconfigs/win32/common-opt
+++ b/browser/config/mozconfigs/win32/common-opt
@@ -5,7 +5,6 @@
. "$topsrcdir/browser/config/mozconfigs/common"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
-ac_add_options --enable-jemalloc
if [ -f /c/builds/gapi.data ]; then
_gapi_keyfile=c:/builds/gapi.data
diff --git a/browser/config/mozconfigs/win64-aarch64/common-opt b/browser/config/mozconfigs/win64-aarch64/common-opt
index 29484fa32b252..551458d6bff4e 100644
--- a/browser/config/mozconfigs/win64-aarch64/common-opt
+++ b/browser/config/mozconfigs/win64-aarch64/common-opt
@@ -5,7 +5,7 @@
. "$topsrcdir/browser/config/mozconfigs/common"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
-ac_add_options --enable-jemalloc
+
if [ -f /c/builds/gapi.data ]; then
_gapi_keyfile=c:/builds/gapi.data
else
diff --git a/browser/config/mozconfigs/win64/common-opt b/browser/config/mozconfigs/win64/common-opt
index 4cd860705eda0..5129a713b4f9e 100644
--- a/browser/config/mozconfigs/win64/common-opt
+++ b/browser/config/mozconfigs/win64/common-opt
@@ -5,7 +5,7 @@
. "$topsrcdir/browser/config/mozconfigs/common"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
-ac_add_options --enable-jemalloc
+
if [ -f /c/builds/gapi.data ]; then
_gapi_keyfile=c:/builds/gapi.data
else
diff --git a/browser/extensions/pdfjs/README.mozilla b/browser/extensions/pdfjs/README.mozilla
index 0ce1b62951eef..f652fff1474c8 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: 2.1.266
+Current extension version is: 2.2.15
-Taken from upstream commit: 81f5835c
+Taken from upstream commit: ece6a31a
diff --git a/browser/extensions/pdfjs/content/PdfJsDefaultPreferences.jsm b/browser/extensions/pdfjs/content/PdfJsDefaultPreferences.jsm
index 65439871d34c2..8b83a7b506b86 100644
--- a/browser/extensions/pdfjs/content/PdfJsDefaultPreferences.jsm
+++ b/browser/extensions/pdfjs/content/PdfJsDefaultPreferences.jsm
@@ -22,25 +22,25 @@
"use strict";
var EXPORTED_SYMBOLS = ["PdfJsDefaultPreferences"];
var PdfJsDefaultPreferences = Object.freeze({
- "viewOnLoad": 0,
- "defaultZoomValue": "",
- "sidebarViewOnLoad": -1,
"cursorToolOnLoad": 0,
+ "defaultZoomValue": "",
+ "disablePageLabels": false,
+ "enablePrintAutoRotate": false,
"enableWebGL": false,
"eventBusDispatchToDOM": false,
- "pdfBugEnabled": false,
- "disableRange": false,
- "disableStream": false,
- "disableAutoFetch": false,
- "disableFontFace": false,
- "textLayerMode": 1,
- "useOnlyCssZoom": false,
"externalLinkTarget": 0,
+ "historyUpdateUrl": false,
+ "pdfBugEnabled": false,
"renderer": "canvas",
"renderInteractiveForms": false,
- "enablePrintAutoRotate": false,
- "disablePageLabels": false,
- "historyUpdateUrl": false,
+ "sidebarViewOnLoad": -1,
"scrollModeOnLoad": -1,
- "spreadModeOnLoad": -1
+ "spreadModeOnLoad": -1,
+ "textLayerMode": 1,
+ "useOnlyCssZoom": false,
+ "viewOnLoad": 0,
+ "disableAutoFetch": false,
+ "disableFontFace": false,
+ "disableRange": false,
+ "disableStream": false
});
diff --git a/browser/extensions/pdfjs/content/build/pdf.js b/browser/extensions/pdfjs/content/build/pdf.js
index 24b6b7d7a965c..c9b2748e1a7a1 100644
--- a/browser/extensions/pdfjs/content/build/pdf.js
+++ b/browser/extensions/pdfjs/content/build/pdf.js
@@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
-var pdfjsVersion = '2.1.266';
-var pdfjsBuild = '81f5835c';
+var pdfjsVersion = '2.2.15';
+var pdfjsBuild = 'ece6a31a';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@@ -1411,7 +1411,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
- apiVersion: '2.1.266',
+ apiVersion: '2.2.15',
source: {
data: source.data,
url: source.url,
@@ -3148,9 +3148,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
-const version = '2.1.266';
+const version = '2.2.15';
exports.version = version;
-const build = '81f5835c';
+const build = 'ece6a31a';
exports.build = build;
/***/ }),
diff --git a/browser/extensions/pdfjs/content/build/pdf.worker.js b/browser/extensions/pdfjs/content/build/pdf.worker.js
index 2692d980e9bd0..82e90ff8436a3 100644
--- a/browser/extensions/pdfjs/content/build/pdf.worker.js
+++ b/browser/extensions/pdfjs/content/build/pdf.worker.js
@@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
-const pdfjsVersion = '2.1.266';
-const pdfjsBuild = '81f5835c';
+const pdfjsVersion = '2.2.15';
+const pdfjsBuild = 'ece6a31a';
const pdfjsCoreWorker = __w_pdfjs_require__(1);
@@ -375,7 +375,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
let apiVersion = docParams.apiVersion;
- let workerVersion = '2.1.266';
+ let workerVersion = '2.2.15';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@@ -3007,7 +3007,7 @@ class PDFDocument {
this.xfa = this.acroForm.get('XFA');
const fields = this.acroForm.get('Fields');
- if ((!fields || !Array.isArray(fields) || fields.length === 0) && !this.xfa) {
+ if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {
this.acroForm = null;
}
}
@@ -3019,6 +3019,20 @@ class PDFDocument {
(0, _util.info)('Cannot fetch AcroForm entry; assuming no AcroForms are present');
this.acroForm = null;
}
+
+ try {
+ const collection = this.catalog.catDict.get('Collection');
+
+ if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) {
+ this.collection = collection;
+ }
+ } catch (ex) {
+ if (ex instanceof _util.MissingDataException) {
+ throw ex;
+ }
+
+ (0, _util.info)('Cannot fetch Collection dictionary.');
+ }
}
get linearization() {
@@ -3147,7 +3161,8 @@ class PDFDocument {
PDFFormatVersion: this.pdfFormatVersion,
IsLinearized: !!this.linearization,
IsAcroFormPresent: !!this.acroForm,
- IsXFAPresent: !!this.xfa
+ IsXFAPresent: !!this.xfa,
+ IsCollectionPresent: !!this.collection
};
let infoDict;
diff --git a/browser/extensions/pdfjs/content/web/viewer.js b/browser/extensions/pdfjs/content/web/viewer.js
index f5af53ad4aa84..c008414998c5b 100644
--- a/browser/extensions/pdfjs/content/web/viewer.js
+++ b/browser/extensions/pdfjs/content/web/viewer.js
@@ -117,7 +117,7 @@
let pdfjsWebApp, pdfjsWebAppOptions;
{
pdfjsWebApp = __webpack_require__(1);
- pdfjsWebAppOptions = __webpack_require__(8);
+ pdfjsWebAppOptions = __webpack_require__(3);
}
{
__webpack_require__(33);
@@ -278,15 +278,15 @@ exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFVi
var _ui_utils = __webpack_require__(2);
-var _pdfjsLib = __webpack_require__(3);
+var _app_options = __webpack_require__(3);
-var _pdf_cursor_tools = __webpack_require__(4);
+var _pdfjsLib = __webpack_require__(4);
-var _pdf_rendering_queue = __webpack_require__(6);
+var _pdf_cursor_tools = __webpack_require__(6);
-var _pdf_sidebar = __webpack_require__(7);
+var _pdf_rendering_queue = __webpack_require__(8);
-var _app_options = __webpack_require__(8);
+var _pdf_sidebar = __webpack_require__(9);
var _overlay_manager = __webpack_require__(10);
@@ -808,7 +808,7 @@ let PDFViewerApplication = {
await this.close();
}
- const workerParameters = _app_options.AppOptions.getAll('worker');
+ const workerParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER);
for (let key in workerParameters) {
_pdfjsLib.GlobalWorkerOptions[key] = workerParameters[key];
@@ -828,7 +828,7 @@ let PDFViewerApplication = {
parameters.docBaseUrl = this.baseUrl;
- const apiParameters = _app_options.AppOptions.getAll('api');
+ const apiParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.API);
for (let key in apiParameters) {
parameters[key] = apiParameters[key];
@@ -3103,6 +3103,237 @@ function moveToEndOfArray(arr, condition) {
"use strict";
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.OptionKind = exports.AppOptions = void 0;
+
+var _pdfjsLib = __webpack_require__(4);
+
+var _viewer_compatibility = __webpack_require__(5);
+
+const OptionKind = {
+ VIEWER: 0x02,
+ API: 0x04,
+ WORKER: 0x08,
+ PREFERENCE: 0x80
+};
+exports.OptionKind = OptionKind;
+const defaultOptions = {
+ cursorToolOnLoad: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ defaultUrl: {
+ value: 'compressed.tracemonkey-pldi-09.pdf',
+ kind: OptionKind.VIEWER
+ },
+ defaultZoomValue: {
+ value: '',
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ disableHistory: {
+ value: false,
+ kind: OptionKind.VIEWER
+ },
+ disablePageLabels: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ enablePrintAutoRotate: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ enableWebGL: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ eventBusDispatchToDOM: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ externalLinkRel: {
+ value: 'noopener noreferrer nofollow',
+ kind: OptionKind.VIEWER
+ },
+ externalLinkTarget: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ historyUpdateUrl: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ imageResourcesPath: {
+ value: './images/',
+ kind: OptionKind.VIEWER
+ },
+ maxCanvasPixels: {
+ value: 16777216,
+ compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels,
+ kind: OptionKind.VIEWER
+ },
+ pdfBugEnabled: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ renderer: {
+ value: 'canvas',
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ renderInteractiveForms: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ sidebarViewOnLoad: {
+ value: -1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ scrollModeOnLoad: {
+ value: -1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ spreadModeOnLoad: {
+ value: -1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ textLayerMode: {
+ value: 1,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ useOnlyCssZoom: {
+ value: false,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ viewOnLoad: {
+ value: 0,
+ kind: OptionKind.VIEWER + OptionKind.PREFERENCE
+ },
+ cMapPacked: {
+ value: true,
+ kind: OptionKind.API
+ },
+ cMapUrl: {
+ value: '../web/cmaps/',
+ kind: OptionKind.API
+ },
+ disableAutoFetch: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ disableCreateObjectURL: {
+ value: false,
+ compatibility: _pdfjsLib.apiCompatibilityParams.disableCreateObjectURL,
+ kind: OptionKind.API
+ },
+ disableFontFace: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ disableRange: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ disableStream: {
+ value: false,
+ kind: OptionKind.API + OptionKind.PREFERENCE
+ },
+ isEvalSupported: {
+ value: true,
+ kind: OptionKind.API
+ },
+ maxImageSize: {
+ value: -1,
+ kind: OptionKind.API
+ },
+ pdfBug: {
+ value: false,
+ kind: OptionKind.API
+ },
+ postMessageTransfers: {
+ value: true,
+ kind: OptionKind.API
+ },
+ verbosity: {
+ value: 1,
+ kind: OptionKind.API
+ },
+ workerPort: {
+ value: null,
+ kind: OptionKind.WORKER
+ },
+ workerSrc: {
+ value: '../build/pdf.worker.js',
+ kind: OptionKind.WORKER
+ }
+};
+;
+const userOptions = Object.create(null);
+
+class AppOptions {
+ constructor() {
+ throw new Error('Cannot initialize AppOptions.');
+ }
+
+ static get(name) {
+ const userOption = userOptions[name];
+
+ if (userOption !== undefined) {
+ return userOption;
+ }
+
+ const defaultOption = defaultOptions[name];
+
+ if (defaultOption !== undefined) {
+ return defaultOption.compatibility || defaultOption.value;
+ }
+
+ return undefined;
+ }
+
+ static getAll(kind = null) {
+ const options = Object.create(null);
+
+ for (const name in defaultOptions) {
+ const defaultOption = defaultOptions[name];
+
+ if (kind) {
+ if ((kind & defaultOption.kind) === 0) {
+ continue;
+ }
+
+ if ((kind & OptionKind.PREFERENCE) !== 0) {
+ options[name] = defaultOption.value;
+ continue;
+ }
+ }
+
+ const userOption = userOptions[name];
+ options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value;
+ }
+
+ return options;
+ }
+
+ static set(name, value) {
+ userOptions[name] = value;
+ }
+
+ static remove(name) {
+ delete userOptions[name];
+ }
+
+}
+
+exports.AppOptions = AppOptions;
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
let pdfjsLib;
if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {
@@ -3114,7 +3345,18 @@ if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {
module.exports = pdfjsLib;
/***/ }),
-/* 4 */
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+let compatibilityParams = Object.create(null);
+;
+exports.viewerCompatibilityParams = Object.freeze(compatibilityParams);
+
+/***/ }),
+/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -3125,7 +3367,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFCursorTools = exports.CursorTool = void 0;
-var _grab_to_pan = __webpack_require__(5);
+var _grab_to_pan = __webpack_require__(7);
const CursorTool = {
SELECT: 0,
@@ -3237,7 +3479,7 @@ class PDFCursorTools {
exports.PDFCursorTools = PDFCursorTools;
/***/ }),
-/* 5 */
+/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -3400,7 +3642,7 @@ function isLeftMouseReleased(event) {
}
/***/ }),
-/* 6 */
+/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -3537,7 +3779,7 @@ class PDFRenderingQueue {
exports.PDFRenderingQueue = PDFRenderingQueue;
/***/ }),
-/* 7 */
+/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -3550,7 +3792,7 @@ exports.PDFSidebar = exports.SidebarView = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdf_rendering_queue = __webpack_require__(6);
+var _pdf_rendering_queue = __webpack_require__(8);
const UI_NOTIFICATION_CLASS = 'pdfSidebarNotification';
const SidebarView = {
@@ -3724,420 +3966,186 @@ class PDFSidebar {
close() {
if (!this.isOpen) {
- return;
- }
-
- this.isOpen = false;
- this.toggleButton.classList.remove('toggled');
- this.outerContainer.classList.add('sidebarMoving');
- this.outerContainer.classList.remove('sidebarOpen');
-
- this._forceRendering();
-
- this._dispatchEvent();
- }
-
- toggle() {
- if (this.isOpen) {
- this.close();
- } else {
- this.open();
- }
- }
-
- _dispatchEvent() {
- this.eventBus.dispatch('sidebarviewchanged', {
- source: this,
- view: this.visibleView
- });
- }
-
- _forceRendering() {
- if (this.onToggled) {
- this.onToggled();
- } else {
- this.pdfViewer.forceRendering();
- this.pdfThumbnailViewer.forceRendering();
- }
- }
-
- _updateThumbnailViewer() {
- let {
- pdfViewer,
- pdfThumbnailViewer
- } = this;
- let pagesCount = pdfViewer.pagesCount;
-
- for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {
- let pageView = pdfViewer.getPageView(pageIndex);
-
- if (pageView && pageView.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) {
- let thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);
- thumbnailView.setImage(pageView);
- }
- }
-
- pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);
- }
-
- _showUINotification(view) {
- if (this.disableNotification) {
- return;
- }
-
- this.l10n.get('toggle_sidebar_notification.title', null, 'Toggle Sidebar (document contains outline/attachments)').then(msg => {
- this.toggleButton.title = msg;
- });
-
- if (!this.isOpen) {
- this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);
- } else if (view === this.active) {
- return;
- }
-
- switch (view) {
- case SidebarView.OUTLINE:
- this.outlineButton.classList.add(UI_NOTIFICATION_CLASS);
- break;
-
- case SidebarView.ATTACHMENTS:
- this.attachmentsButton.classList.add(UI_NOTIFICATION_CLASS);
- break;
- }
- }
-
- _hideUINotification(view) {
- if (this.disableNotification) {
- return;
- }
-
- let removeNotification = view => {
- switch (view) {
- case SidebarView.OUTLINE:
- this.outlineButton.classList.remove(UI_NOTIFICATION_CLASS);
- break;
-
- case SidebarView.ATTACHMENTS:
- this.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS);
- break;
- }
- };
-
- if (!this.isOpen && view !== null) {
- return;
- }
-
- this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);
-
- if (view !== null) {
- removeNotification(view);
- return;
- }
-
- for (view in SidebarView) {
- removeNotification(SidebarView[view]);
- }
-
- this.l10n.get('toggle_sidebar.title', null, 'Toggle Sidebar').then(msg => {
- this.toggleButton.title = msg;
- });
- }
-
- _addEventListeners() {
- this.viewerContainer.addEventListener('transitionend', evt => {
- if (evt.target === this.viewerContainer) {
- this.outerContainer.classList.remove('sidebarMoving');
- }
- });
- this.thumbnailButton.addEventListener('click', () => {
- this.switchView(SidebarView.THUMBS);
- });
- this.outlineButton.addEventListener('click', () => {
- this.switchView(SidebarView.OUTLINE);
- });
- this.outlineButton.addEventListener('dblclick', () => {
- this.eventBus.dispatch('toggleoutlinetree', {
- source: this
- });
- });
- this.attachmentsButton.addEventListener('click', () => {
- this.switchView(SidebarView.ATTACHMENTS);
- });
- this.eventBus.on('outlineloaded', evt => {
- let outlineCount = evt.outlineCount;
- this.outlineButton.disabled = !outlineCount;
-
- if (outlineCount) {
- this._showUINotification(SidebarView.OUTLINE);
- } else if (this.active === SidebarView.OUTLINE) {
- this.switchView(SidebarView.THUMBS);
- }
- });
- this.eventBus.on('attachmentsloaded', evt => {
- if (evt.attachmentsCount) {
- this.attachmentsButton.disabled = false;
-
- this._showUINotification(SidebarView.ATTACHMENTS);
-
- return;
- }
-
- Promise.resolve().then(() => {
- if (this.attachmentsView.hasChildNodes()) {
- return;
- }
-
- this.attachmentsButton.disabled = true;
-
- if (this.active === SidebarView.ATTACHMENTS) {
- this.switchView(SidebarView.THUMBS);
- }
- });
- });
- this.eventBus.on('presentationmodechanged', evt => {
- if (!evt.active && !evt.switchInProgress && this.isThumbnailViewVisible) {
- this._updateThumbnailViewer();
- }
- });
- }
-
-}
-
-exports.PDFSidebar = PDFSidebar;
-
-/***/ }),
-/* 8 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.OptionKind = exports.AppOptions = void 0;
-
-var _pdfjsLib = __webpack_require__(3);
-
-var _viewer_compatibility = __webpack_require__(9);
-
-const OptionKind = {
- VIEWER: 'viewer',
- API: 'api',
- WORKER: 'worker'
-};
-exports.OptionKind = OptionKind;
-const defaultOptions = {
- cursorToolOnLoad: {
- value: 0,
- kind: OptionKind.VIEWER
- },
- defaultUrl: {
- value: 'compressed.tracemonkey-pldi-09.pdf',
- kind: OptionKind.VIEWER
- },
- defaultZoomValue: {
- value: '',
- kind: OptionKind.VIEWER
- },
- disableHistory: {
- value: false,
- kind: OptionKind.VIEWER
- },
- disablePageLabels: {
- value: false,
- kind: OptionKind.VIEWER
- },
- enablePrintAutoRotate: {
- value: false,
- kind: OptionKind.VIEWER
- },
- enableWebGL: {
- value: false,
- kind: OptionKind.VIEWER
- },
- eventBusDispatchToDOM: {
- value: false,
- kind: OptionKind.VIEWER
- },
- externalLinkRel: {
- value: 'noopener noreferrer nofollow',
- kind: OptionKind.VIEWER
- },
- externalLinkTarget: {
- value: 0,
- kind: OptionKind.VIEWER
- },
- historyUpdateUrl: {
- value: false,
- kind: OptionKind.VIEWER
- },
- imageResourcesPath: {
- value: './images/',
- kind: OptionKind.VIEWER
- },
- maxCanvasPixels: {
- value: 16777216,
- compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels,
- kind: OptionKind.VIEWER
- },
- pdfBugEnabled: {
- value: false,
- kind: OptionKind.VIEWER
- },
- renderer: {
- value: 'canvas',
- kind: OptionKind.VIEWER
- },
- renderInteractiveForms: {
- value: false,
- kind: OptionKind.VIEWER
- },
- sidebarViewOnLoad: {
- value: -1,
- kind: OptionKind.VIEWER
- },
- scrollModeOnLoad: {
- value: -1,
- kind: OptionKind.VIEWER
- },
- spreadModeOnLoad: {
- value: -1,
- kind: OptionKind.VIEWER
- },
- textLayerMode: {
- value: 1,
- kind: OptionKind.VIEWER
- },
- useOnlyCssZoom: {
- value: false,
- kind: OptionKind.VIEWER
- },
- viewOnLoad: {
- value: 0,
- kind: OptionKind.VIEWER
- },
- cMapPacked: {
- value: true,
- kind: OptionKind.API
- },
- cMapUrl: {
- value: '../web/cmaps/',
- kind: OptionKind.API
- },
- disableAutoFetch: {
- value: false,
- kind: OptionKind.API
- },
- disableCreateObjectURL: {
- value: false,
- compatibility: _pdfjsLib.apiCompatibilityParams.disableCreateObjectURL,
- kind: OptionKind.API
- },
- disableFontFace: {
- value: false,
- kind: OptionKind.API
- },
- disableRange: {
- value: false,
- kind: OptionKind.API
- },
- disableStream: {
- value: false,
- kind: OptionKind.API
- },
- isEvalSupported: {
- value: true,
- kind: OptionKind.API
- },
- maxImageSize: {
- value: -1,
- kind: OptionKind.API
- },
- pdfBug: {
- value: false,
- kind: OptionKind.API
- },
- postMessageTransfers: {
- value: true,
- kind: OptionKind.API
- },
- verbosity: {
- value: 1,
- kind: OptionKind.API
- },
- workerPort: {
- value: null,
- kind: OptionKind.WORKER
- },
- workerSrc: {
- value: '../build/pdf.worker.js',
- kind: OptionKind.WORKER
+ return;
+ }
+
+ this.isOpen = false;
+ this.toggleButton.classList.remove('toggled');
+ this.outerContainer.classList.add('sidebarMoving');
+ this.outerContainer.classList.remove('sidebarOpen');
+
+ this._forceRendering();
+
+ this._dispatchEvent();
}
-};
-;
-const userOptions = Object.create(null);
-class AppOptions {
- constructor() {
- throw new Error('Cannot initialize AppOptions.');
+ toggle() {
+ if (this.isOpen) {
+ this.close();
+ } else {
+ this.open();
+ }
}
- static get(name) {
- const userOption = userOptions[name];
+ _dispatchEvent() {
+ this.eventBus.dispatch('sidebarviewchanged', {
+ source: this,
+ view: this.visibleView
+ });
+ }
- if (userOption !== undefined) {
- return userOption;
+ _forceRendering() {
+ if (this.onToggled) {
+ this.onToggled();
+ } else {
+ this.pdfViewer.forceRendering();
+ this.pdfThumbnailViewer.forceRendering();
}
+ }
- const defaultOption = defaultOptions[name];
+ _updateThumbnailViewer() {
+ let {
+ pdfViewer,
+ pdfThumbnailViewer
+ } = this;
+ let pagesCount = pdfViewer.pagesCount;
- if (defaultOption !== undefined) {
- return defaultOption.compatibility || defaultOption.value;
+ for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {
+ let pageView = pdfViewer.getPageView(pageIndex);
+
+ if (pageView && pageView.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) {
+ let thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);
+ thumbnailView.setImage(pageView);
+ }
}
- return undefined;
+ pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);
}
- static getAll(kind = null) {
- const options = Object.create(null);
+ _showUINotification(view) {
+ if (this.disableNotification) {
+ return;
+ }
- for (const name in defaultOptions) {
- const defaultOption = defaultOptions[name];
+ this.l10n.get('toggle_sidebar_notification.title', null, 'Toggle Sidebar (document contains outline/attachments)').then(msg => {
+ this.toggleButton.title = msg;
+ });
- if (kind && kind !== defaultOption.kind) {
- continue;
+ if (!this.isOpen) {
+ this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);
+ } else if (view === this.active) {
+ return;
+ }
+
+ switch (view) {
+ case SidebarView.OUTLINE:
+ this.outlineButton.classList.add(UI_NOTIFICATION_CLASS);
+ break;
+
+ case SidebarView.ATTACHMENTS:
+ this.attachmentsButton.classList.add(UI_NOTIFICATION_CLASS);
+ break;
+ }
+ }
+
+ _hideUINotification(view) {
+ if (this.disableNotification) {
+ return;
+ }
+
+ let removeNotification = view => {
+ switch (view) {
+ case SidebarView.OUTLINE:
+ this.outlineButton.classList.remove(UI_NOTIFICATION_CLASS);
+ break;
+
+ case SidebarView.ATTACHMENTS:
+ this.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS);
+ break;
}
+ };
- const userOption = userOptions[name];
- options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value;
+ if (!this.isOpen && view !== null) {
+ return;
}
- return options;
- }
+ this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);
- static set(name, value) {
- userOptions[name] = value;
- }
+ if (view !== null) {
+ removeNotification(view);
+ return;
+ }
- static remove(name) {
- delete userOptions[name];
+ for (view in SidebarView) {
+ removeNotification(SidebarView[view]);
+ }
+
+ this.l10n.get('toggle_sidebar.title', null, 'Toggle Sidebar').then(msg => {
+ this.toggleButton.title = msg;
+ });
}
-}
+ _addEventListeners() {
+ this.viewerContainer.addEventListener('transitionend', evt => {
+ if (evt.target === this.viewerContainer) {
+ this.outerContainer.classList.remove('sidebarMoving');
+ }
+ });
+ this.thumbnailButton.addEventListener('click', () => {
+ this.switchView(SidebarView.THUMBS);
+ });
+ this.outlineButton.addEventListener('click', () => {
+ this.switchView(SidebarView.OUTLINE);
+ });
+ this.outlineButton.addEventListener('dblclick', () => {
+ this.eventBus.dispatch('toggleoutlinetree', {
+ source: this
+ });
+ });
+ this.attachmentsButton.addEventListener('click', () => {
+ this.switchView(SidebarView.ATTACHMENTS);
+ });
+ this.eventBus.on('outlineloaded', evt => {
+ let outlineCount = evt.outlineCount;
+ this.outlineButton.disabled = !outlineCount;
-exports.AppOptions = AppOptions;
+ if (outlineCount) {
+ this._showUINotification(SidebarView.OUTLINE);
+ } else if (this.active === SidebarView.OUTLINE) {
+ this.switchView(SidebarView.THUMBS);
+ }
+ });
+ this.eventBus.on('attachmentsloaded', evt => {
+ if (evt.attachmentsCount) {
+ this.attachmentsButton.disabled = false;
-/***/ }),
-/* 9 */
-/***/ (function(module, exports, __webpack_require__) {
+ this._showUINotification(SidebarView.ATTACHMENTS);
-"use strict";
+ return;
+ }
+
+ Promise.resolve().then(() => {
+ if (this.attachmentsView.hasChildNodes()) {
+ return;
+ }
+ this.attachmentsButton.disabled = true;
-let compatibilityParams = Object.create(null);
-;
-exports.viewerCompatibilityParams = Object.freeze(compatibilityParams);
+ if (this.active === SidebarView.ATTACHMENTS) {
+ this.switchView(SidebarView.THUMBS);
+ }
+ });
+ });
+ this.eventBus.on('presentationmodechanged', evt => {
+ if (!evt.active && !evt.switchInProgress && this.isThumbnailViewVisible) {
+ this._updateThumbnailViewer();
+ }
+ });
+ }
+
+}
+
+exports.PDFSidebar = PDFSidebar;
/***/ }),
/* 10 */
@@ -4264,7 +4272,7 @@ exports.PasswordPrompt = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
class PasswordPrompt {
constructor(options, overlayManager, l10n = _ui_utils.NullL10n) {
@@ -4341,7 +4349,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFAttachmentViewer = void 0;
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
class PDFAttachmentViewer {
constructor({
@@ -4491,7 +4499,7 @@ exports.PDFDocumentProperties = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
const DEFAULT_FIELD_CONTENT = '-';
const NON_METRIC_LOCALES = ['en-us', 'en-lr', 'my'];
@@ -5025,7 +5033,7 @@ exports.PDFFindController = exports.FindState = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
var _pdf_find_utils = __webpack_require__(16);
@@ -6776,7 +6784,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFOutlineViewer = void 0;
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
const DEFAULT_TITLE = '\u2013';
@@ -7771,11 +7779,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFThumbnailView = void 0;
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
var _ui_utils = __webpack_require__(2);
-var _pdf_rendering_queue = __webpack_require__(6);
+var _pdf_rendering_queue = __webpack_require__(8);
const MAX_NUM_SCALING_STEPS = 3;
const THUMBNAIL_CANVAS_BORDER_WIDTH = 1;
@@ -7891,6 +7899,7 @@ class PDFThumbnailView {
reset() {
this.cancelRendering();
+ this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
this.pageWidth = this.viewport.width;
this.pageHeight = this.viewport.height;
this.pageRatio = this.pageWidth / this.pageHeight;
@@ -7939,7 +7948,6 @@ class PDFThumbnailView {
this.renderTask = null;
}
- this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
this.resume = null;
}
@@ -8173,7 +8181,7 @@ exports.PDFViewer = void 0;
var _base_viewer = __webpack_require__(25);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
class PDFViewer extends _base_viewer.BaseViewer {
get _setDocumentViewerElement() {
@@ -8260,11 +8268,11 @@ exports.BaseViewer = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdf_rendering_queue = __webpack_require__(6);
+var _pdf_rendering_queue = __webpack_require__(8);
var _annotation_layer_builder = __webpack_require__(26);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
var _pdf_page_view = __webpack_require__(27);
@@ -9311,7 +9319,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0;
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
var _ui_utils = __webpack_require__(2);
@@ -9424,11 +9432,11 @@ exports.PDFPageView = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
-var _pdf_rendering_queue = __webpack_require__(6);
+var _pdf_rendering_queue = __webpack_require__(8);
-var _viewer_compatibility = __webpack_require__(9);
+var _viewer_compatibility = __webpack_require__(5);
const MAX_CANVAS_PIXELS = _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels || 16777216;
@@ -9515,6 +9523,7 @@ class PDFPageView {
reset(keepZoomLayer = false, keepAnnotations = false) {
this.cancelRendering(keepAnnotations);
+ this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
let div = this.div;
div.style.width = Math.floor(this.viewport.width) + 'px';
div.style.height = Math.floor(this.viewport.height) + 'px';
@@ -9620,14 +9629,11 @@ class PDFPageView {
}
cancelRendering(keepAnnotations = false) {
- const renderingState = this.renderingState;
-
if (this.paintTask) {
this.paintTask.cancel();
this.paintTask = null;
}
- this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
this.resume = null;
if (this.textLayer) {
@@ -9639,14 +9645,6 @@ class PDFPageView {
this.annotationLayer.cancel();
this.annotationLayer = null;
}
-
- if (renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) {
- this.eventBus.dispatch('pagecancelled', {
- source: this,
- pageNumber: this.id,
- renderingState
- });
- }
}
cssTransform(target, redrawAnnotations = false) {
@@ -9995,7 +9993,7 @@ exports.DefaultTextLayerFactory = exports.TextLayerBuilder = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
const EXPAND_DIVS_TIMEOUT = 300;
@@ -10022,9 +10020,7 @@ class TextLayerBuilder {
this.findController = findController;
this.textLayerRenderTask = null;
this.enhanceTextSelection = enhanceTextSelection;
- this._boundEvents = Object.create(null);
-
- this._bindEvents();
+ this._onUpdateTextLayerMatches = null;
this._bindMouse();
}
@@ -10070,6 +10066,16 @@ class TextLayerBuilder {
this._updateMatches();
}, function (reason) {});
+
+ if (!this._onUpdateTextLayerMatches) {
+ this._onUpdateTextLayerMatches = evt => {
+ if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {
+ this._updateMatches();
+ }
+ };
+
+ this.eventBus.on('updatetextlayermatches', this._onUpdateTextLayerMatches);
+ }
}
cancel() {
@@ -10077,6 +10083,11 @@ class TextLayerBuilder {
this.textLayerRenderTask.cancel();
this.textLayerRenderTask = null;
}
+
+ if (this._onUpdateTextLayerMatches) {
+ this.eventBus.off('updatetextlayermatches', this._onUpdateTextLayerMatches);
+ this._onUpdateTextLayerMatches = null;
+ }
}
setTextContentStream(readableStream) {
@@ -10279,40 +10290,6 @@ class TextLayerBuilder {
this._renderMatches(this.matches);
}
- _bindEvents() {
- const {
- eventBus,
- _boundEvents
- } = this;
-
- _boundEvents.pageCancelled = evt => {
- if (evt.pageNumber !== this.pageNumber) {
- return;
- }
-
- if (this.textLayerRenderTask) {
- console.error('TextLayerBuilder._bindEvents: `this.cancel()` should ' + 'have been called when the page was reset, or rendering cancelled.');
- return;
- }
-
- for (const name in _boundEvents) {
- eventBus.off(name.toLowerCase(), _boundEvents[name]);
- delete _boundEvents[name];
- }
- };
-
- _boundEvents.updateTextLayerMatches = evt => {
- if (evt.pageIndex !== this.pageIdx && evt.pageIndex !== -1) {
- return;
- }
-
- this._updateMatches();
- };
-
- eventBus.on('pagecancelled', _boundEvents.pageCancelled);
- eventBus.on('updatetextlayermatches', _boundEvents.updateTextLayerMatches);
- }
-
_bindMouse() {
let div = this.textLayerDiv;
let expandDivsTimer = null;
@@ -10378,7 +10355,7 @@ exports.SecondaryToolbar = void 0;
var _ui_utils = __webpack_require__(2);
-var _pdf_cursor_tools = __webpack_require__(4);
+var _pdf_cursor_tools = __webpack_require__(6);
var _pdf_single_page_viewer = __webpack_require__(30);
@@ -10694,7 +10671,7 @@ exports.PDFSinglePageViewer = void 0;
var _base_viewer = __webpack_require__(25);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
class PDFSinglePageViewer extends _base_viewer.BaseViewer {
constructor(options) {
@@ -11150,7 +11127,7 @@ exports.FirefoxCom = exports.DownloadManager = void 0;
__webpack_require__(34);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
var _preferences = __webpack_require__(35);
@@ -11589,27 +11566,27 @@ let defaultPreferences = null;
function getDefaultPreferences() {
if (!defaultPreferences) {
defaultPreferences = Promise.resolve({
- "viewOnLoad": 0,
- "defaultZoomValue": "",
- "sidebarViewOnLoad": -1,
"cursorToolOnLoad": 0,
+ "defaultZoomValue": "",
+ "disablePageLabels": false,
+ "enablePrintAutoRotate": false,
"enableWebGL": false,
"eventBusDispatchToDOM": false,
- "pdfBugEnabled": false,
- "disableRange": false,
- "disableStream": false,
- "disableAutoFetch": false,
- "disableFontFace": false,
- "textLayerMode": 1,
- "useOnlyCssZoom": false,
"externalLinkTarget": 0,
+ "historyUpdateUrl": false,
+ "pdfBugEnabled": false,
"renderer": "canvas",
"renderInteractiveForms": false,
- "enablePrintAutoRotate": false,
- "disablePageLabels": false,
- "historyUpdateUrl": false,
+ "sidebarViewOnLoad": -1,
"scrollModeOnLoad": -1,
- "spreadModeOnLoad": -1
+ "spreadModeOnLoad": -1,
+ "textLayerMode": 1,
+ "useOnlyCssZoom": false,
+ "viewOnLoad": 0,
+ "disableAutoFetch": false,
+ "disableFontFace": false,
+ "disableRange": false,
+ "disableStream": false
});
}
@@ -11735,7 +11712,7 @@ var _ui_utils = __webpack_require__(2);
var _app = __webpack_require__(1);
-var _pdfjsLib = __webpack_require__(3);
+var _pdfjsLib = __webpack_require__(4);
function composePage(pdfDocument, pageNumber, size, printContainer) {
let canvas = document.createElement('canvas');
diff --git a/browser/extensions/pdfjs/moz.yaml b/browser/extensions/pdfjs/moz.yaml
index 081f851e0bb3e..9d2c716711725 100644
--- a/browser/extensions/pdfjs/moz.yaml
+++ b/browser/extensions/pdfjs/moz.yaml
@@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
- release: version 2.1.266
+ release: version 2.2.15
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/
diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
index 9f19d4350face..1ee8d267f08ae 100644
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -643,7 +643,7 @@ def split_triplet(triplet, allow_unknown=False):
elif len(parts) == 2:
cpu, os = parts
else:
- die("Unexpected triplet string: %s" % triplet)
+ raise ValueError("Unexpected triplet string: %s" % triplet)
# Autoconf uses config.sub to validate and canonicalize those triplets,
# but the granularity of its results has never been satisfying to our
@@ -687,7 +687,7 @@ def split_triplet(triplet, allow_unknown=False):
elif allow_unknown:
canonical_os = canonical_kernel = os
else:
- die('Unknown OS: %s' % os)
+ raise ValueError('Unknown OS: %s' % os)
# The CPU granularity is probably not enough. Moving more things from
# old-configure will tell us if we need more
@@ -737,7 +737,7 @@ def split_triplet(triplet, allow_unknown=False):
canonical_cpu = cpu
endianness = 'unknown'
else:
- die('Unknown CPU type: %s' % cpu)
+ raise ValueError('Unknown CPU type: %s' % cpu)
def sanitize(cls, value):
try:
@@ -796,6 +796,7 @@ def config_sub(shell, triplet):
@imports('os')
@imports('subprocess')
@imports('sys')
+@imports(_from='__builtin__', _import='ValueError')
def real_host(value, shell):
if not value and sys.platform == 'win32':
arch = (os.environ.get('PROCESSOR_ARCHITEW6432') or
@@ -809,10 +810,19 @@ def real_host(value, shell):
config_guess = os.path.join(os.path.dirname(__file__), '..',
'autoconf', 'config.guess')
host = subprocess.check_output([shell, config_guess]).strip()
+ try:
+ return split_triplet(host)
+ except ValueError:
+ pass
else:
- host = config_sub(shell, value[0])
+ host = value[0]
+
+ host = config_sub(shell, host)
- return split_triplet(host)
+ try:
+ return split_triplet(host)
+ except ValueError as e:
+ die(e.message)
host = help_host_target | real_host
@@ -820,6 +830,7 @@ host = help_host_target | real_host
@depends('--target', real_host, shell, '--enable-project', '--enable-application')
@checking('for target system type', lambda t: t.alias)
+@imports(_from='__builtin__', _import='ValueError')
def real_target(value, host, shell, project, application):
# Because --enable-project is implied by --enable-application, and
# implied options are not currently handled during --help, which is
@@ -846,9 +857,16 @@ def real_target(value, host, shell, project, application):
rest += 'eabi'
else:
cpu, rest = host.alias.split('-', 1)
- return split_triplet('-'.join((target, rest)))
-
- return split_triplet(config_sub(shell, target))
+ target = '-'.join((target, rest))
+ try:
+ return split_triplet(target)
+ except ValueError:
+ pass
+
+ try:
+ return split_triplet(config_sub(shell, target))
+ except ValueError as e:
+ die(e.message)
target = help_host_target | real_target
diff --git a/build/mozconfig.pgo b/build/mozconfig.pgo
new file mode 100644
index 0000000000000..41444f7445f26
--- /dev/null
+++ b/build/mozconfig.pgo
@@ -0,0 +1,7 @@
+case "$PERFHERDER_EXTRA_OPTIONS" in
+base-toolchains*)
+ ;;
+*)
+ export MOZ_PGO=1
+ ;;
+esac
diff --git a/configure.py b/configure.py
index 9ec2ae24bacbb..913dd35f9aef8 100644
--- a/configure.py
+++ b/configure.py
@@ -14,7 +14,10 @@
base_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(base_dir, 'python', 'mozbuild'))
-from mozbuild.configure import ConfigureSandbox
+from mozbuild.configure import (
+ ConfigureSandbox,
+ TRACE,
+)
from mozbuild.pythonutil import iter_modules_in_path
from mozbuild.backend.configenvironment import PartialConfigEnvironment
from mozbuild.util import (
@@ -26,7 +29,12 @@
def main(argv):
config = {}
+
sandbox = ConfigureSandbox(config, os.environ, argv)
+
+ if os.environ.get('MOZ_CONFIGURE_TRACE'):
+ sandbox._logger.setLevel(TRACE)
+
sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure'))
if sandbox._help:
diff --git a/devtools/client/debugger/new/README.mozilla b/devtools/client/debugger/new/README.mozilla
index 39cc989138e93..dba0e54b7de35 100644
--- a/devtools/client/debugger/new/README.mozilla
+++ b/devtools/client/debugger/new/README.mozilla
@@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
-Version 125
+Version 126
-Comparison: https://github.com/devtools-html/debugger.html/compare/release-124...release-125
+Comparison: https://github.com/devtools-html/debugger.html/compare/release-125...release-126
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.2
diff --git a/devtools/client/debugger/new/dist/debugger.css b/devtools/client/debugger/new/dist/debugger.css
index 925a1b33c3b86..610aaed81ca16 100644
--- a/devtools/client/debugger/new/dist/debugger.css
+++ b/devtools/client/debugger/new/dist/debugger.css
@@ -251,7 +251,7 @@ button.open-inspector {
margin: 0 4px;
padding: 0;
border: none;
- background-color: var(--comment-node-color);
+ background-color: var(--theme-icon-color);
cursor: pointer;
}
@@ -260,7 +260,7 @@ button.open-inspector {
.objectBox-textNode:hover .open-inspector,
.open-accessibility-inspector:hover,
.open-inspector:hover {
- background-color: var(--theme-highlight-blue);
+ background-color: var(--theme-icon-checked-color);
}
/******************************************************************************/
@@ -269,14 +269,14 @@ button.open-inspector {
button.jump-definition {
mask: url("resource://devtools/client/shared/components/reps/images/jump-definition.svg") no-repeat;
display: inline-block;
- background-color: var(--comment-node-color);
+ background-color: var(--theme-icon-color);
height: 16px;
margin-left: 0.25em;
vertical-align: middle;
}
.jump-definition:hover {
- background-color: var(--theme-highlight-blue);
+ background-color: var(--theme-icon-checked-color);
}
/******************************************************************************/
@@ -285,14 +285,14 @@ button.jump-definition {
button.invoke-getter {
mask: url("resource://devtools/client/shared/components/reps/images/input.svg") no-repeat;
display: inline-block;
- background-color: var(--comment-node-color);
+ background-color: var(--theme-icon-color);
height: 10px;
vertical-align: middle;
border:none;
}
.invoke-getter:hover {
- background-color: var(--theme-highlight-blue);
+ background-color: var(--theme-icon-checked-color);
}
/******************************************************************************/
@@ -357,30 +357,27 @@ button.invoke-getter {
}
.tree-node button.arrow {
- background:url("resource://devtools/client/debugger/new/images/arrow.svg") no-repeat;
- background-size:contain;
- background-position:center center;
+ mask: url("resource://devtools/client/debugger/new/images/arrow.svg") no-repeat center;
+ mask-size: 10px;
+ vertical-align: -1px;
width: 10px;
height: 10px;
- border:0;
- padding:0;
+ border: 0;
+ padding: 0;
margin-inline-start: 1px;
margin-inline-end: 4px;
- transform: rotate(-90deg);
transform-origin: center center;
- transition: transform 0.125s ease;
- align-self: center;
- -moz-context-properties: fill;
- fill: var(--theme-splitter-color, #9B9B9B);
+ transition: transform 125ms var(--animation-curve);
+ background-color: var(--theme-icon-dimmed-color);
}
-html[dir="rtl"] .tree-node button.arrow {
- transform: rotate(90deg);
+.tree-node button.arrow:not(.expanded) {
+ transform: rotate(-90deg);
}
-.tree-node button.arrow.expanded.expanded {
- transform: rotate(0deg);
- }
+html[dir="rtl"] .tree-node button:not(.expanded) {
+ transform: rotate(90deg);
+}
.tree .tree-node.focused {
color: white;
@@ -388,7 +385,7 @@ html[dir="rtl"] .tree-node button.arrow {
}
.tree-node.focused button.arrow {
- fill: currentColor;
+ background-color: currentColor;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -555,6 +552,8 @@ html[dir="rtl"] .tree-node button.arrow {
--editor-footer-height: 25px;
/* searchbar height is 24px + 1px for its top border */
--editor-searchbar-height: 25px;
+ /* Remove once https://bugzilla.mozilla.org/show_bug.cgi?id=1520440 lands */
+ --theme-code-line-height: calc(15 / 11);
}
:root.theme-light,
@@ -2318,7 +2317,7 @@ menuseparator {
}
.source-footer > .commands > .blackboxed > .img.blackBox {
- background-color: var(--theme-highlight-blue);
+ background-color: var(--theme-icon-checked-color);
}
.source-footer .blackbox-summary,
@@ -2670,8 +2669,8 @@ menuseparator {
.column-breakpoint {
display: inline;
- padding: 0;
- padding-inline-end: 4px;
+ padding-inline-start: 1px;
+ padding-inline-end: 3px;
}
.column-breakpoint:hover {
@@ -2679,10 +2678,10 @@ menuseparator {
}
.column-breakpoint svg {
- display: inline;
+ display: inline-block;
cursor: pointer;
- height: 12px;
- width: 9px;
+ height: 13px;
+ width: 11px;
vertical-align: top;
}
@@ -2787,7 +2786,7 @@ menuseparator {
/**
* There's a known codemirror flex issue with chrome that this addresses.
- * BUG https://github.com/devtools-html/debugger.html/issues/63
+ * BUG https://github.com/firefox-devtools/debugger.html/issues/63
*/
.editor-wrapper {
position: absolute;
@@ -2825,20 +2824,6 @@ html[dir="rtl"] .editor-mount {
color: var(--grey-50);
}
-:not(.empty-line):not(.new-breakpoint)
- > .CodeMirror-gutter-wrapper:hover
- > .CodeMirror-linenumber {
- height: 13px;
- color: var(--theme-body-color);
- /* Add 1px offset to the background to match it
- with the actual breakpoint image dimensions */
- background: linear-gradient(
- to bottom,
- transparent 1px,
- var(--gutter-hover-background-color) 0
- );
-}
-
.new-breakpoint .CodeMirror-linenumber {
pointer-events: none;
}
@@ -2848,12 +2833,16 @@ html[dir="rtl"] .editor-mount {
> .CodeMirror-linenumber::after {
content: "";
position: absolute;
- top: 1px;
- height: 12px;
- width: 9px;
+ /* paint below the number */
+ z-index: -1;
+ top: 0;
+ left: 0;
+ right: -7px;
+ bottom: 0;
+ height: 15px;
background-color: var(--gutter-hover-background-color);
mask: url("resource://devtools/client/debugger/new/images/breakpoint.svg") no-repeat;
- mask-size: auto 12px;
+ mask-size: auto 15px;
mask-position: right;
}
@@ -2873,7 +2862,7 @@ html[dir="rtl"] .editor-mount {
}
.editor.hit-marker {
- height: 14px;
+ height: 15px;
}
.editor-wrapper .highlight-lines {
@@ -2884,7 +2873,7 @@ html[dir="rtl"] .editor-mount {
fill: var(--breakpoint-fill);
stroke: var(--breakpoint-stroke);
width: 60px;
- height: 14px;
+ height: 15px;
position: absolute;
top: 0px;
right: -4px;
@@ -2929,7 +2918,7 @@ html[dir="rtl"] .editor-mount {
fill: var(--theme-selection-background);
vertical-align: middle;
width: 17px;
- height: 14px;
+ height: 15px;
}
.editor.column-breakpoint.breakpoint-disabled svg {
@@ -2944,11 +2933,8 @@ html[dir="rtl"] .editor-mount {
.editor-wrapper .editor-mount {
width: 100%;
background-color: var(--theme-body-background);
-}
-
-.CodeMirror-linenumber {
- font-size: 11px;
- line-height: 14px;
+ font-size: var(--theme-code-font-size);
+ line-height: var(--theme-code-line-height);
}
.folding-enabled .CodeMirror-linenumber {
@@ -2969,10 +2955,6 @@ html[dir="rtl"] .editor-mount {
z-index: 0;
}
-.editor-wrapper .CodeMirror-line {
- font-size: 11px;
-}
-
.theme-dark .editor-wrapper .CodeMirror-line .cm-comment {
color: var(--theme-comment);
}
@@ -3439,8 +3421,8 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
-.frames ul .frames-group .group,
-.frames ul .frames-group .group .location {
+.frames [role="list"] .frames-group .group,
+.frames [role="list"] .frames-group .group .location {
font-weight: 500;
cursor: default;
/*
@@ -3451,21 +3433,21 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
direction: ltr;
}
-.frames ul .frames-group.expanded .group,
-.frames ul .frames-group.expanded .group .location {
+.frames [role="list"] .frames-group.expanded .group,
+.frames [role="list"] .frames-group.expanded .group .location {
color: var(--theme-highlight-blue);
}
-.frames ul .frames-group .frames-list li {
+.frames [role="list"] .frames-group .frames-list [role="listitem"] {
padding-left: 30px;
}
-.frames ul .frames-group .frames-list {
+.frames [role="list"] .frames-group .frames-list {
border-top: 1px solid var(--theme-splitter-color);
border-bottom: 1px solid var(--theme-splitter-color);
}
-.frames ul .frames-group.expanded .badge {
+.frames [role="list"] .frames-group.expanded .badge {
color: var(--theme-highlight-blue);
}
@@ -3831,7 +3813,7 @@ html[dir="rtl"] .command-bar {
}
.command-bar .active .disable-pausing {
- background-color: var(--theme-highlight-blue);
+ background-color: var(--theme-icon-checked-color);
}
.bottom {
@@ -3981,7 +3963,10 @@ html[dir="rtl"] .command-bar {
* file, You can obtain one at . */
.event-listeners-content {
- padding: 4px 20px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ padding-inline-start: 14px;
+ padding-inline-end: 20px;
}
.event-listeners-content ul {
@@ -3993,6 +3978,39 @@ html[dir="rtl"] .command-bar {
user-select: none;
}
+.event-listener-header {
+ display: flex;
+ align-items: center;
+}
+
+.event-listener-expand {
+ border: none;
+ background: none;
+ padding: 4px 5px;
+ line-height: 12px;
+}
+
+.event-listener-expand:hover {
+ background: transparent;
+}
+
+.event-listener-group input[type="checkbox"] {
+ margin: 0px;
+ margin-inline-end: 4px;
+}
+
+.event-listener-label {
+ display: flex;
+ align-items: center;
+ padding-inline-start: 2px;
+ padding-inline-end: 10px;
+}
+
+.event-listener-category {
+ padding: 3px 0px;
+ line-height: 14px;
+}
+
.event-listeners-content .arrow {
margin-inline-end: 0;
}
@@ -4011,9 +4029,16 @@ html[dir="rtl"] .event-listeners-content .arrow.expanded {
margin-inline-start: 30px;
}
+.event-listener-name {
+ line-height: 14px;
+ padding: 3px 0px;
+}
+
.event-listener-event input {
margin-inline-end: 4px;
margin-inline-start: 0px;
+ margin-top: 0px;
+ margin-bottom: 0px;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -4094,7 +4119,7 @@ html[dir="rtl"] .object-node {
This allows the commandbar to remain fixed when scrolling
until the content completely ends. Not just the height of
the wrapper.
- Ref: https://github.com/devtools-html/debugger.html/issues/3426
+ Ref: https://github.com/firefox-devtools/debugger.html/issues/3426
*/
.secondary-panes-wrapper {
@@ -4498,7 +4523,7 @@ html .welcomebox .toggle-button-end.collapsed {
}
.result-list li .result-item-icon {
- background-color: var(--theme-comment);
+ background-color: var(--theme-icon-dimmed-color);
}
.result-list li .icon {
diff --git a/devtools/client/debugger/new/dist/parser-worker.js b/devtools/client/debugger/new/dist/parser-worker.js
index a89dbfb007560..3333196503069 100644
--- a/devtools/client/debugger/new/dist/parser-worker.js
+++ b/devtools/client/debugger/new/dist/parser-worker.js
@@ -560,48 +560,6 @@ function toKey(value) {
module.exports = toKey;
-/***/ }),
-
-/***/ 1127:
-/***/ (function(module, exports, __webpack_require__) {
-
-var baseIsEqual = __webpack_require__(799);
-
-/**
- * Performs a deep comparison between two values to determine if they are
- * equivalent.
- *
- * **Note:** This method supports comparing arrays, array buffers, booleans,
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
- * by their own, not inherited, enumerable properties. Functions and DOM
- * nodes are compared by strict equality, i.e. `===`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.isEqual(object, other);
- * // => true
- *
- * object === other;
- * // => false
- */
-function isEqual(value, other) {
- return baseIsEqual(value, other);
-}
-
-module.exports = isEqual;
-
-
/***/ }),
/***/ 114:
@@ -1802,8 +1760,6 @@ var _validate = __webpack_require__(1629);
var _frameworks = __webpack_require__(1703);
-var _pausePoints = __webpack_require__(3612);
-
var _mapExpression = __webpack_require__(3755);
var _mapExpression2 = _interopRequireDefault(_mapExpression);
@@ -1812,9 +1768,11 @@ var _devtoolsUtils = __webpack_require__(3651);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-const { workerHandler } = _devtoolsUtils.workerUtils; /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at . */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at . */
+
+const { workerHandler } = _devtoolsUtils.workerUtils;
self.onmessage = workerHandler({
findOutOfScopeLocations: _findOutOfScopeLocations2.default,
@@ -1829,7 +1787,6 @@ self.onmessage = workerHandler({
getNextStep: _steps.getNextStep,
hasSyntaxError: _validate.hasSyntaxError,
getFramework: _frameworks.getFramework,
- getPausePoints: _pausePoints.getPausePoints,
mapExpression: _mapExpression2.default
});
@@ -22486,185 +22443,6 @@ class SimplePath {
/***/ }),
-/***/ 3612:
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.getPausePoints = getPausePoints;
-
-var _ast = __webpack_require__(1375);
-
-var _types = __webpack_require__(2268);
-
-var t = _interopRequireWildcard(_types);
-
-var _isEqual = __webpack_require__(1127);
-
-var _isEqual2 = _interopRequireDefault(_isEqual);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
-
-const isForStatement = node => t.isForStatement(node) || t.isForOfStatement(node); /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at . */
-
-const isControlFlow = node => isForStatement(node) || t.isWhileStatement(node) || t.isIfStatement(node) || t.isSwitchCase(node) || t.isSwitchStatement(node) || t.isTryStatement(node) || t.isWithStatement(node);
-
-const isAssignment = node => t.isVariableDeclarator(node) || t.isAssignmentExpression(node) || t.isAssignmentPattern(node);
-
-const isImport = node => t.isImport(node) || t.isImportDeclaration(node);
-const isCall = node => t.isCallExpression(node) || t.isJSXElement(node);
-
-const inStepExpression = parent => t.isArrayExpression(parent) || t.isObjectProperty(parent) || t.isCallExpression(parent) || t.isJSXElement(parent) || t.isSequenceExpression(parent);
-
-const inExpression = (parent, grandParent) => inStepExpression(parent) || t.isJSXAttribute(grandParent) || t.isTemplateLiteral(parent);
-
-const isExport = node => t.isExportNamedDeclaration(node) || t.isExportDefaultDeclaration(node);
-
-// Finds the first call item in a step expression so that we can step
-// to the beginning of the list and either step in or over. e.g. [], x(), { }
-function isFirstCall(node, parentNode, grandParentNode) {
- let children = [];
- if (t.isArrayExpression(parentNode)) {
- children = parentNode.elements;
- }
-
- if (t.isObjectProperty(parentNode)) {
- children = grandParentNode.properties.map(({ value }) => value);
- }
-
- if (t.isSequenceExpression(parentNode)) {
- children = parentNode.expressions;
- }
-
- if (t.isCallExpression(parentNode)) {
- children = parentNode.arguments;
- }
-
- return children.find(child => isCall(child)) === node;
-}
-
-function getPausePoints(sourceId) {
- const state = {};
- (0, _ast.traverseAst)(sourceId, { enter: onEnter }, state);
- return state;
-}
-
-/* eslint-disable complexity */
-function onEnter(node, ancestors, state) {
- const parent = ancestors[ancestors.length - 1];
- const parentNode = parent && parent.node;
- const grandParent = ancestors[ancestors.length - 2];
- const grandParentNode = grandParent && grandParent.node;
- const startLocation = node.loc.start;
-
- if (isImport(node) || t.isClassDeclaration(node) || isExport(node) || t.isDebuggerStatement(node) || t.isThrowStatement(node) || t.isBreakStatement(node) || t.isContinueStatement(node) || t.isReturnStatement(node)) {
- return addStopPoint(state, startLocation);
- }
-
- if (isControlFlow(node)) {
- addStopPoint(state, startLocation);
-
- // We want to pause at tests so that we can pause at each iteration
- // e.g `while (i++ < 3) { }`
- const test = node.test || node.discriminant;
- if (test) {
- addStopPoint(state, test.loc.start);
- }
- return;
- }
-
- if (t.isBlockStatement(node) || t.isArrayExpression(node)) {
- return addEmptyPoint(state, startLocation);
- }
-
- if (isAssignment(node)) {
- // step at assignments unless the right side is a default assignment
- // e.g. `( b = 2 ) => {}`
- const defaultAssignment = t.isFunction(parentNode) && parent.key === "params";
-
- return addPoint(state, startLocation, !defaultAssignment);
- }
-
- if (isCall(node)) {
- let location = startLocation;
-
- // When functions are chained, we want to use the property location
- // e.g `foo().bar()`
- if (t.isMemberExpression(node.callee)) {
- location = node.callee.property.loc.start;
- }
-
- // NOTE: We want to skip all nested calls in expressions except for the
- // first call in arrays and objects expression e.g. [], {}, call
- const step = isFirstCall(node, parentNode, grandParentNode) || !inExpression(parentNode, grandParentNode);
-
- // NOTE: we add a point at the beginning of the expression
- // and each of the calls because the engine does not support
- // column-based member expression calls.
- addPoint(state, startLocation, { break: true, step });
-
- if (location && !(0, _isEqual2.default)(location, startLocation)) {
- addPoint(state, location, { break: true, step });
- }
-
- return;
- }
-
- if (t.isClassProperty(node)) {
- return addBreakPoint(state, startLocation);
- }
-
- if (t.isFunction(node)) {
- const { line, column } = node.loc.end;
- addBreakPoint(state, startLocation);
- return addEmptyPoint(state, { line, column: column - 1 });
- }
-
- if (!hasPoint(state, startLocation) && inStepExpression(parentNode)) {
- return addEmptyPoint(state, startLocation);
- }
-}
-
-function hasPoint(state, { line, column }) {
- return state[line] && state[line][column];
-}
-
-function addPoint(state, location, types) {
- if (typeof types === "boolean") {
- types = { step: types, break: types };
- }
-
- const { line, column } = location;
-
- if (!state[line]) {
- state[line] = {};
- }
- state[line][column] = { types, location };
- return state;
-}
-
-function addStopPoint(state, location) {
- return addPoint(state, location, { break: true, step: true });
-}
-
-function addEmptyPoint(state, location) {
- return addPoint(state, location, {});
-}
-
-function addBreakPoint(state, location) {
- return addPoint(state, location, { break: true });
-}
-
-/***/ }),
-
/***/ 3613:
/***/ (function(module, exports, __webpack_require__) {
diff --git a/devtools/client/debugger/new/dist/vendors.css b/devtools/client/debugger/new/dist/vendors.css
index 6b6b822bbc860..0e52c744b22c8 100644
--- a/devtools/client/debugger/new/dist/vendors.css
+++ b/devtools/client/debugger/new/dist/vendors.css
@@ -55,30 +55,27 @@
}
.tree-node button.arrow {
- background:url("resource://devtools/client/debugger/new/images/arrow.svg") no-repeat;
- background-size:contain;
- background-position:center center;
+ mask: url("resource://devtools/client/debugger/new/images/arrow.svg") no-repeat center;
+ mask-size: 10px;
+ vertical-align: -1px;
width: 10px;
height: 10px;
- border:0;
- padding:0;
+ border: 0;
+ padding: 0;
margin-inline-start: 1px;
margin-inline-end: 4px;
- transform: rotate(-90deg);
transform-origin: center center;
- transition: transform 0.125s ease;
- align-self: center;
- -moz-context-properties: fill;
- fill: var(--theme-splitter-color, #9B9B9B);
+ transition: transform 125ms var(--animation-curve);
+ background-color: var(--theme-icon-dimmed-color);
}
-html[dir="rtl"] .tree-node button.arrow {
- transform: rotate(90deg);
+.tree-node button.arrow:not(.expanded) {
+ transform: rotate(-90deg);
}
-.tree-node button.arrow.expanded.expanded {
- transform: rotate(0deg);
- }
+html[dir="rtl"] .tree-node button:not(.expanded) {
+ transform: rotate(90deg);
+}
.tree .tree-node.focused {
color: white;
@@ -86,7 +83,7 @@ html[dir="rtl"] .tree-node button.arrow {
}
.tree-node.focused button.arrow {
- fill: currentColor;
+ background-color: currentColor;
}
/* vim:set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
diff --git a/devtools/client/debugger/new/dist/vendors.js b/devtools/client/debugger/new/dist/vendors.js
index 1073c2266aafd..703b0cbc8d6aa 100644
--- a/devtools/client/debugger/new/dist/vendors.js
+++ b/devtools/client/debugger/new/dist/vendors.js
@@ -4814,6 +4814,10 @@ __webpack_require__(3671);
// depth
const AUTO_EXPAND_DEPTH = 0;
+// Simplied selector targetting elements that can receive the focus,
+// full version at https://stackoverflow.com/questions/1599660.
+const FOCUSABLE_SELECTOR = ["a[href]:not([tabindex='-1'])", "button:not([disabled]):not([tabindex='-1'])", "iframe:not([tabindex='-1'])", "input:not([disabled]):not([tabindex='-1'])", "select:not([disabled]):not([tabindex='-1'])", "textarea:not([disabled]):not([tabindex='-1'])", "[tabindex]:not([tabindex='-1'])"].join(", ");
+
/**
* An arrow that displays whether its node is expanded (▼) or collapsed
* (▶). When its node has no children, it is hidden.
@@ -4851,6 +4855,7 @@ class TreeNode extends Component {
index: _propTypes2.default.number.isRequired,
depth: _propTypes2.default.number.isRequired,
focused: _propTypes2.default.bool.isRequired,
+ active: _propTypes2.default.bool.isRequired,
expanded: _propTypes2.default.bool.isRequired,
item: _propTypes2.default.any.isRequired,
isExpandable: _propTypes2.default.bool.isRequired,
@@ -4859,16 +4864,95 @@ class TreeNode extends Component {
};
}
+ constructor(props) {
+ super(props);
+
+ this.treeNodeRef = _react2.default.createRef();
+
+ this._onKeyDown = this._onKeyDown.bind(this);
+ }
+
+ componentDidMount() {
+ // Make sure that none of the focusable elements inside the tree node
+ // container are tabbable if the tree node is not active. If the tree node
+ // is active and focus is outside its container, focus on the first
+ // focusable element inside.
+ const elms = this.getFocusableElements();
+ if (this.props.active) {
+ if (elms.length > 0 && !elms.includes(document.activeElement)) {
+ elms[0].focus();
+ }
+ } else {
+ elms.forEach(elm => elm.setAttribute("tabindex", "-1"));
+ }
+ }
+
shouldComponentUpdate(nextProps) {
return this.props.item !== nextProps.item || this.props.focused !== nextProps.focused || this.props.expanded !== nextProps.expanded;
}
+ /**
+ * Get a list of all elements that are focusable with a keyboard inside the
+ * tree node.
+ */
+ getFocusableElements() {
+ return this.treeNodeRef.current ? Array.from(this.treeNodeRef.current.querySelectorAll(FOCUSABLE_SELECTOR)) : [];
+ }
+
+ /**
+ * Wrap and move keyboard focus to first/last focusable element inside the
+ * tree node to prevent the focus from escaping the tree node boundaries.
+ * element).
+ *
+ * @param {DOMNode} current currently focused element
+ * @param {Boolean} back direction
+ * @return {Boolean} true there is a newly focused element.
+ */
+ _wrapMoveFocus(current, back) {
+ const elms = this.getFocusableElements();
+ let next;
+
+ if (elms.length === 0) {
+ return false;
+ }
+
+ if (back) {
+ if (elms.indexOf(current) === 0) {
+ next = elms[elms.length - 1];
+ next.focus();
+ }
+ } else if (elms.indexOf(current) === elms.length - 1) {
+ next = elms[0];
+ next.focus();
+ }
+
+ return !!next;
+ }
+
+ _onKeyDown(e) {
+ const { target, key, shiftKey } = e;
+
+ if (key !== "Tab") {
+ return;
+ }
+
+ const focusMoved = this._wrapMoveFocus(target, shiftKey);
+ if (focusMoved) {
+ // Focus was moved to the begining/end of the list, so we need to prevent
+ // the default focus change that would happen here.
+ e.preventDefault();
+ }
+
+ e.stopPropagation();
+ }
+
render() {
const {
depth,
id,
item,
focused,
+ active,
expanded,
renderItem,
isExpandable
@@ -4892,9 +4976,11 @@ class TreeNode extends Component {
return _reactDomFactories2.default.div({
id,
- className: `tree-node${focused ? " focused" : ""}`,
+ className: `tree-node${focused ? " focused" : ""}${active ? " active" : ""}`,
onClick: this.props.onClick,
+ onKeyDownCapture: active ? this._onKeyDown : null,
role: "treeitem",
+ ref: this.treeNodeRef,
"aria-level": depth + 1,
"aria-expanded": ariaExpanded,
"data-expandable": this.props.isExpandable
@@ -5128,6 +5214,8 @@ class Tree extends Component {
// onExpand: item => dispatchExpandActionToRedux(item)
onExpand: _propTypes2.default.func,
onCollapse: _propTypes2.default.func,
+ // The currently active (keyboard) item, if any such item exists.
+ active: _propTypes2.default.any,
// Optional event handler called with the current focused node when the
// Enter key is pressed. Can be useful to allow further keyboard actions
// within the tree node.
@@ -5156,6 +5244,8 @@ class Tree extends Component {
seen: new Set()
};
+ this.treeRef = _react2.default.createRef();
+
this._onExpand = oncePerAnimationFrame(this._onExpand).bind(this);
this._onCollapse = oncePerAnimationFrame(this._onCollapse).bind(this);
this._focusPrevNode = oncePerAnimationFrame(this._focusPrevNode).bind(this);
@@ -5166,22 +5256,21 @@ class Tree extends Component {
this._autoExpand = this._autoExpand.bind(this);
this._preventArrowKeyScrolling = this._preventArrowKeyScrolling.bind(this);
+ this._preventEvent = this._preventEvent.bind(this);
this._dfs = this._dfs.bind(this);
this._dfsFromRoots = this._dfsFromRoots.bind(this);
this._focus = this._focus.bind(this);
+ this._activate = this._activate.bind(this);
this._scrollNodeIntoView = this._scrollNodeIntoView.bind(this);
this._onBlur = this._onBlur.bind(this);
this._onKeyDown = this._onKeyDown.bind(this);
this._nodeIsExpandable = this._nodeIsExpandable.bind(this);
- this._activateNode = oncePerAnimationFrame(this._activateNode).bind(this);
}
componentDidMount() {
this._autoExpand();
if (this.props.focused) {
this._scrollNodeIntoView(this.props.focused);
- // Always keep the focus on the tree itself.
- this.treeRef.focus();
}
}
@@ -5192,8 +5281,6 @@ class Tree extends Component {
componentDidUpdate(prevProps, prevState) {
if (this.props.focused && prevProps.focused !== this.props.focused) {
this._scrollNodeIntoView(this.props.focused);
- // Always keep the focus on the tree itself.
- this.treeRef.focus();
}
}
@@ -5242,16 +5329,21 @@ class Tree extends Component {
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();
- }
- }
+ this._preventEvent(e);
+ break;
+ }
+ }
+
+ _preventEvent(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ if (e.nativeEvent) {
+ if (e.nativeEvent.preventDefault) {
+ e.nativeEvent.preventDefault();
+ }
+ if (e.nativeEvent.stopPropagation) {
+ e.nativeEvent.stopPropagation();
+ }
}
}
@@ -5343,11 +5435,31 @@ class Tree extends Component {
if (item && !preventAutoScroll) {
this._scrollNodeIntoView(item, options);
}
+
+ if (this.props.active != undefined) {
+ this._activate(undefined);
+ if (this.treeRef.current !== document.activeElement) {
+ this.treeRef.current.focus();
+ }
+ }
+
if (this.props.onFocus) {
this.props.onFocus(item);
}
}
+ /**
+ * Sets the passed in item to be the active item.
+ *
+ * @param {Object|undefined} item
+ * The item to be activated, or undefined to activate no item.
+ */
+ _activate(item) {
+ if (this.props.onActivate) {
+ this.props.onActivate(item);
+ }
+ }
+
/**
* Sets the passed in item to be the focused item.
*
@@ -5362,7 +5474,7 @@ class Tree extends Component {
*/
_scrollNodeIntoView(item, options = {}) {
if (item !== undefined) {
- const treeElement = this.treeRef;
+ const treeElement = this.treeRef.current;
const element = document.getElementById(this.props.getKey(item));
if (element) {
@@ -5393,8 +5505,13 @@ class Tree extends Component {
/**
* Sets the state to have no focused item.
*/
- _onBlur() {
- if (!this.props.preventBlur) {
+ _onBlur(e) {
+ if (this.props.active != undefined) {
+ const { relatedTarget } = e;
+ if (!this.treeRef.current.contains(relatedTarget)) {
+ this._activate(undefined);
+ }
+ } else if (!this.props.preventBlur) {
this._focus(undefined);
}
}
@@ -5404,6 +5521,7 @@ class Tree extends Component {
*
* @param {Event} e
*/
+ // eslint-disable-next-line complexity
_onKeyDown(e) {
if (this.props.focused == null) {
return;
@@ -5450,7 +5568,25 @@ class Tree extends Component {
return;
case "Enter":
- this._activateNode();
+ case " ":
+ if (this.treeRef.current === document.activeElement) {
+ this._preventEvent(e);
+ if (this.props.active !== this.props.focused) {
+ this._activate(this.props.focused);
+ }
+ }
+ return;
+
+ case "Escape":
+ this._preventEvent(e);
+ if (this.props.active != undefined) {
+ this._activate(undefined);
+ }
+
+ if (this.treeRef.current !== document.activeElement) {
+ this.treeRef.current.focus();
+ }
+ return;
}
}
@@ -5529,31 +5665,29 @@ class Tree extends Component {
this._focus(traversal[lastIndex].item, { alignTo: "bottom" });
}
- _activateNode() {
- if (this.props.onActivate) {
- this.props.onActivate(this.props.focused);
- }
- }
-
_nodeIsExpandable(item) {
return this.props.isExpandable ? this.props.isExpandable(item) : !!this.props.getChildren(item).length;
}
render() {
const traversal = this._dfsFromRoots();
- const { focused } = this.props;
+ const { active, focused } = this.props;
const nodes = traversal.map((v, i) => {
const { item, depth } = traversal[i];
const key = this.props.getKey(item, i);
return TreeNodeFactory({
- key,
+ // We make a key unique depending on whether the tree node is in active
+ // or inactive state to make sure that it is actually replaced and the
+ // tabbable state is reset.
+ key: `${key}-${active === item ? "active" : "inactive"}`,
id: key,
index: i,
item,
depth,
renderItem: this.props.renderItem,
focused: focused === item,
+ active: active === item,
expanded: this.props.isExpanded(item),
isExpandable: this._nodeIsExpandable(item),
onExpand: this._onExpand,
@@ -5571,6 +5705,9 @@ class Tree extends Component {
} else {
this.props.onExpand(item, e.altKey);
}
+
+ // Focus should always remain on the tree container itself.
+ this.treeRef.current.focus();
}
});
});
@@ -5579,16 +5716,14 @@ class Tree extends Component {
return _reactDomFactories2.default.div({
className: `tree ${this.props.className ? this.props.className : ""}`,
- ref: el => {
- this.treeRef = el;
- },
+ ref: this.treeRef,
role: "tree",
tabIndex: "0",
onKeyDown: this._onKeyDown,
onKeyPress: this._preventArrowKeyScrolling,
onKeyUp: this._preventArrowKeyScrolling,
onFocus: ({ nativeEvent }) => {
- if (focused || !nativeEvent || !this.treeRef) {
+ if (focused || !nativeEvent || !this.treeRef.current) {
return;
}
@@ -5596,7 +5731,7 @@ class Tree extends Component {
// Only set default focus to the first tree node if the focus came
// from outside the tree (e.g. by tabbing to the tree from other
// external elements).
- if (explicitOriginalTarget !== this.treeRef && !this.treeRef.contains(explicitOriginalTarget)) {
+ if (explicitOriginalTarget !== this.treeRef.current && !this.treeRef.current.contains(explicitOriginalTarget)) {
this._focus(traversal[0].item);
}
},
@@ -7565,14 +7700,14 @@ module.exports = Svg;
/***/ 3843:
/***/ (function(module, exports) {
-module.exports = ""
+module.exports = ""
/***/ }),
/***/ 3844:
/***/ (function(module, exports) {
-module.exports = ""
+module.exports = ""
/***/ }),
diff --git a/devtools/client/debugger/new/images/arrow.svg b/devtools/client/debugger/new/images/arrow.svg
index d10640814c392..d1217f2dd2fe4 100644
--- a/devtools/client/debugger/new/images/arrow.svg
+++ b/devtools/client/debugger/new/images/arrow.svg
@@ -1,6 +1,6 @@
-