Merge mozilla-inbound to mozilla-central. a=merge
authorDaniel Varga <dvarga@mozilla.com>
Mon, 08 Apr 2019 19:17:24 +0300
changeset 468349 0e564383758ab26265058ae635dba9e80eb63a27
parent 468346 50ce9167f1cef3991f352258dab7bf784443c43e (current diff)
parent 468348 0ffc8e3349d70b567d709517d589e035b64ea1c8 (diff)
child 468376 45f4b01dee1ab5d451eda76070b98030272dd3dd
child 468480 8a568333a0b5ee923e86a416c3f58d83547afd71
push id35834
push userdvarga@mozilla.com
push dateMon, 08 Apr 2019 16:17:50 +0000
treeherdermozilla-central@0e564383758a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-inbound to mozilla-central. a=merge
extensions/universalchardet/src/base/nsLatin1Prober.cpp
extensions/universalchardet/src/base/nsLatin1Prober.h
extensions/universalchardet/tests/bug421271_text.html
extensions/universalchardet/tests/bug811363-invalid-2.text
extensions/universalchardet/tests/bug811363-invalid-3.text
extensions/universalchardet/tests/bug811363-invalid-4.text
extensions/universalchardet/tests/test_bug421271.html
extensions/universalchardet/tests/test_bug811363-1-2.html
extensions/universalchardet/tests/test_bug811363-1-3.html
extensions/universalchardet/tests/test_bug811363-1-4.html
--- 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.2.117
+Current extension version is: 2.2.129
 
-Taken from upstream commit: 57abddc9
+Taken from upstream commit: 725a6959
--- a/browser/extensions/pdfjs/content/build/pdf.js
+++ b/browser/extensions/pdfjs/content/build/pdf.js
@@ -118,18 +118,18 @@ return /******/ (function(modules) { // 
 /************************************************************************/
 /******/ ([
 /* 0 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
-var pdfjsVersion = '2.2.117';
-var pdfjsBuild = '57abddc9';
+var pdfjsVersion = '2.2.129';
+var pdfjsBuild = '725a6959';
 
 var pdfjsSharedUtil = __w_pdfjs_require__(1);
 
 var pdfjsDisplayAPI = __w_pdfjs_require__(6);
 
 var pdfjsDisplayTextLayer = __w_pdfjs_require__(18);
 
 var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(19);
@@ -1298,17 +1298,17 @@ function _fetchDocument(worker, source, 
   if (pdfDataRangeTransport) {
     source.length = pdfDataRangeTransport.length;
     source.initialData = pdfDataRangeTransport.initialData;
     source.progressiveDone = pdfDataRangeTransport.progressiveDone;
   }
 
   return worker.messageHandler.sendWithPromise('GetDocRequest', {
     docId,
-    apiVersion: '2.2.117',
+    apiVersion: '2.2.129',
     source: {
       data: source.data,
       url: source.url,
       password: source.password,
       disableAutoFetch: source.disableAutoFetch,
       rangeChunkSize: source.rangeChunkSize,
       length: source.length
     },
@@ -1401,20 +1401,20 @@ class PDFDataRangeTransport {
   }
 
   onDataRange(begin, chunk) {
     for (const listener of this._rangeListeners) {
       listener(begin, chunk);
     }
   }
 
-  onDataProgress(loaded) {
+  onDataProgress(loaded, total) {
     this._readyCapability.promise.then(() => {
       for (const listener of this._progressListeners) {
-        listener(loaded);
+        listener(loaded, total);
       }
     });
   }
 
   onDataProgressiveRead(chunk) {
     this._readyCapability.promise.then(() => {
       for (const listener of this._progressiveReadListeners) {
         listener(chunk);
@@ -1473,16 +1473,20 @@ class PDFDocumentProxy {
   getDestination(id) {
     return this._transport.getDestination(id);
   }
 
   getPageLabels() {
     return this._transport.getPageLabels();
   }
 
+  getPageLayout() {
+    return this._transport.getPageLayout();
+  }
+
   getPageMode() {
     return this._transport.getPageMode();
   }
 
   getOpenActionDestination() {
     return this._transport.getOpenActionDestination();
   }
 
@@ -2756,16 +2760,20 @@ class WorkerTransport {
       id
     });
   }
 
   getPageLabels() {
     return this.messageHandler.sendWithPromise('GetPageLabels', null);
   }
 
+  getPageLayout() {
+    return this.messageHandler.sendWithPromise('GetPageLayout', null);
+  }
+
   getPageMode() {
     return this.messageHandler.sendWithPromise('GetPageMode', null);
   }
 
   getOpenActionDestination() {
     return this.messageHandler.sendWithPromise('getOpenActionDestination', null);
   }
 
@@ -3070,19 +3078,19 @@ const InternalRenderTask = function Inte
       }
     }
 
   }
 
   return InternalRenderTask;
 }();
 
-const version = '2.2.117';
+const version = '2.2.129';
 exports.version = version;
-const build = '57abddc9';
+const build = '725a6959';
 exports.build = build;
 
 /***/ }),
 /* 7 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
@@ -4586,18 +4594,21 @@ var CanvasGraphics = function CanvasGrap
     setDash: function CanvasGraphics_setDash(dashArray, dashPhase) {
       var ctx = this.ctx;
 
       if (ctx.setLineDash !== undefined) {
         ctx.setLineDash(dashArray);
         ctx.lineDashOffset = dashPhase;
       }
     },
-    setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {},
-    setFlatness: function CanvasGraphics_setFlatness(flatness) {},
+
+    setRenderingIntent(intent) {},
+
+    setFlatness(flatness) {},
+
     setGState: function CanvasGraphics_setGState(states) {
       for (var i = 0, ii = states.length; i < ii; i++) {
         var state = states[i];
         var key = state[0];
         var value = state[1];
 
         switch (key) {
           case 'LW':
@@ -7332,19 +7343,20 @@ var PDFDataTransportStream = function PD
 
     this._pdfDataRangeTransport.addRangeListener((begin, chunk) => {
       this._onReceiveData({
         begin,
         chunk
       });
     });
 
-    this._pdfDataRangeTransport.addProgressListener(loaded => {
+    this._pdfDataRangeTransport.addProgressListener((loaded, total) => {
       this._onProgress({
-        loaded
+        loaded,
+        total
       });
     });
 
     this._pdfDataRangeTransport.addProgressiveReadListener(chunk => {
       this._onReceiveData({
         chunk
       });
     });
@@ -7376,25 +7388,35 @@ var PDFDataTransportStream = function PD
 
           return true;
         });
 
         (0, _util.assert)(found);
       }
     },
     _onProgress: function PDFDataTransportStream_onDataProgress(evt) {
-      if (this._rangeReaders.length > 0) {
+      if (evt.total === undefined && this._rangeReaders.length > 0) {
         var firstReader = this._rangeReaders[0];
 
         if (firstReader.onProgress) {
           firstReader.onProgress({
             loaded: evt.loaded
           });
+          return;
         }
       }
+
+      let fullReader = this._fullRequestReader;
+
+      if (fullReader && fullReader.onProgress) {
+        fullReader.onProgress({
+          loaded: evt.loaded,
+          total: evt.total
+        });
+      }
     },
 
     _onProgressiveDone() {
       if (this._fullRequestReader) {
         this._fullRequestReader.progressiveDone();
       }
 
       this._progressiveDone = true;
@@ -9725,17 +9747,17 @@ exports.SVGGraphics = void 0;
 var _util = __w_pdfjs_require__(1);
 
 var _display_utils = __w_pdfjs_require__(7);
 
 var _is_node = _interopRequireDefault(__w_pdfjs_require__(21));
 
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
-var SVGGraphics = function () {
+let SVGGraphics = function () {
   throw new Error('Not implemented: SVGGraphics');
 };
 
 exports.SVGGraphics = SVGGraphics;
 ;
 
 /***/ }),
 /* 21 */
--- a/browser/extensions/pdfjs/content/build/pdf.worker.js
+++ b/browser/extensions/pdfjs/content/build/pdf.worker.js
@@ -118,18 +118,18 @@ return /******/ (function(modules) { // 
 /************************************************************************/
 /******/ ([
 /* 0 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
 
 "use strict";
 
 
-const pdfjsVersion = '2.2.117';
-const pdfjsBuild = '57abddc9';
+const pdfjsVersion = '2.2.129';
+const pdfjsBuild = '725a6959';
 
 const pdfjsCoreWorker = __w_pdfjs_require__(1);
 
 exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
 
 /***/ }),
 /* 1 */
 /***/ (function(module, exports, __w_pdfjs_require__) {
@@ -373,17 +373,17 @@ var WorkerMessageHandler = {
 
   createDocumentHandler(docParams, port) {
     var pdfManager;
     var terminated = false;
     var cancelXHRs = null;
     var WorkerTasks = [];
     const verbosity = (0, _util.getVerbosityLevel)();
     let apiVersion = docParams.apiVersion;
-    let workerVersion = '2.2.117';
+    let workerVersion = '2.2.129';
 
     if (apiVersion !== workerVersion) {
       throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
     }
 
     var docId = docParams.docId;
     var docBaseUrl = docParams.docBaseUrl;
     var workerHandlerName = docParams.docId + '_worker';
@@ -639,16 +639,19 @@ var WorkerMessageHandler = {
       return pdfManager.ensureCatalog('destinations');
     });
     handler.on('GetDestination', function wphSetupGetDestination(data) {
       return pdfManager.ensureCatalog('getDestination', [data.id]);
     });
     handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
       return pdfManager.ensureCatalog('pageLabels');
     });
+    handler.on('GetPageLayout', function wphSetupGetPageLayout(data) {
+      return pdfManager.ensureCatalog('pageLayout');
+    });
     handler.on('GetPageMode', function wphSetupGetPageMode(data) {
       return pdfManager.ensureCatalog('pageMode');
     });
     handler.on('getOpenActionDestination', function (data) {
       return pdfManager.ensureCatalog('openActionDestination');
     });
     handler.on('GetAttachments', function wphSetupGetAttachments(data) {
       return pdfManager.ensureCatalog('attachments');
@@ -3742,16 +3745,35 @@ class Catalog {
 
       pageLabels[i] = prefix + currentLabel;
       currentIndex++;
     }
 
     return pageLabels;
   }
 
+  get pageLayout() {
+    const obj = this.catDict.get('PageLayout');
+    let pageLayout = '';
+
+    if ((0, _primitives.isName)(obj)) {
+      switch (obj.name) {
+        case 'SinglePage':
+        case 'OneColumn':
+        case 'TwoColumnLeft':
+        case 'TwoColumnRight':
+        case 'TwoPageLeft':
+        case 'TwoPageRight':
+          pageLayout = obj.name;
+      }
+    }
+
+    return (0, _util.shadow)(this, 'pageLayout', pageLayout);
+  }
+
   get pageMode() {
     const obj = this.catDict.get('PageMode');
     let pageMode = 'UseNone';
 
     if ((0, _primitives.isName)(obj)) {
       switch (obj.name) {
         case 'UseNone':
         case 'UseOutlines':
--- a/browser/extensions/pdfjs/content/web/viewer.js
+++ b/browser/extensions/pdfjs/content/web/viewer.js
@@ -1012,16 +1012,17 @@ let PDFViewerApplication = {
       this.downloadComplete = true;
       this.loadingBar.hide();
       firstPagePromise.then(() => {
         this.eventBus.dispatch('documentloaded', {
           source: this
         });
       });
     });
+    const pageLayoutPromise = pdfDocument.getPageLayout().catch(function () {});
     const pageModePromise = pdfDocument.getPageMode().catch(function () {});
     const openActionDestPromise = pdfDocument.getOpenActionDestination().catch(function () {});
     this.toolbar.setPagesCount(pdfDocument.numPages, false);
     this.secondaryToolbar.setPagesCount(pdfDocument.numPages);
     const store = this.store = new _view_history.ViewHistory(pdfDocument.fingerprint);
     let baseDocumentUrl;
     baseDocumentUrl = this.baseUrl;
     this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl);
@@ -1040,17 +1041,17 @@ let PDFViewerApplication = {
         zoom: _ui_utils.DEFAULT_SCALE_VALUE,
         scrollLeft: '0',
         scrollTop: '0',
         rotation: null,
         sidebarView: _pdf_sidebar.SidebarView.UNKNOWN,
         scrollMode: _ui_utils.ScrollMode.UNKNOWN,
         spreadMode: _ui_utils.SpreadMode.UNKNOWN
       }).catch(() => {});
-      Promise.all([storePromise, pageModePromise, openActionDestPromise]).then(async ([values = {}, pageMode, openActionDest]) => {
+      Promise.all([storePromise, pageLayoutPromise, pageModePromise, openActionDestPromise]).then(async ([values = {}, pageLayout, pageMode, openActionDest]) => {
         const viewOnLoad = _app_options.AppOptions.get('viewOnLoad');
 
         this._initializePdfHistory({
           fingerprint: pdfDocument.fingerprint,
           viewOnLoad,
           initialDest: openActionDest
         });
 
@@ -1083,16 +1084,20 @@ let PDFViewerApplication = {
             spreadMode = values.spreadMode | 0;
           }
         }
 
         if (pageMode && sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) {
           sidebarView = apiPageModeToSidebarView(pageMode);
         }
 
+        if (pageLayout && spreadMode === _ui_utils.SpreadMode.UNKNOWN) {
+          spreadMode = apiPageLayoutToSpreadMode(pageLayout);
+        }
+
         this.setInitialView(hash, {
           rotation,
           sidebarView,
           scrollMode,
           spreadMode
         });
         this.eventBus.dispatch('documentinit', {
           source: this
@@ -2335,16 +2340,34 @@ function webViewerKeyDown(evt) {
     pdfViewer.focus();
   }
 
   if (handled) {
     evt.preventDefault();
   }
 }
 
+function apiPageLayoutToSpreadMode(layout) {
+  switch (layout) {
+    case 'SinglePage':
+    case 'OneColumn':
+      return _ui_utils.SpreadMode.NONE;
+
+    case 'TwoColumnLeft':
+    case 'TwoPageLeft':
+      return _ui_utils.SpreadMode.ODD;
+
+    case 'TwoColumnRight':
+    case 'TwoPageRight':
+      return _ui_utils.SpreadMode.EVEN;
+  }
+
+  return _ui_utils.SpreadMode.NONE;
+}
+
 function apiPageModeToSidebarView(mode) {
   switch (mode) {
     case 'UseNone':
       return _pdf_sidebar.SidebarView.NONE;
 
     case 'UseThumbs':
       return _pdf_sidebar.SidebarView.THUMBS;
 
@@ -11400,16 +11423,17 @@ class FirefoxComDataRangeTransport exten
           break;
 
         case 'rangeProgress':
           pdfDataRangeTransport.onDataProgress(args.loaded);
           break;
 
         case 'progressiveRead':
           pdfDataRangeTransport.onDataProgressiveRead(args.chunk);
+          pdfDataRangeTransport.onDataProgress(args.loaded, args.total);
           break;
 
         case 'progressiveDone':
           if (pdfDataRangeTransport) {
             pdfDataRangeTransport.onDataProgressiveDone();
           }
 
           break;
--- a/browser/extensions/pdfjs/moz.yaml
+++ b/browser/extensions/pdfjs/moz.yaml
@@ -15,15 +15,15 @@ origin:
   description: Portable Document Format (PDF) viewer that is built with HTML5
 
   # Full URL for the package's homepage/etc
   # Usually different from repository url
   url: https://github.com/mozilla/pdf.js
 
   # Human-readable identifier for this version/release
   # Generally "version NNN", "tag SSS", "bookmark SSS"
-  release: version 2.2.117
+  release: version 2.2.129
 
   # The package's license, where possible using the mnemonic from
   # https://spdx.org/licenses/
   # Multiple licenses can be specified (as a YAML list)
   # A "LICENSE" file must exist containing the full license text
   license: Apache-2.0
--- a/extensions/universalchardet/src/base/moz.build
+++ b/extensions/universalchardet/src/base/moz.build
@@ -6,17 +6,16 @@
 
 UNIFIED_SOURCES += [
     'CharDistribution.cpp',
     'JpCntx.cpp',
     'nsCharSetProber.cpp',
     'nsEscCharsetProber.cpp',
     'nsEscSM.cpp',
     'nsEUCJPProber.cpp',
-    'nsLatin1Prober.cpp',
     'nsMBCSGroupProber.cpp',
     'nsMBCSSM.cpp',
     'nsSJISProber.cpp',
     'nsUniversalDetector.cpp',
     'nsUTF8Prober.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/extensions/universalchardet/src/base/nsLatin1Prober.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsLatin1Prober.h"
-#include <stdio.h>
-
-#define UDF 0        // undefined
-#define OTH 1        // other
-#define ASC 2        // ascii capital letter
-#define ASS 3        // ascii small letter
-#define ACV 4        // accent capital vowel
-#define ACO 5        // accent capital other
-#define ASV 6        // accent small vowel
-#define ASO 7        // accent small other
-#define CLASS_NUM 8  // total classes
-
-static const unsigned char Latin1_CharToClass[] = {
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 00 - 07
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 08 - 0F
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 10 - 17
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 18 - 1F
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 20 - 27
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 28 - 2F
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 30 - 37
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 38 - 3F
-    OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC,  // 40 - 47
-    ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC,  // 48 - 4F
-    ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC,  // 50 - 57
-    ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH,  // 58 - 5F
-    OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS,  // 60 - 67
-    ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS,  // 68 - 6F
-    ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS,  // 70 - 77
-    ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH,  // 78 - 7F
-    OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH,  // 80 - 87
-    OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF,  // 88 - 8F
-    UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // 90 - 97
-    OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO,  // 98 - 9F
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // A0 - A7
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // A8 - AF
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // B0 - B7
-    OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH,  // B8 - BF
-    ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO,  // C0 - C7
-    ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV,  // C8 - CF
-    ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH,  // D0 - D7
-    ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO,  // D8 - DF
-    ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO,  // E0 - E7
-    ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV,  // E8 - EF
-    ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH,  // F0 - F7
-    ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO,  // F8 - FF
-};
-
-/* 0 : illegal
-   1 : very unlikely
-   2 : normal
-   3 : very likely
-*/
-static const unsigned char Latin1ClassModel[] = {
-    /*      UDF OTH ASC ASS ACV ACO ASV ASO  */
-    /*UDF*/ 0, 0, 0, 0, 0, 0, 0, 0,
-    /*OTH*/ 0, 3, 3, 3, 3, 3, 3, 3,
-    /*ASC*/ 0, 3, 3, 3, 3, 3, 3, 3,
-    /*ASS*/ 0, 3, 3, 3, 1, 1, 3, 3,
-    /*ACV*/ 0, 3, 3, 3, 1, 2, 1, 2,
-    /*ACO*/ 0, 3, 3, 3, 3, 3, 3, 3,
-    /*ASV*/ 0, 3, 1, 3, 1, 1, 1, 3,
-    /*ASO*/ 0, 3, 1, 3, 1, 1, 3, 3,
-};
-
-void nsLatin1Prober::Reset(void) {
-  mState = eDetecting;
-  mLastCharClass = OTH;
-  for (int i = 0; i < FREQ_CAT_NUM; i++) mFreqCounter[i] = 0;
-}
-
-nsProbingState nsLatin1Prober::HandleData(const char* aBuf, uint32_t aLen) {
-  char* newBuf1 = 0;
-  uint32_t newLen1 = 0;
-
-  if (!FilterWithEnglishLetters(aBuf, aLen, &newBuf1, newLen1)) {
-    newBuf1 = (char*)aBuf;
-    newLen1 = aLen;
-  }
-
-  unsigned char charClass;
-  unsigned char freq;
-  for (uint32_t i = 0; i < newLen1; i++) {
-    charClass = Latin1_CharToClass[(unsigned char)newBuf1[i]];
-    freq = Latin1ClassModel[mLastCharClass * CLASS_NUM + charClass];
-    if (freq == 0) {
-      mState = eNotMe;
-      break;
-    }
-    mFreqCounter[freq]++;
-    mLastCharClass = charClass;
-  }
-
-  if (newBuf1 != aBuf) free(newBuf1);
-
-  return mState;
-}
-
-float nsLatin1Prober::GetConfidence(void) {
-  if (mState == eNotMe) return 0.01f;
-
-  float confidence;
-  uint32_t total = 0;
-  for (int32_t i = 0; i < FREQ_CAT_NUM; i++) total += mFreqCounter[i];
-
-  if (!total)
-    confidence = 0.0f;
-  else {
-    confidence = mFreqCounter[3] * 1.0f / total;
-    confidence -= mFreqCounter[1] * 20.0f / total;
-  }
-
-  if (confidence < 0.0f) confidence = 0.0f;
-
-  // lower the confidence of latin1 so that other more accurate detector
-  // can take priority.
-  confidence *= 0.50f;
-
-  return confidence;
-}
-
-#ifdef DEBUG_chardet
-void nsLatin1Prober::DumpStatus() {
-  printf(" Latin1Prober: %1.3f [%s]\r\n", GetConfidence(), GetCharSetName());
-}
-#endif
deleted file mode 100644
--- a/extensions/universalchardet/src/base/nsLatin1Prober.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsLatin1Prober_h__
-#define nsLatin1Prober_h__
-
-#include "nsCharSetProber.h"
-
-#define FREQ_CAT_NUM 4
-
-class nsLatin1Prober : public nsCharSetProber {
- public:
-  nsLatin1Prober(void) { Reset(); }
-  virtual ~nsLatin1Prober(void) {}
-  nsProbingState HandleData(const char* aBuf, uint32_t aLen) override;
-  const char* GetCharSetName() override { return "windows-1252"; }
-  nsProbingState GetState(void) override { return mState; }
-  void Reset(void) override;
-  float GetConfidence(void) override;
-
-#ifdef DEBUG_chardet
-  virtual void DumpStatus();
-#endif
-
- protected:
-  nsProbingState mState;
-  char mLastCharClass;
-  uint32_t mFreqCounter[FREQ_CAT_NUM];
-};
-
-#endif /* nsLatin1Prober_h__ */
--- a/extensions/universalchardet/src/base/nsUniversalDetector.cpp
+++ b/extensions/universalchardet/src/base/nsUniversalDetector.cpp
@@ -4,57 +4,54 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nscore.h"
 
 #include "nsUniversalDetector.h"
 
 #include "nsMBCSGroupProber.h"
 #include "nsEscCharsetProber.h"
-#include "nsLatin1Prober.h"
 
 nsUniversalDetector::nsUniversalDetector() {
   mDone = false;
   mBestGuess = -1;  // illegal value as signal
   mInTag = false;
+  mMultibyteProber = nullptr;
   mEscCharSetProber = nullptr;
 
   mStart = true;
   mDetectedCharset = nullptr;
   mGotData = false;
   mInputState = ePureAscii;
   mLastChar = '\0';
-
-  uint32_t i;
-  for (i = 0; i < NUM_OF_CHARSET_PROBERS; i++) mCharSetProbers[i] = nullptr;
 }
 
 nsUniversalDetector::~nsUniversalDetector() {
-  for (int32_t i = 0; i < NUM_OF_CHARSET_PROBERS; i++)
-    delete mCharSetProbers[i];
-
+  delete mMultibyteProber;
   delete mEscCharSetProber;
 }
 
 void nsUniversalDetector::Reset() {
   mDone = false;
   mBestGuess = -1;  // illegal value as signal
   mInTag = false;
 
   mStart = true;
   mDetectedCharset = nullptr;
   mGotData = false;
   mInputState = ePureAscii;
   mLastChar = '\0';
 
-  if (mEscCharSetProber) mEscCharSetProber->Reset();
+  if (mMultibyteProber) {
+    mMultibyteProber->Reset();
+  }
 
-  uint32_t i;
-  for (i = 0; i < NUM_OF_CHARSET_PROBERS; i++)
-    if (mCharSetProbers[i]) mCharSetProbers[i]->Reset();
+  if (mEscCharSetProber) {
+    mEscCharSetProber->Reset(); 
+  }
 }
 
 //---------------------------------------------------------------------
 #define SHORTCUT_THRESHOLD (float)0.95
 #define MINIMUM_THRESHOLD (float)0.20
 
 nsresult nsUniversalDetector::HandleData(const char* aBuf, uint32_t aLen) {
   if (mDone) return NS_OK;
@@ -105,24 +102,19 @@ nsresult nsUniversalDetector::HandleData
         mInputState = eHighbyte;
 
         // kill mEscCharSetProber if it is active
         if (mEscCharSetProber) {
           delete mEscCharSetProber;
           mEscCharSetProber = nullptr;
         }
 
-        // start multibyte and singlebyte charset prober
-        if (nullptr == mCharSetProbers[0]) {
-          mCharSetProbers[0] = new nsMBCSGroupProber();
-          if (nullptr == mCharSetProbers[0]) return NS_ERROR_OUT_OF_MEMORY;
-        }
-        if (nullptr == mCharSetProbers[2]) {
-          mCharSetProbers[2] = new nsLatin1Prober;
-          if (nullptr == mCharSetProbers[2]) return NS_ERROR_OUT_OF_MEMORY;
+        // start multibyte charset prober
+        if (!mMultibyteProber) {
+          mMultibyteProber = new nsMBCSGroupProber();
         }
       }
     } else {
       // ok, just pure ascii so far
       if ((ePureAscii == mInputState) && (aBuf[i] == '\033')) {
         // found escape character
         mInputState = eEscAscii;
       }
@@ -139,26 +131,22 @@ nsresult nsUniversalDetector::HandleData
       }
       st = mEscCharSetProber->HandleData(aBuf, aLen);
       if (st == eFoundIt) {
         mDone = true;
         mDetectedCharset = mEscCharSetProber->GetCharSetName();
       }
       break;
     case eHighbyte:
-      for (i = 0; i < NUM_OF_CHARSET_PROBERS; i++) {
-        if (mCharSetProbers[i]) {
-          st = mCharSetProbers[i]->HandleData(aBuf, aLen);
+          st = mMultibyteProber->HandleData(aBuf, aLen);
           if (st == eFoundIt) {
             mDone = true;
-            mDetectedCharset = mCharSetProbers[i]->GetCharSetName();
+            mDetectedCharset = mMultibyteProber->GetCharSetName();
             return NS_OK;
           }
-        }
-      }
       break;
 
     default:     // pure ascii
               ;  // do nothing here
   }
   return NS_OK;
 }
 
@@ -174,31 +162,18 @@ void nsUniversalDetector::DataEnd() {
   if (mDetectedCharset) {
     mDone = true;
     Report(mDetectedCharset);
     return;
   }
 
   switch (mInputState) {
     case eHighbyte: {
-      float proberConfidence;
-      float maxProberConfidence = (float)0.0;
-      int32_t maxProber = 0;
-
-      for (int32_t i = 0; i < NUM_OF_CHARSET_PROBERS; i++) {
-        if (mCharSetProbers[i]) {
-          proberConfidence = mCharSetProbers[i]->GetConfidence();
-          if (proberConfidence > maxProberConfidence) {
-            maxProberConfidence = proberConfidence;
-            maxProber = i;
-          }
-        }
-      }
       // do not report anything because we are not confident of it, that's in
       // fact a negative answer
-      if (maxProberConfidence > MINIMUM_THRESHOLD)
-        Report(mCharSetProbers[maxProber]->GetCharSetName());
+      if (mMultibyteProber->GetConfidence() > MINIMUM_THRESHOLD)
+        Report(mMultibyteProber->GetCharSetName());
     } break;
     case eEscAscii:
       break;
     default:;
   }
 }
--- a/extensions/universalchardet/src/base/nsUniversalDetector.h
+++ b/extensions/universalchardet/src/base/nsUniversalDetector.h
@@ -3,18 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsUniversalDetector_h__
 #define nsUniversalDetector_h__
 
 class nsCharSetProber;
 
-#define NUM_OF_CHARSET_PROBERS 3
-
 typedef enum { ePureAscii = 0, eEscAscii = 1, eHighbyte = 2 } nsInputState;
 
 class nsUniversalDetector {
  public:
   nsUniversalDetector();
   virtual ~nsUniversalDetector();
   virtual nsresult HandleData(const char* aBuf, uint32_t aLen);
   virtual void DataEnd(void);
@@ -27,13 +25,13 @@ class nsUniversalDetector {
   bool mInTag;
   bool mStart;
   bool mGotData;
   char mLastChar;
   const char* mDetectedCharset;
   int32_t mBestGuess;
   uint32_t mLanguageFilter;
 
-  nsCharSetProber* mCharSetProbers[NUM_OF_CHARSET_PROBERS];
+  nsCharSetProber* mMultibyteProber;
   nsCharSetProber* mEscCharSetProber;
 };
 
 #endif
deleted file mode 100644
--- a/extensions/universalchardet/tests/bug421271_text.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html><head>
-<meta http-equiv="Content-Type" content="text/html"><title>BBC - 606 - A Forum Conversation</title>
-</head>
-<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"><p class="posted">posted 5 Weeks Ago</p><p>if rangers draw and marseille and benfica win i stand to lift 825. not bad for a 2 bet.<br>50p on 3 homes<br>Man Utd/Marseille/Benfica<br>50p on 3 Draws<br>Rangers/Halifax/Bristol City<br>50p on 3 Aways<br>Doncaster/Stranraer/Rushden &amp; Diamonds<br>and 50p on all nine results.<br>GET IN THERE.</p></body></html>
\ No newline at end of file
deleted file mode 100644
--- a/extensions/universalchardet/tests/bug811363-invalid-2.text
+++ /dev/null
@@ -1,3 +0,0 @@
-First bytes of 2-byte sequences (0xc0-0xdf), each followed by a space character:                                 
-First bytes of 3-byte sequences (0xe0-0xef), each followed by a space character:                 
-First bytes of 4-byte sequences (0xf0-0xf4), each followed by a space character:      
deleted file mode 100644
--- a/extensions/universalchardet/tests/bug811363-invalid-3.text
+++ /dev/null
@@ -1,2 +0,0 @@
-3-byte sequence with last byte missing (U+0000): 
-4-byte sequence with last b0te missing (U+0000): 
deleted file mode 100644
--- a/extensions/universalchardet/tests/bug811363-invalid-4.text
+++ /dev/null
@@ -1,1 +0,0 @@
-Overlong encodings:   
--- a/extensions/universalchardet/tests/chrome.ini
+++ b/extensions/universalchardet/tests/chrome.ini
@@ -1,51 +1,43 @@
 [DEFAULT]
 support-files =
   CharsetDetectionTests.js
   bug306272_text.html
-  bug421271_text.html
   bug426271_text-euc-jp.html
   bug426271_text-utf-8.html
   bug431054_text.html
   bug631751be_text.html
   bug631751le_text.html
   bug638318_text.html
   bug811363-1.text
   bug811363-2.text
   bug811363-3.text
   bug811363-4.text
   bug811363-5.text
   bug811363-6.text
   bug811363-7.text
   bug811363-8.text
   bug811363-9.text
   bug811363-invalid-1.text
-  bug811363-invalid-2.text
-  bug811363-invalid-3.text
-  bug811363-invalid-4.text
   bug811363-invalid-5.text
   bug1071816-1_text.html
   bug1071816-2_text.html
   bug1071816-3_text.html
   bug1071816-4_text.html
 
 [test_bug306272.html]
-[test_bug421271.html]
 [test_bug426271-euc-jp.html]
 [test_bug426271-utf-8.html]
 [test_bug431054-japanese.html]
 [test_bug431054.html]
 [test_bug631751be.html]
 [test_bug631751le.html]
 [test_bug638318.html]
 [test_bug811363-1-1.html]
-[test_bug811363-1-2.html]
-[test_bug811363-1-3.html]
-[test_bug811363-1-4.html]
 [test_bug811363-1-5.html]
 [test_bug811363-2-1.html]
 [test_bug811363-2-2.html]
 [test_bug811363-2-3.html]
 [test_bug811363-2-4.html]
 [test_bug811363-2-5.html]
 [test_bug811363-2-6.html]
 [test_bug811363-2-7.html]
deleted file mode 100644
--- a/extensions/universalchardet/tests/test_bug421271.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=421271
--->
-<head>
-  <title>Test for Bug 421271</title>
-  <script type="text/javascript" 
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
-          </script>
-  <script type="text/javascript" src="CharsetDetectionTests.js"></script>
-  <link rel="stylesheet" type="text/css" 
-        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421271">Mozilla Bug 421271</a>
-<p id="display"></p>
-<div id="content" style="display: none">  
-</div>
-<iframe id="testframe"></iframe>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-/** Test for Bug 421271 **/
-CharsetDetectionTests("bug421271_text.html",
-		      "windows-1252",
-		      new Array("ja_parallel_state_machine",
-				"ko_parallel_state_machine",
-				"zh_parallel_state_machine",
-				"zhtw_parallel_state_machine",
-				"zhcn_parallel_state_machine",
-				"cjk_parallel_state_machine",
-				"universal_charset_detector"));
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/extensions/universalchardet/tests/test_bug811363-1-2.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=811363
--->
-<head>
-  <title>Test for Bug 811363</title>
-  <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
-          </script>
-  <script type="text/javascript" src="CharsetDetectionTests.js"></script>
-  <link rel="stylesheet" type="text/css"
-        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=811363">Mozilla Bug 811363</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<iframe id="testframe"></iframe>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-/** Test for Bug 811363 **/
-CharsetDetectionTests("bug811363-invalid-2.text",
-		      "windows-1252",
-		      new Array("ja_parallel_state_machine"));
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/extensions/universalchardet/tests/test_bug811363-1-3.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=811363
--->
-<head>
-  <title>Test for Bug 811363</title>
-  <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
-          </script>
-  <script type="text/javascript" src="CharsetDetectionTests.js"></script>
-  <link rel="stylesheet" type="text/css"
-        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=811363">Mozilla Bug 811363</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<iframe id="testframe"></iframe>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-/** Test for Bug 811363 **/
-CharsetDetectionTests("bug811363-invalid-3.text",
-		      "windows-1252",
-		      new Array("ja_parallel_state_machine"));
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/extensions/universalchardet/tests/test_bug811363-1-4.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=811363
--->
-<head>
-  <title>Test for Bug 811363</title>
-  <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
-          </script>
-  <script type="text/javascript" src="CharsetDetectionTests.js"></script>
-  <link rel="stylesheet" type="text/css"
-        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=811363">Mozilla Bug 811363</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<iframe id="testframe"></iframe>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-/** Test for Bug 811363 **/
-CharsetDetectionTests("bug811363-invalid-4.text",
-		      "windows-1252",
-		      new Array("ja_parallel_state_machine"));
-</script>
-</pre>
-</body>
-</html>