mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-01 04:47:31 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
1b0e373028
5 changed files with 3 additions and 157 deletions
|
|
@ -1,45 +0,0 @@
|
||||||
/* Copyright 2013 Mozilla Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
/* jshint esnext:true, maxlen: 100 */
|
|
||||||
/* globals Components, Services */
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
this.EXPORTED_SYMBOLS = ['PdfJsTelemetry'];
|
|
||||||
|
|
||||||
this.PdfJsTelemetry = {
|
|
||||||
onViewerIsUsed: function () {
|
|
||||||
},
|
|
||||||
onFallback: function () {
|
|
||||||
},
|
|
||||||
onDocumentSize: function (size) {
|
|
||||||
},
|
|
||||||
onDocumentVersion: function (versionId) {
|
|
||||||
},
|
|
||||||
onDocumentGenerator: function (generatorId) {
|
|
||||||
},
|
|
||||||
onEmbed: function (isObject) {
|
|
||||||
},
|
|
||||||
onFontType: function (fontTypeId) {
|
|
||||||
},
|
|
||||||
onForm: function (isAcroform) {
|
|
||||||
},
|
|
||||||
onPrint: function () {
|
|
||||||
},
|
|
||||||
onStreamType: function (streamTypeId) {
|
|
||||||
},
|
|
||||||
onTimeToView: function (ms) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
/* jshint esnext:true */
|
/* jshint esnext:true */
|
||||||
/* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils,
|
/* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils,
|
||||||
dump, NetworkManager, PdfJsTelemetry, PdfjsContentUtils */
|
dump, NetworkManager, PdfjsContentUtils */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
@ -44,9 +44,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'NetworkManager',
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, 'PrivateBrowsingUtils',
|
XPCOMUtils.defineLazyModuleGetter(this, 'PrivateBrowsingUtils',
|
||||||
'resource://gre/modules/PrivateBrowsingUtils.jsm');
|
'resource://gre/modules/PrivateBrowsingUtils.jsm');
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, 'PdfJsTelemetry',
|
|
||||||
'resource://pdf.js/PdfJsTelemetry.jsm');
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
|
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
|
||||||
'resource://pdf.js/PdfjsContentUtils.jsm');
|
'resource://pdf.js/PdfjsContentUtils.jsm');
|
||||||
|
|
||||||
|
|
@ -214,13 +211,6 @@ PdfDataListener.prototype = {
|
||||||
function ChromeActions(domWindow, contentDispositionFilename) {
|
function ChromeActions(domWindow, contentDispositionFilename) {
|
||||||
this.domWindow = domWindow;
|
this.domWindow = domWindow;
|
||||||
this.contentDispositionFilename = contentDispositionFilename;
|
this.contentDispositionFilename = contentDispositionFilename;
|
||||||
this.telemetryState = {
|
|
||||||
documentInfo: false,
|
|
||||||
firstPageInfo: false,
|
|
||||||
streamTypesUsed: [],
|
|
||||||
fontTypesUsed: [],
|
|
||||||
startAt: Date.now()
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChromeActions.prototype = {
|
ChromeActions.prototype = {
|
||||||
|
|
@ -356,62 +346,6 @@ ChromeActions.prototype = {
|
||||||
metaKey: Services.prefs.getIntPref('mousewheel.with_meta.action', 1) === 3,
|
metaKey: Services.prefs.getIntPref('mousewheel.with_meta.action', 1) === 3,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
reportTelemetry: function (data) {
|
|
||||||
var probeInfo = JSON.parse(data);
|
|
||||||
switch (probeInfo.type) {
|
|
||||||
case 'documentInfo':
|
|
||||||
if (!this.telemetryState.documentInfo) {
|
|
||||||
PdfJsTelemetry.onDocumentVersion(probeInfo.version | 0);
|
|
||||||
PdfJsTelemetry.onDocumentGenerator(probeInfo.generator | 0);
|
|
||||||
if (probeInfo.formType) {
|
|
||||||
PdfJsTelemetry.onForm(probeInfo.formType === 'acroform');
|
|
||||||
}
|
|
||||||
this.telemetryState.documentInfo = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'pageInfo':
|
|
||||||
if (!this.telemetryState.firstPageInfo) {
|
|
||||||
var duration = Date.now() - this.telemetryState.startAt;
|
|
||||||
PdfJsTelemetry.onTimeToView(duration);
|
|
||||||
this.telemetryState.firstPageInfo = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'documentStats':
|
|
||||||
// documentStats can be called several times for one documents.
|
|
||||||
// if stream/font types are reported, trying not to submit the same
|
|
||||||
// enumeration value multiple times.
|
|
||||||
var documentStats = probeInfo.stats;
|
|
||||||
if (!documentStats || typeof documentStats !== 'object') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
var i, streamTypes = documentStats.streamTypes;
|
|
||||||
if (Array.isArray(streamTypes)) {
|
|
||||||
var STREAM_TYPE_ID_LIMIT = 20;
|
|
||||||
for (i = 0; i < STREAM_TYPE_ID_LIMIT; i++) {
|
|
||||||
if (streamTypes[i] &&
|
|
||||||
!this.telemetryState.streamTypesUsed[i]) {
|
|
||||||
PdfJsTelemetry.onStreamType(i);
|
|
||||||
this.telemetryState.streamTypesUsed[i] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var fontTypes = documentStats.fontTypes;
|
|
||||||
if (Array.isArray(fontTypes)) {
|
|
||||||
var FONT_TYPE_ID_LIMIT = 20;
|
|
||||||
for (i = 0; i < FONT_TYPE_ID_LIMIT; i++) {
|
|
||||||
if (fontTypes[i] &&
|
|
||||||
!this.telemetryState.fontTypesUsed[i]) {
|
|
||||||
PdfJsTelemetry.onFontType(i);
|
|
||||||
this.telemetryState.fontTypesUsed[i] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'print':
|
|
||||||
PdfJsTelemetry.onPrint();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fallback: function(args, sendResponse) {
|
fallback: function(args, sendResponse) {
|
||||||
var featureId = args.featureId;
|
var featureId = args.featureId;
|
||||||
var url = args.url;
|
var url = args.url;
|
||||||
|
|
@ -425,7 +359,6 @@ ChromeActions.prototype = {
|
||||||
} else {
|
} else {
|
||||||
message = getLocalizedString(strings, 'unsupported_feature');
|
message = getLocalizedString(strings, 'unsupported_feature');
|
||||||
}
|
}
|
||||||
PdfJsTelemetry.onFallback();
|
|
||||||
PdfjsContentUtils.displayWarning(domWindow, message,
|
PdfjsContentUtils.displayWarning(domWindow, message,
|
||||||
getLocalizedString(strings, 'open_with_different_viewer'),
|
getLocalizedString(strings, 'open_with_different_viewer'),
|
||||||
getLocalizedString(strings, 'open_with_different_viewer', 'accessKey'));
|
getLocalizedString(strings, 'open_with_different_viewer', 'accessKey'));
|
||||||
|
|
@ -940,9 +873,6 @@ PdfStreamConverter.prototype = {
|
||||||
aRequest.setResponseHeader('Refresh', '', false);
|
aRequest.setResponseHeader('Refresh', '', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
PdfJsTelemetry.onViewerIsUsed();
|
|
||||||
PdfJsTelemetry.onDocumentSize(aRequest.contentLength);
|
|
||||||
|
|
||||||
// Creating storage for PDF data
|
// Creating storage for PDF data
|
||||||
var contentLength = aRequest.contentLength;
|
var contentLength = aRequest.contentLength;
|
||||||
this.dataListener = new PdfDataListener(contentLength);
|
this.dataListener = new PdfDataListener(contentLength);
|
||||||
|
|
@ -996,7 +926,6 @@ PdfStreamConverter.prototype = {
|
||||||
if (domWindow.frameElement) {
|
if (domWindow.frameElement) {
|
||||||
var isObjectEmbed = domWindow.frameElement.tagName !== 'IFRAME' ||
|
var isObjectEmbed = domWindow.frameElement.tagName !== 'IFRAME' ||
|
||||||
domWindow.frameElement.className === 'previewPluginContentFrame';
|
domWindow.frameElement.className === 'previewPluginContentFrame';
|
||||||
PdfJsTelemetry.onEmbed(isObjectEmbed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6494,8 +6494,6 @@ var pdfjsWebLibs;
|
||||||
},
|
},
|
||||||
fallback: function (data, callback) {
|
fallback: function (data, callback) {
|
||||||
},
|
},
|
||||||
reportTelemetry: function (data) {
|
|
||||||
},
|
|
||||||
createDownloadManager: function () {
|
createDownloadManager: function () {
|
||||||
return new downloadManagerLib.DownloadManager();
|
return new downloadManagerLib.DownloadManager();
|
||||||
},
|
},
|
||||||
|
|
@ -7259,12 +7257,6 @@ var pdfjsWebLibs;
|
||||||
}.bind(null, info.Producer.toLowerCase()));
|
}.bind(null, info.Producer.toLowerCase()));
|
||||||
}
|
}
|
||||||
var formType = !info.IsAcroFormPresent ? null : info.IsXFAPresent ? 'xfa' : 'acroform';
|
var formType = !info.IsAcroFormPresent ? null : info.IsXFAPresent ? 'xfa' : 'acroform';
|
||||||
self.externalServices.reportTelemetry({
|
|
||||||
type: 'documentInfo',
|
|
||||||
version: versionId,
|
|
||||||
generator: generatorId,
|
|
||||||
formType: formType
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setInitialView: function pdfViewSetInitialView(storedHash, options) {
|
setInitialView: function pdfViewSetInitialView(storedHash, options) {
|
||||||
|
|
@ -7330,7 +7322,6 @@ var pdfjsWebLibs;
|
||||||
this.printService = printService;
|
this.printService = printService;
|
||||||
this.forceRendering();
|
this.forceRendering();
|
||||||
printService.layout();
|
printService.layout();
|
||||||
this.externalServices.reportTelemetry({ type: 'print' });
|
|
||||||
},
|
},
|
||||||
// Whether all pages of the PDF have the same width and height.
|
// Whether all pages of the PDF have the same width and height.
|
||||||
get hasEqualPageSizes() {
|
get hasEqualPageSizes() {
|
||||||
|
|
@ -7640,14 +7631,6 @@ var pdfjsWebLibs;
|
||||||
if (pageView.error) {
|
if (pageView.error) {
|
||||||
PDFViewerApplication.error(mozL10n.get('rendering_error', null, 'An error occurred while rendering the page.'), pageView.error);
|
PDFViewerApplication.error(mozL10n.get('rendering_error', null, 'An error occurred while rendering the page.'), pageView.error);
|
||||||
}
|
}
|
||||||
PDFViewerApplication.externalServices.reportTelemetry({ type: 'pageInfo' });
|
|
||||||
// It is a good time to report stream and font types.
|
|
||||||
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
|
|
||||||
PDFViewerApplication.externalServices.reportTelemetry({
|
|
||||||
type: 'documentStats',
|
|
||||||
stats: stats
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function webViewerTextLayerRendered(e) {
|
function webViewerTextLayerRendered(e) {
|
||||||
if (e.numTextDivs > 0 && !PDFViewerApplication.supportsDocumentColors) {
|
if (e.numTextDivs > 0 && !PDFViewerApplication.supportsDocumentColors) {
|
||||||
|
|
@ -8507,9 +8490,6 @@ var pdfjsWebLibs;
|
||||||
fallback: function (data, callback) {
|
fallback: function (data, callback) {
|
||||||
FirefoxCom.request('fallback', data, callback);
|
FirefoxCom.request('fallback', data, callback);
|
||||||
},
|
},
|
||||||
reportTelemetry: function (data) {
|
|
||||||
FirefoxCom.request('reportTelemetry', JSON.stringify(data));
|
|
||||||
},
|
|
||||||
createDownloadManager: function () {
|
createDownloadManager: function () {
|
||||||
return new DownloadManager();
|
return new DownloadManager();
|
||||||
},
|
},
|
||||||
|
|
@ -8668,4 +8648,4 @@ function webViewerLoad() {
|
||||||
window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
|
window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
|
||||||
pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run(config);
|
pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run(config);
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', webViewerLoad, true);
|
document.addEventListener('DOMContentLoaded', webViewerLoad, true);
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ toolbar:-moz-lwtheme {
|
||||||
#navigator-toolbox {
|
#navigator-toolbox {
|
||||||
/* Override the global style for Windows 10 that adds a bottom border */
|
/* Override the global style for Windows 10 that adds a bottom border */
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#navigator-toolbox::after {
|
#navigator-toolbox::after {
|
||||||
|
|
|
||||||
|
|
@ -1267,24 +1267,6 @@ var gBrowserInit = {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
let appMenuButton = document.getElementById("appmenu-button");
|
|
||||||
let appMenuPopup = document.getElementById("appmenu-popup");
|
|
||||||
if (appMenuButton && appMenuPopup) {
|
|
||||||
let appMenuOpening = null;
|
|
||||||
appMenuButton.addEventListener("mousedown", function(event) {
|
|
||||||
if (event.button == 0) {
|
|
||||||
appMenuOpening = new Date();
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
appMenuPopup.addEventListener("popupshown", function(event) {
|
|
||||||
if (event.target != appMenuPopup || !appMenuOpening) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let duration = new Date() - appMenuOpening;
|
|
||||||
appMenuOpening = null;
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("mousemove", MousePosTracker, false);
|
window.addEventListener("mousemove", MousePosTracker, false);
|
||||||
window.addEventListener("dragover", MousePosTracker, false);
|
window.addEventListener("dragover", MousePosTracker, false);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue