summaryrefslogtreecommitdiffstats
path: root/modules/libjar
diff options
context:
space:
mode:
Diffstat (limited to 'modules/libjar')
-rw-r--r--modules/libjar/nsJARChannel.cpp3
-rw-r--r--modules/libjar/nsZipArchive.cpp10
-rw-r--r--modules/libjar/test/mochitest/test_bug1173171.html2
-rw-r--r--modules/libjar/test/unit/test_empty_jar_telemetry.js4
-rw-r--r--modules/libjar/test/unit/test_jarchannel.js6
-rw-r--r--modules/libjar/zipwriter/test/unit/test_asyncadd.js2
-rw-r--r--modules/libjar/zipwriter/test/unit/test_asyncbadadd.js2
-rw-r--r--modules/libjar/zipwriter/test/unit/test_asyncbadremove.js2
-rw-r--r--modules/libjar/zipwriter/test/unit/test_asyncremove.js2
-rw-r--r--modules/libjar/zipwriter/test/unit/test_bug399727.js2
-rw-r--r--modules/libjar/zipwriter/test/unit/test_bug717061.js2
11 files changed, 24 insertions, 13 deletions
diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp
index de86ac2133..8557327f20 100644
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -890,7 +890,8 @@ static void RecordZeroLengthEvent(bool aIsSync, const nsCString& aSpec,
} else if (StringEndsWith(fileName, ".properties"_ns)) {
eventType = Telemetry::EventID::Zero_byte_load_Load_Properties;
} else if (StringEndsWith(fileName, ".js"_ns) ||
- StringEndsWith(fileName, ".jsm"_ns)) {
+ StringEndsWith(fileName, ".jsm"_ns) ||
+ StringEndsWith(fileName, ".mjs"_ns)) {
// We're going to skip reporting telemetry on JS loads
// coming not from omni.ja.
// See Bug 1693711 for investigation into those empty loads.
diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp
index e0ca373e49..2d845f25f0 100644
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -17,6 +17,7 @@
#include "mozilla/MemUtils.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/StaticMutex.h"
+#include "mozilla/StaticPrefs_network.h"
#include "stdlib.h"
#include "nsDirectoryService.h"
#include "nsWildCard.h"
@@ -242,6 +243,15 @@ nsresult nsZipHandle::Init(nsZipArchive* zip, const char* entry,
if (!handle) return NS_ERROR_OUT_OF_MEMORY;
LOG(("ZipHandle::Init entry %s", entry));
+
+ nsZipItem* item = zip->GetItem(entry);
+ if (item && item->Compression() == DEFLATED &&
+ StaticPrefs::network_jar_max_entry_size()) {
+ if (item->RealSize() > StaticPrefs::network_jar_max_entry_size()) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
handle->mBuf = MakeUnique<nsZipItemPtr<uint8_t>>(zip, entry);
if (!handle->mBuf) return NS_ERROR_OUT_OF_MEMORY;
diff --git a/modules/libjar/test/mochitest/test_bug1173171.html b/modules/libjar/test/mochitest/test_bug1173171.html
index 6f18513f86..d00825e6f6 100644
--- a/modules/libjar/test/mochitest/test_bug1173171.html
+++ b/modules/libjar/test/mochitest/test_bug1173171.html
@@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1173171
// A simple async XMLHttpRequest call.
// Returns a promise with the response.
let xhr = function(method, url, responseType) {
- return new Promise(function(resolve, reject) {
+ return new Promise(function(resolve) {
let xhrInstance = new XMLHttpRequest();
xhrInstance.open(method, url, true);
xhrInstance.onload = function() {
diff --git a/modules/libjar/test/unit/test_empty_jar_telemetry.js b/modules/libjar/test/unit/test_empty_jar_telemetry.js
index 895e88ff65..45bf83a113 100644
--- a/modules/libjar/test/unit/test_empty_jar_telemetry.js
+++ b/modules/libjar/test/unit/test_empty_jar_telemetry.js
@@ -67,7 +67,7 @@ Listener.prototype = {
do_throw(ex);
}
},
- onStartRequest(request) {
+ onStartRequest() {
this.gotStartRequest = true;
},
onStopRequest(request, status) {
@@ -98,7 +98,7 @@ add_task(async function test_empty_jar_file_async() {
await new Promise(resolve => {
chan.asyncOpen(
- new Listener(function (l) {
+ new Listener(function () {
Assert.ok(chan.contentLength == 0);
resolve();
})
diff --git a/modules/libjar/test/unit/test_jarchannel.js b/modules/libjar/test/unit/test_jarchannel.js
index 9d3a571b63..239ea15d7e 100644
--- a/modules/libjar/test/unit/test_jarchannel.js
+++ b/modules/libjar/test/unit/test_jarchannel.js
@@ -45,7 +45,7 @@ Listener.prototype = {
do_throw(ex);
}
},
- onStartRequest(request) {
+ onStartRequest() {
this.gotStartRequest = true;
},
onStopRequest(request, status) {
@@ -130,7 +130,7 @@ add_test(function testSyncNested() {
/**
* Basic reading test for asynchronously opened, nested jar channels
*/
-add_test(function testAsyncNested(next) {
+add_test(function testAsyncNested() {
var uri = "jar:" + jarBase + "/inner40.zip!/foo";
var chan = NetUtil.newChannel({ uri, loadUsingSystemPrincipal: true });
chan.asyncOpen(
@@ -184,7 +184,7 @@ add_test(function testAsyncCloseUnlocks() {
var chan = NetUtil.newChannel({ uri, loadUsingSystemPrincipal: true });
chan.asyncOpen(
- new Listener(function (l) {
+ new Listener(function () {
Assert.ok(chan.contentLength > 0);
// Drop any jar caches
diff --git a/modules/libjar/zipwriter/test/unit/test_asyncadd.js b/modules/libjar/zipwriter/test/unit/test_asyncadd.js
index 0259a7953c..9e5004b4b8 100644
--- a/modules/libjar/zipwriter/test/unit/test_asyncadd.js
+++ b/modules/libjar/zipwriter/test/unit/test_asyncadd.js
@@ -24,7 +24,7 @@ var TESTS = [
var size = 0;
var observer = {
- onStartRequest(request) {},
+ onStartRequest() {},
onStopRequest(request, status) {
Assert.equal(status, Cr.NS_OK);
diff --git a/modules/libjar/zipwriter/test/unit/test_asyncbadadd.js b/modules/libjar/zipwriter/test/unit/test_asyncbadadd.js
index 7d1c4ec610..8bdd592232 100644
--- a/modules/libjar/zipwriter/test/unit/test_asyncbadadd.js
+++ b/modules/libjar/zipwriter/test/unit/test_asyncbadadd.js
@@ -6,7 +6,7 @@
const FILENAME = "missing.txt";
var observer = {
- onStartRequest(request) {},
+ onStartRequest() {},
onStopRequest(request, status) {
Assert.equal(status, Cr.NS_ERROR_FILE_NOT_FOUND);
diff --git a/modules/libjar/zipwriter/test/unit/test_asyncbadremove.js b/modules/libjar/zipwriter/test/unit/test_asyncbadremove.js
index 623bc46c59..2d5e9efd96 100644
--- a/modules/libjar/zipwriter/test/unit/test_asyncbadremove.js
+++ b/modules/libjar/zipwriter/test/unit/test_asyncbadremove.js
@@ -6,7 +6,7 @@
const FILENAME = "missing.txt";
var observer = {
- onStartRequest(request) {},
+ onStartRequest() {},
onStopRequest(request, status) {
Assert.equal(status, Cr.NS_ERROR_FILE_NOT_FOUND);
diff --git a/modules/libjar/zipwriter/test/unit/test_asyncremove.js b/modules/libjar/zipwriter/test/unit/test_asyncremove.js
index 7342e18e4f..24cf633df9 100644
--- a/modules/libjar/zipwriter/test/unit/test_asyncremove.js
+++ b/modules/libjar/zipwriter/test/unit/test_asyncremove.js
@@ -6,7 +6,7 @@
var TESTS = ["test.txt", "test.png"];
var observer = {
- onStartRequest(request) {},
+ onStartRequest() {},
onStopRequest(request, status) {
Assert.equal(status, Cr.NS_OK);
diff --git a/modules/libjar/zipwriter/test/unit/test_bug399727.js b/modules/libjar/zipwriter/test/unit/test_bug399727.js
index 2967f69737..05176b20d6 100644
--- a/modules/libjar/zipwriter/test/unit/test_bug399727.js
+++ b/modules/libjar/zipwriter/test/unit/test_bug399727.js
@@ -23,7 +23,7 @@ BinaryComparer.prototype = {
length: null,
callback: null,
- onStartRequest(aRequest) {},
+ onStartRequest() {},
onStopRequest(aRequest, aStatusCode) {
this.fileStream.close();
diff --git a/modules/libjar/zipwriter/test/unit/test_bug717061.js b/modules/libjar/zipwriter/test/unit/test_bug717061.js
index cb3faa3aa7..dcc30649be 100644
--- a/modules/libjar/zipwriter/test/unit/test_bug717061.js
+++ b/modules/libjar/zipwriter/test/unit/test_bug717061.js
@@ -22,7 +22,7 @@ BinaryComparer.prototype = {
length: null,
callback: null,
- onStartRequest(aRequest) {},
+ onStartRequest() {},
onStopRequest(aRequest, aStatusCode) {
this.fileStream.close();