diff --git a/testing/config/tooltool-manifests/linux32/nodejs.manifest b/testing/config/tooltool-manifests/linux32/nodejs.manifest
deleted file mode 100644
index f0411e811c..0000000000
--- a/testing/config/tooltool-manifests/linux32/nodejs.manifest
+++ /dev/null
@@ -1,10 +0,0 @@
-[
- {
- "size": 13426698,
- "visibility": "internal",
- "digest": "d2b45d3e2fab867152e2063785af48ead3f4d34b4dd614c1e0867f3eeef0c8088a4ffe811400234827293ff8b75f34f45b45eca991e4eed7de37934a7400a9ac",
- "algorithm": "sha512",
- "filename": "node-linux-x86.tar.gz",
- "unpack": true
- }
-]
diff --git a/testing/config/tooltool-manifests/linux64/nodejs.manifest b/testing/config/tooltool-manifests/linux64/nodejs.manifest
deleted file mode 100644
index ac16eb077e..0000000000
--- a/testing/config/tooltool-manifests/linux64/nodejs.manifest
+++ /dev/null
@@ -1,10 +0,0 @@
-[
- {
- "size": 13958999,
- "visibility": "internal",
- "digest": "ce5c0c20dfa83821284a1b69b226fe13224b82345622fc43d216332484ec8c89a2f171ad3dd2ac83cd5777510306d349bc4fbf00fc692e3542dfb7db70876489",
- "algorithm": "sha512",
- "filename": "node-linux-x64.tar.gz",
- "unpack": true
- }
-]
diff --git a/testing/config/tooltool-manifests/macosx64/nodejs.manifest b/testing/config/tooltool-manifests/macosx64/nodejs.manifest
deleted file mode 100644
index 05623f7e70..0000000000
--- a/testing/config/tooltool-manifests/macosx64/nodejs.manifest
+++ /dev/null
@@ -1,10 +0,0 @@
-[
- {
- "size": 12148545,
- "visibility": "internal",
- "digest": "a79b5efc30b560fbfb48210b4e0b4c6418ebc8472b07460c7cb2042db6ea1b7a6473cb9fa35604b8abbc93df3d3689b91919dd21e8d4f382033d3c07c7ec6a3f",
- "algorithm": "sha512",
- "filename": "node-osx.tar.gz",
- "unpack": true
- }
-]
diff --git a/testing/config/tooltool-manifests/win32/nodejs.manifest b/testing/config/tooltool-manifests/win32/nodejs.manifest
deleted file mode 100644
index 0715363a0e..0000000000
--- a/testing/config/tooltool-manifests/win32/nodejs.manifest
+++ /dev/null
@@ -1,9 +0,0 @@
-[
- {
- "size": 15066656,
- "visibility": "internal",
- "digest": "edf96781042db513700c4a092ef367c05933967b036db9b0f716b75da613a7eaea055d0f60b1e12f6e41a545962cec97a7b78c6b86363ee1ec7a9f42699a5531",
- "algorithm": "sha512",
- "filename": "node-win32.exe"
- }
-]
diff --git a/testing/mochitest/ssltunnel/ssltunnel.cpp b/testing/mochitest/ssltunnel/ssltunnel.cpp
index 4fe54db0a9..55fcb86af4 100644
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -30,6 +30,7 @@
#include "sslproto.h"
#include "plhash.h"
#include "mozilla/Sprintf.h"
+#include "mozilla/Unused.h"
using namespace mozilla;
using namespace mozilla::psm;
@@ -381,6 +382,32 @@ bool ConfigureSSLServerSocket(PRFileDesc* socket, server_info_t* si,
SSL_OptionSet(ssl_socket, SSL_HANDSHAKE_AS_SERVER, true);
if (clientAuth != caNone) {
+ // If we're requesting or requiring a client certificate, we should
+ // configure NSS to include the "certificate_authorities" field in the
+ // certificate request message. That way we can test that gecko properly
+ // takes note of it.
+ UniqueCERTCertificate issuer(
+ CERT_FindCertIssuer(cert.get(), PR_Now(), certUsageAnyCA));
+ if (!issuer) {
+ LOG_DEBUG(("Failed to find issuer for %s\n", certnick));
+ return false;
+ }
+ UniqueCERTCertList issuerList(CERT_NewCertList());
+ if (!issuerList) {
+ LOG_ERROR(("Failed to allocate new CERTCertList\n"));
+ return false;
+ }
+ if (CERT_AddCertToListTail(issuerList.get(), issuer.get()) != SECSuccess) {
+ LOG_ERROR(("Failed to add issuer to issuerList\n"));
+ return false;
+ }
+ Unused << issuer.release(); // Ownership transferred to issuerList.
+ if (SSL_SetTrustAnchors(ssl_socket, issuerList.get()) != SECSuccess) {
+ LOG_ERROR(
+ ("Failed to set certificate_authorities list for client "
+ "authentication\n"));
+ return false;
+ }
SSL_OptionSet(ssl_socket, SSL_REQUEST_CERTIFICATE, true);
SSL_OptionSet(ssl_socket, SSL_REQUIRE_CERTIFICATE, clientAuth == caRequire);
}
diff --git a/testing/mozharness/configs/remove_executables.py b/testing/mozharness/configs/remove_executables.py
index 7e6332cbe8..cf022dc356 100644
--- a/testing/mozharness/configs/remove_executables.py
+++ b/testing/mozharness/configs/remove_executables.py
@@ -1,6 +1,5 @@
config = {
# We bake this directly into the tester image now...
- "download_nodejs": False,
"nodejs_path": "/usr/local/bin/node",
"exes": {}
}
diff --git a/testing/mozharness/configs/unittests/linux_unittest.py b/testing/mozharness/configs/unittests/linux_unittest.py
index 6cefd75ffb..e50c9fc625 100644
--- a/testing/mozharness/configs/unittests/linux_unittest.py
+++ b/testing/mozharness/configs/unittests/linux_unittest.py
@@ -13,6 +13,10 @@ ADJUST_MOUSE_AND_SCREEN = False
# Note: keep these Valgrind .sup file names consistent with those
# in testing/mochitest/mochitest_options.py.
VALGRIND_SUPP_DIR = os.path.join(os.getcwd(), "build/tests/mochitest")
+NODEJS_PATH = None
+if 'MOZ_FETCHES_DIR' in os.environ:
+ NODEJS_PATH = os.path.join(os.environ["MOZ_FETCHES_DIR"], "node/bin/node")
+
VALGRIND_SUPP_CROSS_ARCH = os.path.join(VALGRIND_SUPP_DIR,
"cross-architecture.sup")
VALGRIND_SUPP_ARCH = None
@@ -22,14 +26,11 @@ if platform.architecture()[0] == "64bit":
MINIDUMP_STACKWALK_PATH = "linux64-minidump_stackwalk"
VALGRIND_SUPP_ARCH = os.path.join(VALGRIND_SUPP_DIR,
"x86_64-pc-linux-gnu.sup")
- NODEJS_PATH = "node-linux-x64/bin/node"
- NODEJS_TOOLTOOL_MANIFEST_PATH = "config/tooltool-manifests/linux64/nodejs.manifest"
else:
TOOLTOOL_MANIFEST_PATH = "config/tooltool-manifests/linux32/releng.manifest"
MINIDUMP_STACKWALK_PATH = "linux32-minidump_stackwalk"
VALGRIND_SUPP_ARCH = os.path.join(VALGRIND_SUPP_DIR,
"i386-pc-linux-gnu.sup")
- NODEJS_PATH = "node-linux-x86/bin/node"
NODEJS_TOOLTOOL_MANIFEST_PATH = "config/tooltool-manifests/linux32/nodejs.manifest"
#####
@@ -260,8 +261,6 @@ config = {
"minidump_stackwalk_path": MINIDUMP_STACKWALK_PATH,
"minidump_tooltool_manifest_path": TOOLTOOL_MANIFEST_PATH,
"tooltool_cache": "/builds/worker/tooltool-cache",
- "download_nodejs": True,
"nodejs_path": NODEJS_PATH,
- "nodejs_tooltool_manifest_path": NODEJS_TOOLTOOL_MANIFEST_PATH,
# "log_format": "%(levelname)8s - %(message)s",
}
diff --git a/testing/mozharness/configs/unittests/mac_unittest.py b/testing/mozharness/configs/unittests/mac_unittest.py
index 171e071bee..339bc15f92 100644
--- a/testing/mozharness/configs/unittests/mac_unittest.py
+++ b/testing/mozharness/configs/unittests/mac_unittest.py
@@ -2,6 +2,10 @@ import os
# OS Specifics
INSTALLER_PATH = os.path.join(os.getcwd(), "installer.dmg")
+NODEJS_PATH = None
+if 'MOZ_FETCHES_DIR' in os.environ:
+ NODEJS_PATH = os.path.join(os.environ["MOZ_FETCHES_DIR"], "node/bin/node")
+
XPCSHELL_NAME = 'xpcshell'
EXE_SUFFIX = ''
DISABLE_SCREEN_SAVER = False
@@ -209,7 +213,5 @@ config = {
"minidump_stackwalk_path": "macosx64-minidump_stackwalk",
"minidump_tooltool_manifest_path": "config/tooltool-manifests/macosx64/releng.manifest",
"tooltool_cache": "/builds/tooltool_cache",
- "download_nodejs": True,
- "nodejs_path": "node-osx/bin/node",
- "nodejs_tooltool_manifest_path": "config/tooltool-manifests/macosx64/nodejs.manifest",
+ "nodejs_path": NODEJS_PATH,
}
diff --git a/testing/mozharness/configs/unittests/win_unittest.py b/testing/mozharness/configs/unittests/win_unittest.py
index 555c42bd76..faf346df4d 100644
--- a/testing/mozharness/configs/unittests/win_unittest.py
+++ b/testing/mozharness/configs/unittests/win_unittest.py
@@ -6,6 +6,10 @@ import sys
ABS_WORK_DIR = os.path.join(os.getcwd(), "build")
BINARY_PATH = os.path.join(ABS_WORK_DIR, "firefox", "firefox.exe")
INSTALLER_PATH = os.path.join(ABS_WORK_DIR, "installer.zip")
+NODEJS_PATH = None
+if 'MOZ_FETCHES_DIR' in os.environ:
+ NODEJS_PATH = os.path.join(os.environ["MOZ_FETCHES_DIR"], "node/node.exe")
+
XPCSHELL_NAME = 'xpcshell.exe'
EXE_SUFFIX = '.exe'
DISABLE_SCREEN_SAVER = False
@@ -282,7 +286,5 @@ config = {
},
"minidump_stackwalk_path": "win32-minidump_stackwalk.exe",
"minidump_tooltool_manifest_path": "config/tooltool-manifests/win32/releng.manifest",
- "download_nodejs": True,
- "nodejs_path": "node-win32.exe",
- "nodejs_tooltool_manifest_path": "config/tooltool-manifests/win32/nodejs.manifest",
+ "nodejs_path": NODEJS_PATH,
}
diff --git a/testing/mozharness/mozharness/mozilla/testing/testbase.py b/testing/mozharness/mozharness/mozilla/testing/testbase.py
index b392757f7e..8764281017 100644
--- a/testing/mozharness/mozharness/mozilla/testing/testbase.py
+++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py
@@ -118,7 +118,6 @@ class TestingMixin(VirtualenvMixin, AutomationMixin, ResourceMonitoringMixin,
symbols_path = None
jsshell_url = None
minidump_stackwalk_path = None
- nodejs_path = None
default_tools_repo = 'https://hg.mozilla.org/build/tools'
def query_build_dir_url(self, file_name):
@@ -572,69 +571,6 @@ Did you run with --create-virtualenv? Is mozinstall in virtualenv_modules?""")
else:
self.fatal('We could not determine the minidump\'s filename.')
- def query_nodejs_tooltool_manifest(self):
- if self.config.get('nodejs_tooltool_manifest_path'):
- return self.config['nodejs_tooltool_manifest_path']
-
- self.info('NodeJS tooltool manifest unknown. Determining based upon '
- 'platform and architecture.')
- platform_name = self.platform_name()
-
- if platform_name:
- tooltool_path = "config/tooltool-manifests/%s/nodejs.manifest" % \
- TOOLTOOL_PLATFORM_DIR[platform_name]
- return tooltool_path
- else:
- self.fatal('Could not determine nodejs manifest filename')
-
- def query_nodejs_filename(self):
- if self.config.get('nodejs_path'):
- return self.config['nodejs_path']
-
- self.fatal('Could not determine nodejs filename')
-
- def query_nodejs(self, manifest=None):
- if self.nodejs_path:
- return self.nodejs_path
-
- c = self.config
- dirs = self.query_abs_dirs()
-
- nodejs_path = self.query_nodejs_filename()
- if not self.config.get('download_nodejs'):
- self.nodejs_path = nodejs_path
- return self.nodejs_path
-
- if not manifest:
- tooltool_manifest_path = self.query_nodejs_tooltool_manifest()
- manifest = os.path.join(dirs.get('abs_test_install_dir',
- os.path.join(dirs['abs_work_dir'], 'tests')),
- tooltool_manifest_path)
-
- self.info('grabbing nodejs binary from tooltool')
- try:
- self.tooltool_fetch(
- manifest=manifest,
- output_dir=dirs['abs_work_dir'],
- cache=c.get('tooltool_cache')
- )
- except KeyError:
- self.error('missing a required key')
-
- abs_nodejs_path = os.path.join(dirs['abs_work_dir'], nodejs_path)
-
- if os.path.exists(abs_nodejs_path):
- if self.platform_name() not in ('win32', 'win64'):
- self.chmod(abs_nodejs_path, 0755)
- self.nodejs_path = abs_nodejs_path
- else:
- msg = """nodejs path was given but couldn't be found. Tried looking in '%s'""" % \
- abs_nodejs_path
- self.warning(msg)
- self.record_status(TBPL_WARNING, WARNING)
-
- return self.nodejs_path
-
def query_minidump_stackwalk(self, manifest=None):
if self.minidump_stackwalk_path:
return self.minidump_stackwalk_path
diff --git a/testing/mozharness/scripts/desktop_unittest.py b/testing/mozharness/scripts/desktop_unittest.py
index 0f2d3a0950..9a4f121f4b 100644
--- a/testing/mozharness/scripts/desktop_unittest.py
+++ b/testing/mozharness/scripts/desktop_unittest.py
@@ -862,8 +862,8 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin,
if self.query_minidump_stackwalk():
env['MINIDUMP_STACKWALK'] = self.minidump_stackwalk_path
- if self.query_nodejs():
- env['MOZ_NODE_PATH'] = self.nodejs_path
+ if self.config['nodejs_path']:
+ env['MOZ_NODE_PATH'] = self.config['nodejs_path']
env['MOZ_UPLOAD_DIR'] = self.query_abs_dirs()['abs_blob_upload_dir']
env['MINIDUMP_SAVE_PATH'] = self.query_abs_dirs()['abs_blob_upload_dir']
env['RUST_BACKTRACE'] = 'full'
diff --git a/testing/profiles/web-platform/user.js b/testing/profiles/web-platform/user.js
index 265c75c904..674af99a81 100644
--- a/testing/profiles/web-platform/user.js
+++ b/testing/profiles/web-platform/user.js
@@ -23,7 +23,7 @@ user_pref("places.history.enabled", false);
// Suppress automatic safe mode after crashes
user_pref("toolkit.startup.max_resumed_crashes", -1);
// Disable antialiasing for the Ahem font.
-user_pref("gfx.font_ahem_antialias_none", true);
+user_pref("gfx.font_rendering.ahem_antialias_none", true);
// Disable antiphishing popup
user_pref("network.http.phishy-userpass-length", 255);
// Disable safebrowsing components
@@ -34,3 +34,13 @@ user_pref("browser.safebrowsing.malware.enabled", false);
user_pref("browser.safebrowsing.phishing.enabled", false);
// Automatically unload beforeunload alerts
user_pref("dom.disable_beforeunload", true);
+// Enable implicit keyframes since the common animation interpolation test
+// function assumes this is available.
+user_pref("dom.animations-api.implicit-keyframes.enabled", true);
+// sometime wpt runs test even before the document becomes visible, which would
+// delay video.play() and cause play() running in wrong order.
+user_pref("media.block-autoplay-until-in-foreground", false);
+user_pref("media.block-autoplay-until-in-foreground", false);
+// Enable AppCache globally for now whilst it's being removed in Bug 1584984
+user_pref("browser.cache.offline.storage.enable", true);
+user_pref("browser.cache.offline.enable", true);
diff --git a/testing/web-platform/meta/css/CSS2/bidi-text/bidi-001.xht.ini b/testing/web-platform/meta/css/CSS2/bidi-text/bidi-001.xht.ini
new file mode 100644
index 0000000000..f5aab79f77
--- /dev/null
+++ b/testing/web-platform/meta/css/CSS2/bidi-text/bidi-001.xht.ini
@@ -0,0 +1,3 @@
+[bidi-001.xht]
+ fuzzy:
+ if os == "mac": maxDifference=3;totalPixels=0-1
diff --git a/testing/web-platform/meta/css/CSS2/bidi-text/bidi-002.xht.ini b/testing/web-platform/meta/css/CSS2/bidi-text/bidi-002.xht.ini
new file mode 100644
index 0000000000..a606245391
--- /dev/null
+++ b/testing/web-platform/meta/css/CSS2/bidi-text/bidi-002.xht.ini
@@ -0,0 +1,3 @@
+[bidi-002.xht]
+ fuzzy:
+ if os == "mac": maxDifference=1;totalPixels=0-1
diff --git a/testing/web-platform/meta/css/CSS2/css1/c43-rpl-ibx-000.xht.ini b/testing/web-platform/meta/css/CSS2/css1/c43-rpl-ibx-000.xht.ini
index 35dec9c4d2..cf2293fca3 100644
--- a/testing/web-platform/meta/css/CSS2/css1/c43-rpl-ibx-000.xht.ini
+++ b/testing/web-platform/meta/css/CSS2/css1/c43-rpl-ibx-000.xht.ini
@@ -1,5 +1,4 @@
[c43-rpl-ibx-000.xht]
expected:
- if os == "mac": FAIL
if (os == "android") and not e10s: FAIL
if (os == "android") and e10s: FAIL
diff --git a/testing/web-platform/meta/css/CSS2/floats-clear/clear-applies-to-008.xht.ini b/testing/web-platform/meta/css/CSS2/floats-clear/clear-applies-to-008.xht.ini
deleted file mode 100644
index 2e006a9b0d..0000000000
--- a/testing/web-platform/meta/css/CSS2/floats-clear/clear-applies-to-008.xht.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[clear-applies-to-008.xht]
- expected:
- if (os == "mac"): FAIL
diff --git a/testing/web-platform/meta/css/css-contain/contain-paint-independent-formatting-context-002.html.ini b/testing/web-platform/meta/css/css-contain/contain-paint-independent-formatting-context-002.html.ini
deleted file mode 100644
index 4cf4d64a19..0000000000
--- a/testing/web-platform/meta/css/css-contain/contain-paint-independent-formatting-context-002.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[contain-paint-independent-formatting-context-002.html]
- expected:
- if (os == "mac"): FAIL
diff --git a/testing/web-platform/meta/css/css-display/display-contents-details.html.ini b/testing/web-platform/meta/css/css-display/display-contents-details.html.ini
deleted file mode 100644
index bd1f88b4e7..0000000000
--- a/testing/web-platform/meta/css/css-display/display-contents-details.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[display-contents-details.html]
- expected:
- if (os == "mac"): PASS
- FAIL
diff --git a/testing/web-platform/meta/css/css-display/display-contents-fieldset.html.ini b/testing/web-platform/meta/css/css-display/display-contents-fieldset.html.ini
deleted file mode 100644
index 1c0e742370..0000000000
--- a/testing/web-platform/meta/css/css-display/display-contents-fieldset.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[display-contents-fieldset.html]
- expected:
- if os == "mac": FAIL
diff --git a/testing/web-platform/meta/css/css-flexbox/flex-lines/multi-line-wrap-reverse-column-reverse.html.ini b/testing/web-platform/meta/css/css-flexbox/flex-lines/multi-line-wrap-reverse-column-reverse.html.ini
deleted file mode 100644
index bb68d795f1..0000000000
--- a/testing/web-platform/meta/css/css-flexbox/flex-lines/multi-line-wrap-reverse-column-reverse.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[multi-line-wrap-reverse-column-reverse.html]
- expected:
- if (os == "mac") and (version == "OS X 10.14.5") and (processor == "x86_64") and (bits == 64): FAIL
- if (os == "mac") and (version == "OS X 10.14") and (processor == "x86_64") and (bits == 64): FAIL
-
\ No newline at end of file
diff --git a/testing/web-platform/meta/css/css-flexbox/flex-lines/multi-line-wrap-with-column-reverse.html.ini b/testing/web-platform/meta/css/css-flexbox/flex-lines/multi-line-wrap-with-column-reverse.html.ini
deleted file mode 100644
index 9e7d683ba7..0000000000
--- a/testing/web-platform/meta/css/css-flexbox/flex-lines/multi-line-wrap-with-column-reverse.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[multi-line-wrap-with-column-reverse.html]
- expected:
- if (os == "mac") and (version == "OS X 10.14.5") and (processor == "x86_64") and (bits == 64): FAIL
- if (os == "mac") and (version == "OS X 10.14") and (processor == "x86_64") and (bits == 64): FAIL
diff --git a/testing/web-platform/meta/css/css-text-decor/text-emphasis-style-006.html.ini b/testing/web-platform/meta/css/css-text-decor/text-emphasis-style-006.html.ini
index 91d35eae39..282074fe27 100644
--- a/testing/web-platform/meta/css/css-text-decor/text-emphasis-style-006.html.ini
+++ b/testing/web-platform/meta/css/css-text-decor/text-emphasis-style-006.html.ini
@@ -1,4 +1,5 @@
[text-emphasis-style-006.html]
disabled:
if (os == "android") and e10s: bug 1550895 (frequently fails on geckoview)
+ fuzzy:
if os == "mac": maxDifference=0-96;totalPixels=0-12
diff --git a/testing/web-platform/meta/css/css-text/word-break/word-break-break-all-004.html.ini b/testing/web-platform/meta/css/css-text/word-break/word-break-break-all-004.html.ini
deleted file mode 100644
index 7d42ee5ee3..0000000000
--- a/testing/web-platform/meta/css/css-text/word-break/word-break-break-all-004.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[word-break-break-all-004.html]
- expected:
- if (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL
diff --git a/testing/web-platform/meta/fetch/http-cache/heuristic.html.ini b/testing/web-platform/meta/fetch/http-cache/heuristic.html.ini
index 17b2b48eba..6984591b0e 100644
--- a/testing/web-platform/meta/fetch/http-cache/heuristic.html.ini
+++ b/testing/web-platform/meta/fetch/http-cache/heuristic.html.ini
@@ -2,9 +2,6 @@
[HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present.]
expected: FAIL
- [HTTP cache reuses a 204 No Content response with Last-Modified based upon heuristic freshness.]
- expected: FAIL
-
[HTTP cache reuses a 404 Not Found response with Last-Modified based upon heuristic freshness.]
expected: FAIL
@@ -20,9 +17,6 @@
[HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present]
expected: FAIL
- [HTTP cache reuses a 204 No Content response with Last-Modified based upon heuristic freshness]
- expected: FAIL
-
[HTTP cache reuses a 404 Not Found response with Last-Modified based upon heuristic freshness]
expected: FAIL
diff --git a/testing/web-platform/meta/fetch/http-cache/status.html.ini b/testing/web-platform/meta/fetch/http-cache/status.html.ini
index 50255f7305..44ba6a37c5 100644
--- a/testing/web-platform/meta/fetch/http-cache/status.html.ini
+++ b/testing/web-platform/meta/fetch/http-cache/status.html.ini
@@ -1,7 +1,4 @@
[status.html]
- [HTTP cache avoids going to the network if it has a fresh 204 response.]
- expected: FAIL
-
[HTTP cache avoids going to the network if it has a fresh 299 response.]
expected: FAIL
@@ -29,9 +26,6 @@
[HTTP cache avoids going to the network if it has a fresh 599 response.]
expected: FAIL
- [HTTP cache avoids going to the network if it has a fresh 204 response]
- expected: FAIL
-
[HTTP cache avoids going to the network if it has a fresh 299 response]
expected: FAIL
diff --git a/testing/web-platform/meta/fetch/metadata/appcache.tentative.https.sub.html.ini b/testing/web-platform/meta/fetch/metadata/appcache.tentative.https.sub.html.ini
new file mode 100644
index 0000000000..c60048add4
--- /dev/null
+++ b/testing/web-platform/meta/fetch/metadata/appcache.tentative.https.sub.html.ini
@@ -0,0 +1,5 @@
+[appcache.tentative.https.sub.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
+ [Appcache!]
+ expected: FAIL
+
diff --git a/testing/web-platform/meta/fetch/metadata/redirect/redirect-http-upgrade.tentative.sub.html.ini b/testing/web-platform/meta/fetch/metadata/redirect/redirect-http-upgrade.tentative.sub.html.ini
new file mode 100644
index 0000000000..ee901042b7
--- /dev/null
+++ b/testing/web-platform/meta/fetch/metadata/redirect/redirect-http-upgrade.tentative.sub.html.ini
@@ -0,0 +1,35 @@
+[redirect-http-upgrade.tentative.sub.html]
+ expected: TIMEOUT
+ [Http upgrade embed]
+ expected: FAIL
+
+ [Http upgrade top level navigation]
+ expected: FAIL
+
+ [Http upgrade iframe]
+ expected: FAIL
+
+ [Http upgrade script => No headers]
+ expected: FAIL
+
+ [Http upgrade image => No headers]
+ expected: NOTRUN
+
+ [Http upgrade font => No headers]
+ expected: NOTRUN
+
+ [Http upgrade object]
+ expected: FAIL
+
+ [Http upgrade stylesheet]
+ expected: TIMEOUT
+
+ [Http upgrade prefetch => No headers]
+ expected: [FAIL, TIMEOUT]
+
+ [Http upgrade track]
+ expected: NOTRUN
+
+ [Http upgrade fetch() api]
+ expected: FAIL
+
diff --git a/testing/web-platform/meta/fetch/metadata/redirect/redirect-https-downgrade.tentative.sub.html.ini b/testing/web-platform/meta/fetch/metadata/redirect/redirect-https-downgrade.tentative.sub.html.ini
new file mode 100644
index 0000000000..8fab04e775
--- /dev/null
+++ b/testing/web-platform/meta/fetch/metadata/redirect/redirect-https-downgrade.tentative.sub.html.ini
@@ -0,0 +1,3 @@
+[redirect-https-downgrade.tentative.sub.html]
+ [redirect-https-downgrade]
+ expected: FAIL
diff --git a/testing/web-platform/meta/fetch/sec-metadata/fetch.tentative.sub.html.ini b/testing/web-platform/meta/fetch/sec-metadata/fetch.tentative.sub.html.ini
new file mode 100644
index 0000000000..4e912bd50f
--- /dev/null
+++ b/testing/web-platform/meta/fetch/sec-metadata/fetch.tentative.sub.html.ini
@@ -0,0 +1,3 @@
+[fetch.tentative.sub.html]
+ [http->https fetch (cross-scheme => cross-site)]
+ expected: FAIL
diff --git a/testing/web-platform/meta/fetch/sec-metadata/iframe.tentative.sub.html.ini b/testing/web-platform/meta/fetch/sec-metadata/iframe.tentative.sub.html.ini
new file mode 100644
index 0000000000..6130bc332f
--- /dev/null
+++ b/testing/web-platform/meta/fetch/sec-metadata/iframe.tentative.sub.html.ini
@@ -0,0 +1,3 @@
+[iframe.tentative.sub.html]
+ [Secure, cross-site (cross-scheme, same-host) iframe]
+ expected: FAIL
diff --git a/testing/web-platform/meta/fetch/sec-metadata/redirect/__dir__.ini b/testing/web-platform/meta/fetch/sec-metadata/redirect/__dir__.ini
new file mode 100644
index 0000000000..0023ae85ce
--- /dev/null
+++ b/testing/web-platform/meta/fetch/sec-metadata/redirect/__dir__.ini
@@ -0,0 +1,2 @@
+lsan-allowed: [Alloc, Create, Malloc, Realloc, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::WeakPtr, mozilla::net::CookieSettings::Create, mozilla::net::nsStandardURL::TemplatedMutator, nsNodeSupportsWeakRefTearoff::GetWeakReference, nsPrefetchService::EnqueueURI]
+leak-threshold: [tab:51200]
diff --git a/testing/web-platform/meta/fetch/sec-metadata/redirect/multiple-redirect-https-downgrade-upgrade.tentative.sub.html.ini b/testing/web-platform/meta/fetch/sec-metadata/redirect/multiple-redirect-https-downgrade-upgrade.tentative.sub.html.ini
new file mode 100644
index 0000000000..27467bdc79
--- /dev/null
+++ b/testing/web-platform/meta/fetch/sec-metadata/redirect/multiple-redirect-https-downgrade-upgrade.tentative.sub.html.ini
@@ -0,0 +1,46 @@
+[multiple-redirect-https-downgrade-upgrade.tentative.sub.html]
+ expected: TIMEOUT
+ [Https downgrade-upgrade stylesheet => No headers]
+ expected: TIMEOUT
+
+ [Https downgrade-upgrade iframe => No headers]
+ expected: FAIL
+
+ [Https downgrade-upgrade top level navigation => No headers]
+ expected: FAIL
+
+ [Https downgrade-upgrade image => No headers]
+ expected: NOTRUN
+
+ [Https downgrade-upgrade script => No headers]
+ expected: FAIL
+
+ [Https downgrade-upgrade track => No headers]
+ expected: NOTRUN
+
+ [Https downgrade-upgrade fetch() api => No headers]
+ expected: FAIL
+
+ [Https downgrade-upgrade font => No headers]
+ expected: NOTRUN
+
+ [Https downgrade-upgrade prefetch => No headers]
+ disabled:
+ if (os == "win") and debug and webrender: wpt-sync Bug 1565002
+ if (os == "linux") and webrender and debug: wpt-sync Bug 1565002
+ if (os == "linux") and webrender and not debug: wpt-sync Bug 1565002
+ if (os == "linux") and not webrender and not debug and (processor == "x86_64"): wpt-sync Bug 1565002
+ if (os == "linux") and not webrender and not debug and (processor == "x86"): wpt-sync Bug 1565002
+ if (os == "linux") and not webrender and debug and sw-e10s: wpt-sync Bug 1565002
+ if (os == "linux") and not webrender and debug and not sw-e10s: wpt-sync Bug 1565002
+ wpt-sync Bug 1565002
+ expected: FAIL
+
+ [Https downgrade-upgrade embed => No headers]
+ expected: FAIL
+
+ [Https downgrade-upgrade object => No headers]
+ expected: FAIL
+
+ [multiple-redirect-https-downgrade-upgrade]
+ expected: FAIL
diff --git a/testing/web-platform/meta/fetch/sec-metadata/redirect/redirect-https-downgrade.tentative.sub.html.ini b/testing/web-platform/meta/fetch/sec-metadata/redirect/redirect-https-downgrade.tentative.sub.html.ini
deleted file mode 100644
index 85ae9be1a7..0000000000
--- a/testing/web-platform/meta/fetch/sec-metadata/redirect/redirect-https-downgrade.tentative.sub.html.ini
+++ /dev/null
@@ -1,19 +0,0 @@
-[redirect-https-downgrade.tentative.sub.html]
- expected: TIMEOUT
- [Https downgrade track => No headers]
- expected: NOTRUN
-
- [Https downgrade font => No headers]
- expected: NOTRUN
-
- [Https downgrade prefetch => No headers]
- expected:
- if (os == "linux"): ["FAIL", "TIMEOUT"]
- if os == "android": PASS
- FAIL
-
- [Https downgrade stylesheet => No headers]
- expected: TIMEOUT
-
- [Https downgrade image => No headers]
- expected: NOTRUN
diff --git a/testing/web-platform/meta/html/browsers/offline/appcache/appcache-iframe.https.html.ini b/testing/web-platform/meta/html/browsers/offline/appcache/appcache-iframe.https.html.ini
new file mode 100644
index 0000000000..334779ac49
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/appcache/appcache-iframe.https.html.ini
@@ -0,0 +1,2 @@
+[appcache-iframe.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/appcache/workers/appcache-worker.https.html.ini b/testing/web-platform/meta/html/browsers/offline/appcache/workers/appcache-worker.https.html.ini
index 5d87618ca0..9cff70457f 100644
--- a/testing/web-platform/meta/html/browsers/offline/appcache/workers/appcache-worker.https.html.ini
+++ b/testing/web-platform/meta/html/browsers/offline/appcache/workers/appcache-worker.https.html.ini
@@ -1,4 +1,5 @@
[appcache-worker.https.html]
+ prefs: [browser.cache.offline.storage.enable:true]
disabled:
if verify: fails in verify mode
expected: TIMEOUT
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_checking-manual.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_checking-manual.html.ini
new file mode 100644
index 0000000000..809a0297ca
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_checking-manual.html.ini
@@ -0,0 +1,2 @@
+[api_status_checking-manual.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_downloading-manual.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_downloading-manual.html.ini
new file mode 100644
index 0000000000..6c0b0f1e5e
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_downloading-manual.html.ini
@@ -0,0 +1,2 @@
+[api_status_downloading-manual.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_idle.https.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_idle.https.html.ini
new file mode 100644
index 0000000000..113be6a1a8
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_idle.https.html.ini
@@ -0,0 +1,2 @@
+[api_status_idle.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_obsolete-manual.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_obsolete-manual.html.ini
new file mode 100644
index 0000000000..08a33bd291
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_obsolete-manual.html.ini
@@ -0,0 +1,2 @@
+[api_status_obsolete-manual.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_uncached.https.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_uncached.https.html.ini
new file mode 100644
index 0000000000..80d726fc7b
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_uncached.https.html.ini
@@ -0,0 +1,2 @@
+[api_status_uncached.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_updateready-manual.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_updateready-manual.html.ini
new file mode 100644
index 0000000000..875d63c141
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_status_updateready-manual.html.ini
@@ -0,0 +1,2 @@
+[api_status_updateready-manual.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_swapcache-manual.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_swapcache-manual.html.ini
new file mode 100644
index 0000000000..4e5317feb2
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_swapcache-manual.html.ini
@@ -0,0 +1,2 @@
+[api_swapcache-manual.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_swapcache_error.https.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_swapcache_error.https.html.ini
new file mode 100644
index 0000000000..043473bdee
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_swapcache_error.https.html.ini
@@ -0,0 +1,2 @@
+[api_swapcache_error.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_update.https.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_update.https.html.ini
new file mode 100644
index 0000000000..5db9746be9
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_update.https.html.ini
@@ -0,0 +1,2 @@
+[api_update.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_update_error.https.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_update_error.https.html.ini
index b46176cbf9..8713842068 100644
--- a/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_update_error.https.html.ini
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/api_update_error.https.html.ini
@@ -1,4 +1,5 @@
[api_update_error.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
[INVALID_STATE_ERR error test]
expected: FAIL
diff --git a/testing/web-platform/meta/html/browsers/offline/application-cache-api/secure_context.html.ini b/testing/web-platform/meta/html/browsers/offline/application-cache-api/secure_context.html.ini
index c7992f55fd..ee0e90ae9c 100644
--- a/testing/web-platform/meta/html/browsers/offline/application-cache-api/secure_context.html.ini
+++ b/testing/web-platform/meta/html/browsers/offline/application-cache-api/secure_context.html.ini
@@ -1,2 +1,2 @@
[secure_context.html]
- prefs: [browser.cache.offline.insecure.enable:false]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/manifest_url_check.https.https.html.ini b/testing/web-platform/meta/html/browsers/offline/manifest_url_check.https.https.html.ini
new file mode 100644
index 0000000000..9c18286313
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/manifest_url_check.https.https.html.ini
@@ -0,0 +1,2 @@
+[manifest_url_check.https.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
diff --git a/testing/web-platform/meta/html/browsers/offline/no-appcache-in-shared-workers-historical.https.html.ini b/testing/web-platform/meta/html/browsers/offline/no-appcache-in-shared-workers-historical.https.html.ini
new file mode 100644
index 0000000000..ab450952b7
--- /dev/null
+++ b/testing/web-platform/meta/html/browsers/offline/no-appcache-in-shared-workers-historical.https.html.ini
@@ -0,0 +1,4 @@
+[no-appcache-in-shared-workers-historical.https.html]
+ prefs: [browser.cache.offline.storage.enable:true,browser.cache.offline.enable:true]
+ disabled:
+ if (os == "win"): Bug 1581711
diff --git a/testing/web-platform/meta/html/dom/idlharness.https.html.ini b/testing/web-platform/meta/html/dom/idlharness.https.html.ini
index 6858ac7ae6..5f256a4c47 100644
--- a/testing/web-platform/meta/html/dom/idlharness.https.html.ini
+++ b/testing/web-platform/meta/html/dom/idlharness.https.html.ini
@@ -480,9 +480,6 @@ prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.head
[External interface: operation IsSearchProviderInstalled()]
expected: FAIL
- [SVGElement interface: attribute nonce]
- expected: FAIL
-
[TextMetrics interface: attribute fontBoundingBoxAscent]
expected: FAIL
@@ -723,6 +720,9 @@ prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.head
[OffscreenCanvasRenderingContext2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean)]
expected: FAIL
+ [Navigator interface: operation registerProtocolHandler(DOMString, USVString)]
+ expected: FAIL
+
[idlharness.https.html?include=(Document|Window)]
[Document interface: documentWithHandlers must inherit property "onsecuritypolicyviolation" with the proper type]
@@ -921,9 +921,6 @@ prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.head
[HTMLInputElement interface: createInput("week") must inherit property "dirName" with the proper type]
expected: FAIL
- [HTMLLinkElement interface: attribute imageSizes]
- expected: FAIL
-
[HTMLVideoElement interface: document.createElement("video") must inherit property "playsInline" with the proper type]
expected: FAIL
@@ -939,9 +936,6 @@ prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.head
[HTMLDialogElement interface: attribute open]
expected: FAIL
- [HTMLLinkElement interface: document.createElement("link") must inherit property "imageSizes" with the proper type]
- expected: FAIL
-
[HTMLInputElement interface: createInput("tel") must inherit property "dirName" with the proper type]
expected: FAIL
@@ -999,18 +993,12 @@ prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.head
[HTMLDialogElement interface: attribute returnValue]
expected: FAIL
- [HTMLLinkElement interface: document.createElement("link") must inherit property "imageSrcset" with the proper type]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("video") must inherit property "videoTracks" with the proper type]
expected: FAIL
[HTMLMediaElement interface: new Audio() must inherit property "getStartDate()" with the proper type]
expected: FAIL
- [HTMLElement interface: attribute nonce]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("video") must inherit property "audioTracks" with the proper type]
expected: FAIL
@@ -1020,15 +1008,9 @@ prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.head
[HTMLElement interface: attribute autocapitalize]
expected: FAIL
- [HTMLLinkElement interface: attribute imageSrcset]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("audio") must inherit property "getStartDate()" with the proper type]
expected: FAIL
- [HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type]
- expected: FAIL
-
[HTMLInputElement interface: createInput("month") must inherit property "dirName" with the proper type]
expected: FAIL
diff --git a/testing/web-platform/meta/html/semantics/embedded-content/media-elements/autoplay-with-broken-track.html.ini b/testing/web-platform/meta/html/semantics/embedded-content/media-elements/autoplay-with-broken-track.html.ini
deleted file mode 100644
index 973a390764..0000000000
--- a/testing/web-platform/meta/html/semantics/embedded-content/media-elements/autoplay-with-broken-track.html.ini
+++ /dev/null
@@ -1,13 +0,0 @@
-[autoplay-with-broken-track.html]
- expected: TIMEOUT
- disabled:
- if debug and (os == "linux") and (processor == "x86"): https://bugzilla.mozilla.org/show_bug.cgi?id=1482405
- [
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-element-src-change.html b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-element-src-change.html
index 34a53d1531..f3c78668b4 100644
--- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-element-src-change.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-element-src-change.html
@@ -18,9 +18,7 @@
assert_equals(cues[cues.length-1].text, 'I said Bear is coming now!!!! Tab separators.', "Last cue content check");
++stage;
testTrack.src = "resources/entities.vtt";
- // CuesList will be cleared in a microtask. Spec claims that this should happen immediately,
- // but all known implementations are doing this asynchronously.
- assert_equals(cues.length, 4, "Number of cues immediately after 'src' mutation with the new URL");
+ assert_equals(cues.length, 0, "cues list is reset immediately after 'src' mutation with the new URL");
break;
case 1:
assert_equals(testTrack.readyState, HTMLTrackElement.LOADED), "readyState after loading of the second track";
@@ -54,4 +52,4 @@
testTrack.onerror = t.unreached_func("'error' event should not fire");
});
-
\ No newline at end of file
+
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-mode-not-changed-by-new-track.html b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-mode-not-changed-by-new-track.html
index 2902ba90bc..3ec47a39e2 100644
--- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-mode-not-changed-by-new-track.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-mode-not-changed-by-new-track.html
@@ -33,11 +33,12 @@ async_test(function(t) {
assert_equals(track1.track.cues.length, 12);
assert_equals(track1.track.cues[11].startTime, 22);
- // Add a caption track, configured to load automatically.
+ // Add a caption track, and explicitly enable it.
track2 = document.createElement('track');
track2.setAttribute('kind', 'captions');
track2.setAttribute('default', 'default');
track2.setAttribute('src', 'resources/webvtt-file.vtt');
+ track2.track.mode = 'showing';
track2.onload = t.step_func(captionsTrackLoaded);
video.appendChild(track2);
}
@@ -56,7 +57,7 @@ async_test(function(t) {
track3.mode = 'showing';
}
- function trackAdded() {
+ function trackAdded(event) {
// Check that metadata track state has not changed.
assert_equals(track1.readyState, HTMLTrackElement.LOADED);
assert_equals(track1.track.mode, 'hidden');
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-selection-task-order.html b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-selection-task-order.html
new file mode 100644
index 0000000000..522d067adf
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-selection-task-order.html
@@ -0,0 +1,36 @@
+
+
HTMLTrackElement Text Track Selection Task Order
+
+
+
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/currentSrc-blob-cache.html b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/currentSrc-blob-cache.html
new file mode 100644
index 0000000000..a5e108dcd6
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/currentSrc-blob-cache.html
@@ -0,0 +1,45 @@
+
+
+currentSrc is right even if underlying image is a shared blob
+
+
+
+
+
+
+
+
diff --git a/testing/web-platform/tests/interfaces/fullscreen.idl b/testing/web-platform/tests/interfaces/fullscreen.idl
index 491aa7af13..677b2e116f 100644
--- a/testing/web-platform/tests/interfaces/fullscreen.idl
+++ b/testing/web-platform/tests/interfaces/fullscreen.idl
@@ -14,15 +14,15 @@ dictionary FullscreenOptions {
};
partial interface Element {
- Promise requestFullscreen(optional FullscreenOptions options);
+ Promise requestFullscreen(optional FullscreenOptions options = {});
attribute EventHandler onfullscreenchange;
attribute EventHandler onfullscreenerror;
};
partial interface Document {
- [LenientSetter] readonly attribute boolean fullscreenEnabled;
- [LenientSetter, Unscopable] readonly attribute boolean fullscreen; // historical
+ [LegacyLenientSetter] readonly attribute boolean fullscreenEnabled;
+ [LegacyLenientSetter, Unscopable] readonly attribute boolean fullscreen; // historical
Promise exitFullscreen();
@@ -31,5 +31,5 @@ partial interface Document {
};
partial interface mixin DocumentOrShadowRoot {
- [LenientSetter] readonly attribute Element? fullscreenElement;
+ [LegacyLenientSetter] readonly attribute Element? fullscreenElement;
};
diff --git a/testing/web-platform/tests/interfaces/html.idl b/testing/web-platform/tests/interfaces/html.idl
index 3a5c8f0e25..c9018f1b63 100644
--- a/testing/web-platform/tests/interfaces/html.idl
+++ b/testing/web-platform/tests/interfaces/html.idl
@@ -1,7 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
-// Source: HTML Standard (https://html.spec.whatwg.org/)
+// Source: HTML Standard (https://html.spec.whatwg.org/multipage/)
[Exposed=Window,
LegacyUnenumerableNamedProperties]
@@ -45,10 +45,10 @@ interface DOMStringList {
enum DocumentReadyState { "loading", "interactive", "complete" };
typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
-[OverrideBuiltins]
+[LegacyOverrideBuiltIns]
partial interface Document {
// resource metadata management
- [PutForwards=href, Unforgeable] readonly attribute Location? location;
+ [PutForwards=href, LegacyUnforgeable] readonly attribute Location? location;
attribute USVString domain;
readonly attribute USVString referrer;
attribute USVString cookie;
@@ -89,7 +89,7 @@ partial interface Document {
DOMString queryCommandValue(DOMString commandId);
// special event handler IDL attributes that only apply to Document objects
- [LenientThis] attribute EventHandler onreadystatechange;
+ [LegacyLenientThis] attribute EventHandler onreadystatechange;
// also has obsolete members
};
@@ -119,7 +119,7 @@ interface HTMLElement : Element {
[CEReactions] attribute boolean spellcheck;
[CEReactions] attribute DOMString autocapitalize;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
ElementInternals attachInternals();
};
@@ -145,7 +145,7 @@ interface mixin HTMLOrSVGElement {
};
[Exposed=Window,
- OverrideBuiltins]
+ LegacyOverrideBuiltIns]
interface DOMStringMap {
getter DOMString (DOMString name);
[CEReactions] setter void (DOMString name, DOMString value);
@@ -155,8 +155,6 @@ interface DOMStringMap {
[Exposed=Window]
interface HTMLHtmlElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -196,8 +194,6 @@ interface HTMLLinkElement : HTMLElement {
[CEReactions] attribute USVString imageSrcset;
[CEReactions] attribute DOMString imageSizes;
[CEReactions] attribute DOMString referrerPolicy;
-
- // also has obsolete members
};
HTMLLinkElement includes LinkStyle;
@@ -208,8 +204,6 @@ interface HTMLMetaElement : HTMLElement {
[CEReactions] attribute DOMString name;
[CEReactions] attribute DOMString httpEquiv;
[CEReactions] attribute DOMString content;
-
- // also has obsolete members
};
[Exposed=Window]
@@ -217,16 +211,12 @@ interface HTMLStyleElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute DOMString media;
-
- // also has obsolete members
};
HTMLStyleElement includes LinkStyle;
[Exposed=Window]
interface HTMLBodyElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
HTMLBodyElement includes WindowEventHandlers;
@@ -234,29 +224,21 @@ HTMLBodyElement includes WindowEventHandlers;
[Exposed=Window]
interface HTMLHeadingElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLParagraphElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLHRElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLPreElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -273,22 +255,16 @@ interface HTMLOListElement : HTMLElement {
[CEReactions] attribute boolean reversed;
[CEReactions] attribute long start;
[CEReactions] attribute DOMString type;
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLUListElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLMenuElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -296,22 +272,16 @@ interface HTMLLIElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute long value;
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLDListElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLDivElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -329,8 +299,6 @@ interface HTMLAnchorElement : HTMLElement {
[CEReactions] attribute DOMString text;
[CEReactions] attribute DOMString referrerPolicy;
-
- // also has obsolete members
};
HTMLAnchorElement includes HTMLHyperlinkElementUtils;
@@ -356,8 +324,6 @@ interface HTMLSpanElement : HTMLElement {
[Exposed=Window]
interface HTMLBRElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
interface mixin HTMLHyperlinkElementUtils {
@@ -399,7 +365,7 @@ interface HTMLSourceElement : HTMLElement {
};
[Exposed=Window,
- NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
+ LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height)]
interface HTMLImageElement : HTMLElement {
[HTMLConstructor] constructor();
@@ -421,8 +387,6 @@ interface HTMLImageElement : HTMLElement {
[CEReactions] attribute DOMString loading;
Promise decode();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -442,8 +406,6 @@ interface HTMLIFrameElement : HTMLElement {
readonly attribute Document? contentDocument;
readonly attribute WindowProxy? contentWindow;
Document? getSVGDocument();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -455,8 +417,6 @@ interface HTMLEmbedElement : HTMLElement {
[CEReactions] attribute DOMString width;
[CEReactions] attribute DOMString height;
Document? getSVGDocument();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -480,8 +440,6 @@ interface HTMLObjectElement : HTMLElement {
boolean checkValidity();
boolean reportValidity();
void setCustomValidity(DOMString error);
-
- // also has obsolete members
};
[Exposed=Window]
@@ -490,8 +448,6 @@ interface HTMLParamElement : HTMLElement {
[CEReactions] attribute DOMString name;
[CEReactions] attribute DOMString value;
-
- // also has obsolete members
};
[Exposed=Window]
@@ -507,7 +463,7 @@ interface HTMLVideoElement : HTMLMediaElement {
};
[Exposed=Window,
- NamedConstructor=Audio(optional DOMString src)]
+ LegacyFactoryFunction=Audio(optional DOMString src)]
interface HTMLAudioElement : HTMLMediaElement {
[HTMLConstructor] constructor();
};
@@ -737,8 +693,6 @@ interface HTMLAreaElement : HTMLElement {
[CEReactions] attribute DOMString rel;
[SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
[CEReactions] attribute DOMString referrerPolicy;
-
- // also has obsolete members
};
HTMLAreaElement includes HTMLHyperlinkElementUtils;
@@ -764,15 +718,11 @@ interface HTMLTableElement : HTMLElement {
[SameObject] readonly attribute HTMLCollection rows;
HTMLTableRowElement insertRow(optional long index = -1);
[CEReactions] void deleteRow(long index);
-
- // also has obsolete members
};
[Exposed=Window]
interface HTMLTableCaptionElement : HTMLElement {
[HTMLConstructor] constructor();
-
- // also has obsolete members
};
[Exposed=Window]
@@ -780,8 +730,6 @@ interface HTMLTableColElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute unsigned long span;
-
- // also has obsolete members
};
[Exposed=Window]
@@ -791,8 +739,6 @@ interface HTMLTableSectionElement : HTMLElement {
[SameObject] readonly attribute HTMLCollection rows;
HTMLTableRowElement insertRow(optional long index = -1);
[CEReactions] void deleteRow(long index);
-
- // also has obsolete members
};
[Exposed=Window]
@@ -804,8 +750,6 @@ interface HTMLTableRowElement : HTMLElement {
[SameObject] readonly attribute HTMLCollection cells;
HTMLTableCellElement insertCell(optional long index = -1);
[CEReactions] void deleteCell(long index);
-
- // also has obsolete members
};
[Exposed=Window]
@@ -819,12 +763,10 @@ interface HTMLTableCellElement : HTMLElement {
[CEReactions] attribute DOMString scope; // only conforming for th elements
[CEReactions] attribute DOMString abbr; // only conforming for th elements
-
- // also has obsolete members
};
[Exposed=Window,
- OverrideBuiltins,
+ LegacyOverrideBuiltIns,
LegacyUnenumerableNamedProperties]
interface HTMLFormElement : HTMLElement {
[HTMLConstructor] constructor();
@@ -898,7 +840,7 @@ interface HTMLInputElement : HTMLElement {
[CEReactions] attribute DOMString step;
[CEReactions] attribute DOMString type;
[CEReactions] attribute DOMString defaultValue;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString value;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString value;
attribute object? valueAsDate;
attribute unrestricted double valueAsNumber;
[CEReactions] attribute unsigned long width;
@@ -922,8 +864,6 @@ interface HTMLInputElement : HTMLElement {
void setRangeText(DOMString replacement);
void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve");
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
-
- // also has obsolete members
};
[Exposed=Window]
@@ -1004,7 +944,7 @@ interface HTMLOptGroupElement : HTMLElement {
};
[Exposed=Window,
- NamedConstructor=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
+ LegacyFactoryFunction=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
interface HTMLOptionElement : HTMLElement {
[HTMLConstructor] constructor();
@@ -1039,7 +979,7 @@ interface HTMLTextAreaElement : HTMLElement {
readonly attribute DOMString type;
[CEReactions] attribute DOMString defaultValue;
- attribute [TreatNullAs=EmptyString] DOMString value;
+ attribute [LegacyNullToEmptyString] DOMString value;
readonly attribute unsigned long textLength;
readonly attribute boolean willValidate;
@@ -1130,8 +1070,6 @@ interface HTMLLegendElement : HTMLElement {
[HTMLConstructor] constructor();
readonly attribute HTMLFormElement? form;
-
- // also has obsolete members
};
enum SelectionMode {
@@ -1210,7 +1148,6 @@ interface HTMLScriptElement : HTMLElement {
[CEReactions] attribute DOMString integrity;
[CEReactions] attribute DOMString referrerPolicy;
- // also has obsolete members
};
[Exposed=Window]
@@ -1332,7 +1269,7 @@ interface mixin CanvasFillStrokeStyles {
attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
- CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
+ CanvasPattern? createPattern(CanvasImageSource image, [LegacyNullToEmptyString] DOMString repetition);
};
@@ -1656,11 +1593,11 @@ dictionary DragEventInit : MouseEventInit {
LegacyUnenumerableNamedProperties]
interface Window : EventTarget {
// the current browsing context
- [Unforgeable] readonly attribute WindowProxy window;
+ [LegacyUnforgeable] readonly attribute WindowProxy window;
[Replaceable] readonly attribute WindowProxy self;
- [Unforgeable] readonly attribute Document document;
+ [LegacyUnforgeable] readonly attribute Document document;
attribute DOMString name;
- [PutForwards=href, Unforgeable] readonly attribute Location location;
+ [PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
readonly attribute History history;
readonly attribute CustomElementRegistry customElements;
[Replaceable] readonly attribute BarProp locationbar;
@@ -1679,11 +1616,11 @@ interface Window : EventTarget {
// other browsing contexts
[Replaceable] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length;
- [Unforgeable] readonly attribute WindowProxy? top;
+ [LegacyUnforgeable] readonly attribute WindowProxy? top;
attribute any opener;
[Replaceable] readonly attribute WindowProxy? parent;
readonly attribute Element? frameElement;
- WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [TreatNullAs=EmptyString] DOMString features = "");
+ WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = "");
getter object (DOMString name);
// Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic
// object on the prototype chain. Indeed, this does not make the global object an exotic object.
@@ -1731,21 +1668,21 @@ interface History {
[Exposed=Window]
interface Location { // but see also additional creation steps and overridden internal methods
- [Unforgeable] stringifier attribute USVString href;
- [Unforgeable] readonly attribute USVString origin;
- [Unforgeable] attribute USVString protocol;
- [Unforgeable] attribute USVString host;
- [Unforgeable] attribute USVString hostname;
- [Unforgeable] attribute USVString port;
- [Unforgeable] attribute USVString pathname;
- [Unforgeable] attribute USVString search;
- [Unforgeable] attribute USVString hash;
+ [LegacyUnforgeable] stringifier attribute USVString href;
+ [LegacyUnforgeable] readonly attribute USVString origin;
+ [LegacyUnforgeable] attribute USVString protocol;
+ [LegacyUnforgeable] attribute USVString host;
+ [LegacyUnforgeable] attribute USVString hostname;
+ [LegacyUnforgeable] attribute USVString port;
+ [LegacyUnforgeable] attribute USVString pathname;
+ [LegacyUnforgeable] attribute USVString search;
+ [LegacyUnforgeable] attribute USVString hash;
- [Unforgeable] void assign(USVString url);
- [Unforgeable] void replace(USVString url);
- [Unforgeable] void reload();
+ [LegacyUnforgeable] void assign(USVString url);
+ [LegacyUnforgeable] void replace(USVString url);
+ [LegacyUnforgeable] void reload();
- [Unforgeable, SameObject] readonly attribute DOMStringList ancestorOrigins;
+ [LegacyUnforgeable, SameObject] readonly attribute DOMStringList ancestorOrigins;
};
[Exposed=Window,
@@ -1850,15 +1787,15 @@ dictionary PromiseRejectionEventInit : EventInit {
any reason;
};
-[TreatNonObjectAsNull]
+[LegacyTreatNonObjectAsNull]
callback EventHandlerNonNull = any (Event event);
typedef EventHandlerNonNull? EventHandler;
-[TreatNonObjectAsNull]
+[LegacyTreatNonObjectAsNull]
callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long colno, optional any error);
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
-[TreatNonObjectAsNull]
+[LegacyTreatNonObjectAsNull]
callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event);
typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
@@ -1899,13 +1836,12 @@ interface mixin GlobalEventHandlers {
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
- [LenientThis] attribute EventHandler onmouseenter;
- [LenientThis] attribute EventHandler onmouseleave;
+ [LegacyLenientThis] attribute EventHandler onmouseenter;
+ [LegacyLenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
- attribute EventHandler onwheel;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
@@ -1926,6 +1862,11 @@ interface mixin GlobalEventHandlers {
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
+ attribute EventHandler onwebkitanimationend;
+ attribute EventHandler onwebkitanimationiteration;
+ attribute EventHandler onwebkitanimationstart;
+ attribute EventHandler onwebkittransitionend;
+ attribute EventHandler onwheel;
};
interface mixin WindowEventHandlers {
@@ -1978,6 +1919,21 @@ interface mixin WindowOrWorkerGlobalScope {
Window includes WindowOrWorkerGlobalScope;
WorkerGlobalScope includes WindowOrWorkerGlobalScope;
+[Exposed=Window]
+interface DOMParser {
+ constructor();
+
+ [NewObject] Document parseFromString(DOMString string, DOMParserSupportedType type);
+};
+
+enum DOMParserSupportedType {
+ "text/html",
+ "text/xml",
+ "application/xml",
+ "application/xhtml+xml",
+ "image/svg+xml"
+};
+
[Exposed=Window]
interface Navigator {
// objects implementing this interface also implement the interfaces given below
@@ -2013,7 +1969,7 @@ interface mixin NavigatorLanguage {
};
interface mixin NavigatorContentUtils {
- [SecureContext] void registerProtocolHandler(DOMString scheme, USVString url, DOMString title);
+ [SecureContext] void registerProtocolHandler(DOMString scheme, USVString url);
[SecureContext] void unregisterProtocolHandler(DOMString scheme, USVString url);
};
@@ -2405,8 +2361,8 @@ interface HTMLFrameElement : HTMLElement {
readonly attribute Document? contentDocument;
readonly attribute WindowProxy? contentWindow;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginHeight;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginWidth;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginHeight;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginWidth;
};
partial interface HTMLAnchorElement {
@@ -2422,11 +2378,11 @@ partial interface HTMLAreaElement {
};
partial interface HTMLBodyElement {
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString text;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString link;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vLink;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString aLink;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString text;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString link;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString vLink;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString aLink;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
[CEReactions] attribute DOMString background;
};
@@ -2470,7 +2426,7 @@ partial interface HTMLEmbedElement {
interface HTMLFontElement : HTMLElement {
[HTMLConstructor] constructor();
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString color;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString color;
[CEReactions] attribute DOMString face;
[CEReactions] attribute DOMString size;
};
@@ -2497,8 +2453,8 @@ partial interface HTMLIFrameElement {
[CEReactions] attribute DOMString frameBorder;
[CEReactions] attribute USVString longDesc;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginHeight;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString marginWidth;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginHeight;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString marginWidth;
};
partial interface HTMLImageElement {
@@ -2509,7 +2465,7 @@ partial interface HTMLImageElement {
[CEReactions] attribute unsigned long vspace;
[CEReactions] attribute USVString longDesc;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString border;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString border;
};
partial interface HTMLInputElement {
@@ -2550,7 +2506,7 @@ partial interface HTMLObjectElement {
[CEReactions] attribute DOMString codeBase;
[CEReactions] attribute DOMString codeType;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString border;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString border;
};
partial interface HTMLOListElement {
@@ -2588,9 +2544,9 @@ partial interface HTMLTableElement {
[CEReactions] attribute DOMString summary;
[CEReactions] attribute DOMString width;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString cellPadding;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString cellSpacing;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString cellPadding;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString cellSpacing;
};
partial interface HTMLTableSectionElement {
@@ -2611,7 +2567,7 @@ partial interface HTMLTableCellElement {
[CEReactions] attribute boolean noWrap;
[CEReactions] attribute DOMString vAlign;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
};
partial interface HTMLTableRowElement {
@@ -2620,7 +2576,7 @@ partial interface HTMLTableRowElement {
[CEReactions] attribute DOMString chOff;
[CEReactions] attribute DOMString vAlign;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
};
partial interface HTMLUListElement {
@@ -2629,11 +2585,11 @@ partial interface HTMLUListElement {
};
partial interface Document {
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString linkColor;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor;
- [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString fgColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString linkColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString vlinkColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString alinkColor;
+ [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
[SameObject] readonly attribute HTMLCollection anchors;
[SameObject] readonly attribute HTMLCollection applets;
diff --git a/testing/web-platform/tests/mixed-content/generic/expect.py b/testing/web-platform/tests/mixed-content/generic/expect.py
deleted file mode 100644
index 2c360c1d93..0000000000
--- a/testing/web-platform/tests/mixed-content/generic/expect.py
+++ /dev/null
@@ -1,106 +0,0 @@
-import json, os, urllib, urlparse
-
-def redirect(url, response):
- response.add_required_headers = False
- response.writer.write_status(301)
- response.writer.write_header("access-control-allow-origin", "*")
- response.writer.write_header("location", url)
- response.writer.end_headers()
- response.writer.write("")
-
-def create_redirect_url(request, swap_scheme = False):
- parsed = urlparse.urlsplit(request.url)
- destination_netloc = parsed.netloc
- scheme = parsed.scheme
-
- if swap_scheme:
- scheme = "http" if parsed.scheme == "https" else "https"
- hostname = parsed.netloc.split(':')[0]
- port = request.server.config["ports"][scheme][0]
- destination_netloc = ":".join([hostname, str(port)])
-
- # Remove "redirection" from query to avoid redirect loops.
- parsed_query = dict(urlparse.parse_qsl(parsed.query))
- assert "redirection" in parsed_query
- del parsed_query["redirection"]
-
- destination_url = urlparse.urlunsplit(urlparse.SplitResult(
- scheme = scheme,
- netloc = destination_netloc,
- path = parsed.path,
- query = urllib.urlencode(parsed_query),
- fragment = None))
-
- return destination_url
-
-def main(request, response):
- if "redirection" in request.GET:
- redirection = request.GET["redirection"]
- if redirection == "no-redirect":
- pass
- elif redirection == "keep-scheme-redirect":
- redirect(create_redirect_url(request, swap_scheme=False), response)
- return
- elif redirection == "swap-scheme-redirect":
- redirect(create_redirect_url(request, swap_scheme=True), response)
- return
- else:
- raise ValueError ("Invalid redirect type: %s" % redirection)
-
- content_type = "text/plain"
- response_data = ""
-
- if "action" in request.GET:
- action = request.GET["action"]
-
- if "content_type" in request.GET:
- content_type = request.GET["content_type"]
-
- key = request.GET["key"]
- stash = request.server.stash
- path = request.GET.get("path", request.url.split('?'))[0]
-
- if action == "put":
- value = request.GET["value"]
- stash.take(key=key, path=path)
- stash.put(key=key, value=value, path=path)
- response_data = json.dumps({"status": "success", "result": key})
- elif action == "purge":
- value = stash.take(key=key, path=path)
- if content_type == "image/png":
- response_data = open(os.path.join(request.doc_root,
- "images",
- "smiley.png"), "rb").read()
- elif content_type == "audio/wav":
- response_data = open(os.path.join(request.doc_root,
- "webaudio", "resources", "sin_440Hz_-6dBFS_1s.wav"), "rb").read()
- elif content_type == "video/ogg":
- response_data = open(os.path.join(request.doc_root,
- "media",
- "movie_5.ogv"), "rb").read()
- elif content_type == "application/javascript":
- response_data = open(os.path.join(request.doc_root,
- "mixed-content",
- "generic",
- "worker.js"), "rb").read()
- elif content_type == "text/javascript":
- response_data = open(os.path.join(request.doc_root,
- "mixed-content",
- "generic",
- "script.js"), "rb").read()
- else:
- response_data = "/* purged */"
- elif action == "take":
- value = stash.take(key=key, path=path)
- if value is None:
- status = "allowed"
- else:
- status = "blocked"
- response_data = json.dumps({"status": status, "result": value})
-
- response.add_required_headers = False
- response.writer.write_status(200)
- response.writer.write_header("content-type", content_type)
- response.writer.write_header("cache-control", "no-cache; must-revalidate")
- response.writer.end_headers()
- response.writer.write(response_data)
diff --git a/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js b/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js
index b2c0bcdea1..eb9fc13f7c 100644
--- a/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js
+++ b/testing/web-platform/tests/mixed-content/generic/mixed-content-test-case.js
@@ -3,9 +3,48 @@
* @author burnik@google.com (Kristijan Burnik)
*/
-function wrapResult(server_data) {
- // Currently the returned value is not used in mixed-content tests.
- return null;
+// TODO: This function is currently placed and duplicated at:
+// - mixed-content/generic/mixed-content-test-case.js
+// - referrer-policy/generic/referrer-policy-test-case.js
+// but should be moved to /common/security-features/resources/common.js.
+function getSubresourceOrigin(originType) {
+ const httpProtocol = "http";
+ const httpsProtocol = "https";
+ const wsProtocol = "ws";
+ const wssProtocol = "wss";
+
+ const sameOriginHost = "{{host}}";
+ const crossOriginHost = "{{domains[www1]}}";
+
+ // These values can evaluate to either empty strings or a ":port" string.
+ const httpPort = getNormalizedPort(parseInt("{{ports[http][0]}}", 10));
+ const httpsPort = getNormalizedPort(parseInt("{{ports[https][0]}}", 10));
+ const wsPort = getNormalizedPort(parseInt("{{ports[ws][0]}}", 10));
+ const wssPort = getNormalizedPort(parseInt("{{ports[wss][0]}}", 10));
+
+ /**
+ @typedef OriginType
+ @type {string}
+
+ Represents the origin of the subresource request URL.
+ The keys of `originMap` below are the valid values.
+
+ Note that there can be redirects from the specified origin
+ (see RedirectionType), and thus the origin of the subresource
+ response URL might be different from what is specified by OriginType.
+ */
+ const originMap = {
+ "same-https": httpsProtocol + "://" + sameOriginHost + httpsPort,
+ "same-http": httpProtocol + "://" + sameOriginHost + httpPort,
+ "cross-https": httpsProtocol + "://" + crossOriginHost + httpsPort,
+ "cross-http": httpProtocol + "://" + crossOriginHost + httpPort,
+ "same-wss": wssProtocol + "://" + sameOriginHost + wssPort,
+ "same-ws": wsProtocol + "://" + sameOriginHost + wsPort,
+ "cross-wss": wssProtocol + "://" + crossOriginHost + wssPort,
+ "cross-ws": wsProtocol + "://" + crossOriginHost + wsPort,
+ };
+
+ return originMap[originType];
}
/**
@@ -21,156 +60,65 @@ function wrapResult(server_data) {
* @return {object} Object wrapping the start method used to run the test.
*/
function MixedContentTestCase(scenario, description, sanityChecker) {
- var httpProtocol = "http";
- var httpsProtocol = "https";
- var wsProtocol = "ws";
- var wssProtocol = "wss";
+ sanityChecker.checkScenario(scenario, subresourceMap);
- var sameOriginHost = location.hostname;
- var crossOriginHost = "{{domains[www1]}}";
-
- // These values can evaluate to either empty strings or a ":port" string.
- var httpPort = getNormalizedPort(parseInt("{{ports[http][0]}}", 10));
- var httpsPort = getNormalizedPort(parseInt("{{ports[https][0]}}", 10));
- var wsPort = getNormalizedPort(parseInt("{{ports[ws][0]}}", 10));
- var wssPort = getNormalizedPort(parseInt("{{ports[wss][0]}}", 10));
-
- var resourcePath = "/mixed-content/generic/expect.py";
- var wsResourcePath = "/stash_responder";
-
- // Map all endpoints to scenario for use in the test.
- var endpoint = {
- "same-origin":
- location.origin + resourcePath,
- "same-host-https":
- httpsProtocol + "://" + sameOriginHost + httpsPort + resourcePath,
- "same-host-http":
- httpProtocol + "://" + sameOriginHost + httpPort + resourcePath,
- "cross-origin-https":
- httpsProtocol + "://" + crossOriginHost + httpsPort + resourcePath,
- "cross-origin-http":
- httpProtocol + "://" + crossOriginHost + httpPort + resourcePath,
- "same-host-wss":
- wssProtocol + "://" + sameOriginHost + wssPort + wsResourcePath,
- "same-host-ws":
- wsProtocol + "://" + sameOriginHost + wsPort + wsResourcePath,
- "cross-origin-wss":
- wssProtocol + "://" + crossOriginHost + wssPort + wsResourcePath,
- "cross-origin-ws":
- wsProtocol + "://" + crossOriginHost + wsPort + wsResourcePath
- };
-
- // Mapping all the resource requesting methods to the scenario.
- var resourceMap = {
- "a-tag": requestViaAnchor,
- "area-tag": requestViaArea,
- "beacon-request": requestViaSendBeacon,
- "fetch-request": requestViaFetch,
- "form-tag": requestViaForm,
- "iframe-tag": requestViaIframe,
- "img-tag": requestViaImage,
- "script-tag": requestViaScript,
- "worker-request":
- url => requestViaDedicatedWorker(url),
- "module-worker-top-level":
- url => requestViaDedicatedWorker(url, {type: "module"}),
- "module-data-worker-import":
- url => requestViaDedicatedWorker(workerUrlThatImports(url), {type: "module"}),
- "classic-data-worker-fetch":
- url => requestViaDedicatedWorker(dedicatedWorkerUrlThatFetches(url), {}),
- "xhr-request": requestViaXhr,
- "audio-tag": requestViaAudio,
- "video-tag": requestViaVideo,
- "picture-tag": requestViaPicture,
- "object-tag": requestViaObject,
- "link-css-tag": requestViaLinkStylesheet,
- "link-prefetch-tag": requestViaLinkPrefetch,
- "websocket-request": requestViaWebSocket
- };
-
- // Mapping all expected MIME types to the scenario.
- var contentType = {
- "a-tag": "text/html",
- "area-tag": "text/html",
- "beacon-request": "text/plain",
- "fetch-request": "application/json",
- "form-tag": "text/html",
- "iframe-tag": "text/html",
- "img-tag": "image/png",
- "script-tag": "text/javascript",
-
- "worker-request": "application/javascript",
- "module-worker-top-level": "application/javascript",
- "module-data-worker-import": "application/javascript",
- "classic-data-worker-fetch": "application/javascript",
-
- "xhr-request": "application/json",
- "audio-tag": "audio/wav",
- "video-tag": "video/ogg",
- "picture-tag": "image/png",
- "object-tag": "text/html",
- "link-css-tag": "text/css",
- "link-prefetch-tag": "text/html",
- "websocket-request": "application/json"
- };
-
- for (const workletType of ['animation', 'audio', 'layout', 'paint']) {
- resourceMap[`worklet-${workletType}-top-level`] =
- url => requestViaWorklet(workletType, url);
- contentType[`worklet-${workletType}-top-level`] =
- "application/javascript";
-
- resourceMap[`worklet-${workletType}-data-import`] =
- url => requestViaWorklet(workletType, workerUrlThatImports(url));
- contentType[`worklet-${workletType}-data-import`] =
- "application/javascript";
+ let sourceContextList = [];
+ let subresourceType = scenario.subresource;
+ if (subresourceType === 'classic-data-worker-fetch') {
+ // Currently 'classic-data-worker-fetch' (fetch API from inside classic
+ // data: worker) is handled as a kind of subresource request
+ // on the genarator side, but should be processed using the combination of
+ // SourceContext list (classic data: worker) + Subresource (fetch API)
+ // on the JavaScript side.
+ // We bridge this inconsistency here, and will later pass these information
+ // directly from the generated tests and remove this conversion here.
+ subresourceType = 'fetch-request';
+ sourceContextList = [{sourceContextType: 'classic-data-worker'}];
}
- sanityChecker.checkScenario(scenario, resourceMap);
+ const originTypeConversion = {
+ "same-host-https": "same-https",
+ "same-host-http": "same-http",
+ "cross-origin-https": "cross-https",
+ "cross-origin-http": "cross-http",
+ "same-host-wss": "same-wss",
+ "same-host-ws": "same-ws",
+ "cross-origin-wss": "cross-wss",
+ "cross-origin-ws": "cross-ws",
+ };
- var mixed_content_test = async_test(description);
+ const urls = getRequestURLs(subresourceType,
+ originTypeConversion[scenario.origin],
+ scenario.redirection);
+ const checkResult = _ => {
+ // Send request to check if the key has been torn down.
+ return xhrRequest(urls.assertUrl)
+ .then(assertResult => {
+ // Now check if the value has been torn down. If it's still there,
+ // we have blocked the request to mixed-content.
+ assert_equals(assertResult.status, scenario.expectation,
+ "The resource request should be '" + scenario.expectation + "'.");
+ });
+ };
function runTest() {
- sanityChecker.setFailTimeout(mixed_content_test);
+ /** @type {Subresource} */
+ const subresource = {
+ subresourceType: subresourceType,
+ url: urls.testUrl,
+ policyDeliveries: []
+ };
- var key = guid();
- var value = guid();
- // We use the same path for both HTTP/S and WS/S stash requests.
- var stash_path = encodeURIComponent("/mixed-content");
- var announceResourceRequestUrl = endpoint['same-origin'] +
- "?action=put&key=" + key +
- "&value=" + value +
- "&path=" + stash_path;
- var assertResourceRequestUrl = endpoint['same-origin'] +
- "?action=take&key=" + key +
- "&path=" + stash_path;
- var resourceRequestUrl = endpoint[scenario.origin] + "?redirection=" +
- scenario.redirection + "&action=purge&key=" + key +
- "&path=" + stash_path + "&content_type=" +
- contentType[scenario.subresource];
-
- xhrRequest(announceResourceRequestUrl)
- .then(mixed_content_test.step_func(_ => {
+ promise_test(() => {
+ return xhrRequest(urls.announceUrl)
// Send out the real resource request.
// This should tear down the key if it's not blocked.
- return resourceMap[scenario.subresource](resourceRequestUrl);
- }))
- .then(mixed_content_test.step_func(_ => {
- // Send request to check if the key has been torn down.
- return xhrRequest(assertResourceRequestUrl);
- }))
- .catch(mixed_content_test.step_func(e => {
- // When requestResource fails, we also check the key state.
- return xhrRequest(assertResourceRequestUrl);
- }))
- .then(mixed_content_test.step_func_done(response => {
- // Now check if the value has been torn down. If it's still there,
- // we have blocked the request to mixed-content.
- assert_equals(response.status, scenario.expectation,
- "The resource request should be '" + scenario.expectation + "'.");
- }));
-
+ .then(_ => invokeRequest(subresource, sourceContextList))
+ // We check the key state, regardless of whether the main request
+ // succeeded or failed.
+ .then(checkResult, checkResult);
+ }, description);
} // runTest
- return {start: mixed_content_test.step_func(runTest) };
+ return {start: runTest};
} // MixedContentTestCase
diff --git a/testing/web-platform/tests/mixed-content/generic/script.js b/testing/web-platform/tests/mixed-content/generic/script.js
deleted file mode 100644
index 2d1cdf0a4b..0000000000
--- a/testing/web-platform/tests/mixed-content/generic/script.js
+++ /dev/null
@@ -1 +0,0 @@
-postMessage("", "*");
diff --git a/testing/web-platform/tests/mixed-content/generic/worker.js b/testing/web-platform/tests/mixed-content/generic/worker.js
deleted file mode 100644
index 7e2168bcc0..0000000000
--- a/testing/web-platform/tests/mixed-content/generic/worker.js
+++ /dev/null
@@ -1 +0,0 @@
-postMessage('done');
diff --git a/testing/web-platform/tests/referrer-policy/README.md b/testing/web-platform/tests/referrer-policy/README.md
index 164db5ef84..303362df92 100644
--- a/testing/web-platform/tests/referrer-policy/README.md
+++ b/testing/web-platform/tests/referrer-policy/README.md
@@ -223,7 +223,6 @@ var scenario = {
"source_protocol": "http",
"target_protocol": "http",
"subresource": "iframe-tag",
- "subresource_path": "/referrer-policy/generic/subresource/document.py",
"referrer_url": "origin"
};
```
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/README.md b/testing/web-platform/tests/referrer-policy/css-integration/README.md
index 14da25c4d9..150b0e6526 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/README.md
+++ b/testing/web-platform/tests/referrer-policy/css-integration/README.md
@@ -1,7 +1,7 @@
These tests exercise different ways to fetch a resource (image, font-face, svg
references), generated via the sub-resource python script in
```./generic/subresource/``` (for example, loading an image:
-```/referrer-policy/generic/subresource/image.py?id=```) and later verify
+```/common/security-features/subresource/image.py?id=```) and later verify
the headers used to fetch the resource.
Since there is no way to wait for a resource referenced from CSS to be loaded,
@@ -11,4 +11,4 @@ after the resource (hopefully) was loaded.
Since there is also no way to retrieve headers (or other information) from
resources loaded via CSS, we store the headers with the given ```UUID``` as key
on the server, and retrieve them later via an XHR, for example:
-```/referrer-policy/generic/subresource/image.py?id=&report-headers```.
+```/common/security-features/subresource/image.py?id=&report-headers```.
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html
index 2efb8000bc..0d26645aa7 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/child-css/external-import-stylesheet.html
@@ -21,9 +21,9 @@
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
+ "/common/security-features/subresource/stylesheet.py?id=" + id +
"&import-rule" + "&referrer-policy=no-referrer";
- let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
+ let check_url = url_prefix + "/common/security-features/subresource/stylesheet.py" +
"?id=" + id + "&report-headers";
return new Promise(resolve => {
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html
index 75db8b6a73..5e0ac6b270 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/child-css/internal-import-stylesheet.html
@@ -20,8 +20,8 @@
promise_test(function(css_test) {
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
- let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule";
- let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
+ let css_url = url_prefix + "/common/security-features/subresource/stylesheet.py?id=" + id + "&import-rule";
+ let check_url = url_prefix + "/common/security-features/subresource/stylesheet.py" +
"?id=" + id + "&report-headers";
let style = document.createElement("style");
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/child-css/processing-instruction.html b/testing/web-platform/tests/referrer-policy/css-integration/child-css/processing-instruction.html
index fed3d17b33..88474aae73 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/child-css/processing-instruction.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/child-css/processing-instruction.html
@@ -20,7 +20,7 @@
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
location.port +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" +
+ "/common/security-features/subresource/stylesheet.py?id=" +
id;
let css_url = url_prefix + "&import-rule";
let expected = url_prefix + "&import-rule";
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/css-test-helper.js b/testing/web-platform/tests/referrer-policy/css-integration/css-test-helper.js
index 0afa9e1b87..dc97ccc063 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/css-test-helper.js
+++ b/testing/web-platform/tests/referrer-policy/css-integration/css-test-helper.js
@@ -1,6 +1,6 @@
var svg_ns = "http://www.w3.org/2000/svg";
var url_prefix = location.protocol + "//" + location.hostname + ":" +
- location.port + "/referrer-policy/generic/subresource/";
+ location.port + "/common/security-features/subresource/";
var svg_test_properties = [
'fill',
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html
index 998a467755..164f8a5d1e 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-import-stylesheet.html
@@ -22,12 +22,12 @@
let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
+ "/common/security-features/subresource/stylesheet.py?id=" + id +
"&import-rule" + "&type=font";
let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
let css_referrer = url_prefix +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
- let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
+ "/common/security-features/subresource/stylesheet.py?id=" + id + "&type=font";
+ let font_url = url_prefix + "/common/security-features/subresource/font.py" +
"?id=" + id + "&report-headers" + "&type=font";
return new Promise(resolve => {
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-stylesheet.html
index d300e1445a..c7908939cc 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/external-stylesheet.html
@@ -20,8 +20,8 @@
promise_test(function(css_test) {
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
- let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
- let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
+ let css_url = url_prefix + "/common/security-features/subresource/stylesheet.py?id=" + id + "&type=font";
+ let font_url = url_prefix + "/common/security-features/subresource/font.py" +
"?id=" + id + "&report-headers";
return new Promise(resolve => {
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html
index 47d160bc20..74a3cbde0a 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-import-stylesheet.html
@@ -21,7 +21,7 @@
promise_test(function(css_test) {
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
- location.port + "/referrer-policy/generic/subresource/";
+ location.port + "/common/security-features/subresource/";
let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font";
let font_url = url_prefix + "font.py?report-headers&id=" + id;
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-stylesheet.html
index c05d08e391..078536ee38 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/internal-stylesheet.html
@@ -21,7 +21,7 @@
let id = token();
let css_url = location.protocol + "//www1." + location.hostname + ":" +
location.port +
- "/referrer-policy/generic/subresource/font.py" + "?id=" +
+ "/common/security-features/subresource/font.py" + "?id=" +
id + "&type=font";
let font_url = css_url + "&report-headers";
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/font-face/processing-instruction.html b/testing/web-platform/tests/referrer-policy/css-integration/font-face/processing-instruction.html
index e254743c49..bae74857f3 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/font-face/processing-instruction.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/font-face/processing-instruction.html
@@ -22,12 +22,12 @@
let id = token();
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
let css_url = url_prefix +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" +
+ "/common/security-features/subresource/stylesheet.py?id=" +
id + "&type=font";
let expected = url_prefix +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" +
+ "/common/security-features/subresource/stylesheet.py?id=" +
id + "&type=font";
- let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
+ let font_url = url_prefix + "/common/security-features/subresource/font.py" +
"?id=" + id + "&report-headers";
let processingInstruction =
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/image/external-import-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/image/external-import-stylesheet.html
index f572ab5c65..5f5069b715 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/image/external-import-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/image/external-import-stylesheet.html
@@ -21,13 +21,13 @@
promise_test(function(css_test) {
var id = token();
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
+ "/common/security-features/subresource/stylesheet.py?id=" + id +
"&import-rule" + "&type=image";
var url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
var css_referrer = url_prefix +
- "/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
+ "/common/security-features/subresource/stylesheet.py?id=" + id +
"&type=image";
- var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
+ var img_url = url_prefix + "/common/security-features/subresource/image.py" +
"?id=" + id + "&report-headers";
return new Promise(resolve => {
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/image/external-stylesheet.html b/testing/web-platform/tests/referrer-policy/css-integration/image/external-stylesheet.html
index 9c0d8b5ac1..a3b061d79e 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/image/external-stylesheet.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/image/external-stylesheet.html
@@ -20,8 +20,8 @@
promise_test(function(css_test) {
var id = token();
var url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
- var css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
- var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
+ var css_url = url_prefix + "/common/security-features/subresource/stylesheet.py?id=" + id;
+ var img_url = url_prefix + "/common/security-features/subresource/image.py" +
"?id=" + id + "&report-headers";
return new Promise(resolve => {
diff --git a/testing/web-platform/tests/referrer-policy/css-integration/image/inline-style.html b/testing/web-platform/tests/referrer-policy/css-integration/image/inline-style.html
index 9a2d3bdf1d..a0e9daabbc 100644
--- a/testing/web-platform/tests/referrer-policy/css-integration/image/inline-style.html
+++ b/testing/web-platform/tests/referrer-policy/css-integration/image/inline-style.html
@@ -19,7 +19,7 @@
-
+
Check that resources loaded via link rel prefetch use the referrer
and referrer policy from the document.
@@ -58,12 +57,6 @@
"properties": {},
"message": "assert_true: Original dictionary should be defined expected true got false"
},
- {
- "name": "Partial dictionary B: original dictionary defined",
- "status_string": "PASS",
- "properties": {},
- "message": null
- },
{
"name": "Partial dictionary B[2]: original dictionary defined",
"status_string": "PASS",
@@ -76,6 +69,12 @@
"properties": {},
"message": null
},
+ {
+ "name": "Partial dictionary B[4]: original dictionary defined",
+ "status_string": "PASS",
+ "properties": {},
+ "message": null
+ },
{
"name": "Partial dictionary C: original dictionary defined",
"status_string": "FAIL",
diff --git a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_immutable_prototype.html b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_immutable_prototype.html
index 7a5b17751b..40f5dbfcc7 100644
--- a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_immutable_prototype.html
+++ b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_immutable_prototype.html
@@ -89,7 +89,7 @@ idlArray.test();
"name": "Foo interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via Object.setPrototypeOf should throw a TypeError",
"status_string": "FAIL",
"properties": {},
- "message": "assert_throws: function \"function() {\n Object.setPrototypeOf(obj, newValue);\n }\" did not throw"
+ "message": "assert_throws_js: function \"function() {\n Object.setPrototypeOf(obj, newValue);\n }\" did not throw"
},
{
"name": "Foo interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via Reflect.setPrototypeOf should return false",
@@ -101,7 +101,7 @@ idlArray.test();
"name": "Foo interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via __proto__ should throw a TypeError",
"status_string": "FAIL",
"properties": {},
- "message": "assert_throws: function \"function() {\n obj.__proto__ = newValue;\n }\" did not throw"
+ "message": "assert_throws_js: function \"function() {\n obj.__proto__ = newValue;\n }\" did not throw"
},
{
"name": "Foo interface: internal [[SetPrototypeOf]] method of global platform object - setting to its original value via Object.setPrototypeOf should not throw",
@@ -125,7 +125,7 @@ idlArray.test();
"name": "Foo interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to a new value via Object.setPrototypeOf should throw a TypeError",
"status_string": "FAIL",
"properties": {},
- "message": "assert_throws: function \"function() {\n Object.setPrototypeOf(obj, newValue);\n }\" did not throw"
+ "message": "assert_throws_js: function \"function() {\n Object.setPrototypeOf(obj, newValue);\n }\" did not throw"
},
{
"name": "Foo interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to a new value via Reflect.setPrototypeOf should return false",
@@ -137,7 +137,7 @@ idlArray.test();
"name": "Foo interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to a new value via __proto__ should throw a TypeError",
"status_string": "FAIL",
"properties": {},
- "message": "assert_throws: function \"function() {\n obj.__proto__ = newValue;\n }\" did not throw"
+ "message": "assert_throws_js: function \"function() {\n obj.__proto__ = newValue;\n }\" did not throw"
},
{
"name": "Foo interface: internal [[SetPrototypeOf]] method of interface prototype object - setting to its original value via Object.setPrototypeOf should not throw",
diff --git a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_interface_mixin.html b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_interface_mixin.html
new file mode 100644
index 0000000000..a9a9094fe3
--- /dev/null
+++ b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_interface_mixin.html
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+ idlharness: interface mixins
+
+
+
+
+
+
+
+
+
Verify the series of sub-tests that are executed for "interface mixin" objects.
+
+
+
+
+
diff --git a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html
index 0c752bdc6c..d0e83af966 100644
--- a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html
+++ b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html
@@ -4,8 +4,7 @@
-
- idlharness: Partail interface
+ idlharness: Partial interface
@@ -94,6 +93,15 @@
assert_false('L' in idlArray.members, 'L should be picked up');
}, 'partial mixin dep implications');
})();
+
+ // Name clash (partials)
+ (() => {
+ const idlArray = new IdlArray();
+ idlArray.add_idls(`
+ interface M { attribute any A; };
+ partial interface M { attribute any A; };`);
+ idlArray.collapse_partials();
+ })();
+
+
+
+
diff --git a/testing/web-platform/tests/svg/styling/presentation-attributes-relevant.html b/testing/web-platform/tests/svg/styling/presentation-attributes-relevant.html
new file mode 100644
index 0000000000..b5f9343690
--- /dev/null
+++ b/testing/web-platform/tests/svg/styling/presentation-attributes-relevant.html
@@ -0,0 +1,20 @@
+
+
+SVG presentation attributes - on relevant elements
+
+
+
+
+
+
diff --git a/testing/web-platform/tests/svg/styling/presentation-attributes-special-cases.html b/testing/web-platform/tests/svg/styling/presentation-attributes-special-cases.html
new file mode 100644
index 0000000000..c544c9c7a6
--- /dev/null
+++ b/testing/web-platform/tests/svg/styling/presentation-attributes-special-cases.html
@@ -0,0 +1,149 @@
+
+
+SVG presentation attributes - special cases
+
+
+
+
+
+
diff --git a/testing/web-platform/tests/svg/styling/presentation-attributes-unknown.html b/testing/web-platform/tests/svg/styling/presentation-attributes-unknown.html
new file mode 100644
index 0000000000..487175b144
--- /dev/null
+++ b/testing/web-platform/tests/svg/styling/presentation-attributes-unknown.html
@@ -0,0 +1,20 @@
+
+
+SVG presentation attributes - on unknown SVG elements
+
+
+
+
+
+
diff --git a/testing/web-platform/tests/svg/styling/presentation-attributes.js b/testing/web-platform/tests/svg/styling/presentation-attributes.js
new file mode 100644
index 0000000000..c9dc14ad49
--- /dev/null
+++ b/testing/web-platform/tests/svg/styling/presentation-attributes.js
@@ -0,0 +1,385 @@
+const PROPERTIES = {
+ "alignment-baseline": {
+ value: "middle",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "baseline-shift": {
+ value: "1",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "clip-path": {
+ value: "url(#e)",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "clip-rule": {
+ value: "evenodd",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "color": {
+ value: "blue",
+ relevantElement: "g",
+ irrelevantElement: "image",
+ },
+ "color-interpolation-filters": {
+ value: "sRGB",
+ relevantElement: "filter",
+ irrelevantElement: "linearGradient",
+ },
+ "color-interpolation": {
+ value: "linearRGB",
+ relevantElement: "linearGradient",
+ irrelevantElement: "image",
+ },
+ "cursor": {
+ value: "pointer",
+ relevantElement: "g",
+ irrelevantElement: "defs",
+ },
+ "cx": {
+ value: "1",
+ relevantElement: "circle",
+ irrelevantElement: null,
+ },
+ "cy": {
+ value: "1",
+ relevantElement: "circle",
+ irrelevantElement: null,
+ },
+ "direction": {
+ value: "rtl",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "display": {
+ value: "block",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "d": {
+ value: "M0,0 L1,1",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "dominant-baseline": {
+ value: "middle",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "fill": {
+ value: "blue",
+ relevantElement: "g",
+ irrelevantElement: "image",
+ },
+ "fill-opacity": {
+ value: "0.5",
+ relevantElement: "g",
+ irrelevantElement: "image",
+ },
+ "fill-rule": {
+ value: "evenodd",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "filter": {
+ value: "url(#e)",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "flood-color": {
+ value: "blue",
+ relevantElement: "feFlood",
+ irrelevantElement: "rect",
+ },
+ "flood-opacity": {
+ value: "0.5",
+ relevantElement: "feFlood",
+ irrelevantElement: "rect",
+ },
+ "font-family": {
+ value: "Test Family",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "font-size": {
+ value: "50",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "font-size-adjust": {
+ value: "0.5",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "font-stretch": {
+ value: "expanded",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "font-style": {
+ value: "italic",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "font-variant": {
+ value: "small-caps",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "font-weight": {
+ value: "900",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "glyph-orientation-vertical": {
+ value: "90",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "height": {
+ value: "1",
+ relevantElement: "rect",
+ irrelevantElement: "path",
+ },
+ "image-rendering": {
+ value: "optimizeSpeed",
+ relevantElement: "image",
+ irrelevantElement: "path",
+ },
+ "letter-spacing": {
+ value: "1px",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "lighting-color": {
+ value: "blue",
+ relevantElement: "feDiffuseLighting",
+ irrelevantElement: "rect",
+ },
+ "marker-end": {
+ value: "url(#e)",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "marker-mid": {
+ value: "url(#e)",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "marker-start": {
+ value: "url(#e)",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "mask-type": {
+ value: "alpha",
+ relevantElement: "mask",
+ irrelevantElement: "rect",
+ },
+ "mask": {
+ value: "url(#e)",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "opacity": {
+ value: "0.5",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "overflow": {
+ value: "scroll",
+ relevantElement: "svg",
+ irrelevantElement: "rect",
+ },
+ "paint-order": {
+ value: "fill stroke",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "pointer-events": {
+ value: "none",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "r": {
+ value: "1",
+ relevantElement: "circle",
+ irrelevantElement: "rect",
+ },
+ "rx": {
+ value: "1",
+ relevantElement: "rect",
+ irrelevantElement: "path",
+ },
+ "ry": {
+ value: "1",
+ relevantElement: "rect",
+ irrelevantElement: "path",
+ },
+ "shape-rendering": {
+ value: "geometricPrecision",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stop-color": {
+ value: "blue",
+ relevantElement: "stop",
+ irrelevantElement: "rect",
+ },
+ "stop-opacity": {
+ value: "0.5",
+ relevantElement: "stop",
+ irrelevantElement: "rect",
+ },
+ "stroke": {
+ value: "blue",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stroke-dasharray": {
+ value: "1 1",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stroke-dashoffset": {
+ value: "1",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stroke-linecap": {
+ value: "round",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stroke-linejoin": {
+ value: "round",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stroke-miterlimit": {
+ value: "1",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stroke-opacity": {
+ value: "0.5",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "stroke-width": {
+ value: "2",
+ relevantElement: "path",
+ irrelevantElement: "image",
+ },
+ "text-anchor": {
+ value: "middle",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "text-decoration": {
+ value: "underline",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "text-overflow": {
+ value: "ellipsis",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "text-rendering": {
+ value: "geometricPrecision",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "transform-origin": {
+ value: "1px 1px",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "transform": {
+ value: "scale(2)",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "unicode-bidi": {
+ value: "embed",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "vector-effect": {
+ value: "non-scaling-stroke",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "visibility": {
+ value: "hidden",
+ relevantElement: "g",
+ irrelevantElement: "linearGradient",
+ },
+ "white-space": {
+ value: "pre",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "width": {
+ value: "1",
+ relevantElement: "rect",
+ irrelevantElement: "path",
+ },
+ "word-spacing": {
+ value: "1",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "writing-mode": {
+ value: "vertical-rl",
+ relevantElement: "text",
+ irrelevantElement: "rect",
+ },
+ "x": {
+ value: "1",
+ relevantElement: "rect",
+ irrelevantElement: "path",
+ },
+ "y": {
+ value: "1",
+ relevantElement: "rect",
+ irrelevantElement: "path",
+ },
+};
+
+function presentationAttributeIsSupported(element, attribute, value, property) {
+ let e = document.createElementNS("http://www.w3.org/2000/svg", element);
+ svg.append(e);
+ let propertyValueBefore = getComputedStyle(e).getPropertyValue(property);
+ e.setAttribute(attribute, value);
+ let propertyValueAfter = getComputedStyle(e).getPropertyValue(property);
+ e.remove();
+ return propertyValueBefore != propertyValueAfter;
+}
+
+function assertPresentationAttributeIsSupported(element, attribute, value, property) {
+ assert_true(
+ presentationAttributeIsSupported(element, attribute, value, property),
+ `Presentation attribute ${attribute}="${value}" should be supported on ${element} element`
+ );
+}
+
+function assertPresentationAttributeIsNotSupported(element, attribute, value, property) {
+ assert_false(
+ presentationAttributeIsSupported(element, attribute, value, property),
+ `Presentation attribute ${attribute}="${value}" should be supported on ${element} element`
+ );
+}
+
+function propertiesAreSupported(properties) {
+ for (let p of properties) {
+ if (!CSS.supports(p, "initial")) {
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/testing/web-platform/tests/upgrade-insecure-requests/support/testharness-helper.sub.js b/testing/web-platform/tests/upgrade-insecure-requests/support/testharness-helper.sub.js
index 70378edd15..8b58eb9560 100644
--- a/testing/web-platform/tests/upgrade-insecure-requests/support/testharness-helper.sub.js
+++ b/testing/web-platform/tests/upgrade-insecure-requests/support/testharness-helper.sub.js
@@ -1,9 +1,3 @@
-// Used by common.js.
-function wrapResult(server_data) {
- // Currently the returned value is not used in mixed-content tests.
- return null;
-}
-
const Host = {
SAME_ORIGIN: "same-origin",
CROSS_ORIGIN: "cross-origin",
diff --git a/testing/web-platform/tests/webgl/webgl1-idlharness.any.js b/testing/web-platform/tests/webgl/idlharness.any.js
similarity index 91%
rename from testing/web-platform/tests/webgl/webgl1-idlharness.any.js
rename to testing/web-platform/tests/webgl/idlharness.any.js
index 2cf8039523..d6131f4884 100644
--- a/testing/web-platform/tests/webgl/webgl1-idlharness.any.js
+++ b/testing/web-platform/tests/webgl/idlharness.any.js
@@ -7,7 +7,7 @@
'use strict';
idl_test(
- ['webgl1'],
+ ['webgl1', 'webgl2'],
['dom'],
idl_array => {
// TODO: objects
diff --git a/testing/web-platform/tests/webgl/webgl2-idlharness.any.js b/testing/web-platform/tests/webgl/webgl2-idlharness.any.js
deleted file mode 100644
index c8efcd031f..0000000000
--- a/testing/web-platform/tests/webgl/webgl2-idlharness.any.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// META: script=/resources/WebIDLParser.js
-// META: script=/resources/idlharness.js
-// META: timeout=long
-
-// https://www.khronos.org/registry/webgl/specs/latest/1.0/
-
-'use strict';
-
-idl_test(
- ['webgl2'],
- ['webgl1', 'dom'],
- idl_array => {
- // TODO: objects
- }
-);
diff --git a/testing/web-platform/tests/xhr/send-redirect-to-cors.htm b/testing/web-platform/tests/xhr/send-redirect-to-cors.htm
index 04a2a1ffe8..54d7eb550d 100644
--- a/testing/web-platform/tests/xhr/send-redirect-to-cors.htm
+++ b/testing/web-platform/tests/xhr/send-redirect-to-cors.htm
@@ -12,11 +12,11 @@
if (body === null) {
return { body: "", type: "NO" };
}
- if (typeof body == "string") {
+ if (typeof body === "string") {
return { body: body, type: "text/plain;charset=UTF-8" };
}
if (body instanceof Uint8Array) {
- var arr = Array.prototype.slice.call(body);
+ const arr = Array.prototype.slice.call(body);
return { body: String.fromCharCode.apply(null, arr), type: "NO" }
}
return { body: "EXTRACT NOT IMPLEMENTED", type: "EXTRACT NOT IMPLEMENTED" }
@@ -24,49 +24,54 @@
function redirect(code, name = code, method = "GET", body = null, explicitType = null, safelistContentType = false) {
async_test(t => {
- var client = new XMLHttpRequest()
+ let { body: expectedBody, type: expectedType } = extractBody(body);
+ if (explicitType !== null) {
+ expectedType = explicitType;
+ }
+ let expectedMethod = method;
+ if (((code === "301" || code === "302") && method === "POST") || (code === "303" && method !== "GET" && method !== "HEAD")) {
+ expectedMethod = "GET";
+ expectedBody = "";
+ expectedType = "NO";
+ }
+ const client = new XMLHttpRequest();
client.onreadystatechange = t.step_func(() => {
- if (client.readyState == 4) {
- if (explicitType !== "application/x-pony" || safelistContentType) {
- var { body: expectedBody, type: expectedType } = extractBody(body);
- if (explicitType !== null) {
- expectedType = explicitType
- }
- if (((code === "301" || code === "302") && method === "POST") || code === "303") {
- method = "GET"
- expectedBody = ""
- }
+ if (client.readyState === 4) {
+ if ((expectedMethod === "GET" && expectedType === "NO") || explicitType !== "application/x-pony" || safelistContentType) {
assert_equals(client.status, 200);
- assert_equals(client.getResponseHeader("x-request-method"), method);
+ assert_equals(client.getResponseHeader("x-request-method"), expectedMethod);
assert_equals(client.getResponseHeader("x-request-content-type"), expectedType);
assert_equals(client.getResponseHeader("x-request-data"), expectedBody);
} else {
// "application/x-pony" is not safelisted by corsenabled.py -> network error
- assert_equals(client.status, 0)
- assert_equals(client.statusText, "")
- assert_equals(client.responseText, "")
- assert_equals(client.responseXML, null)
+ assert_equals(client.status, 0);
+ assert_equals(client.statusText, "");
+ assert_equals(client.responseText, "");
+ assert_equals(client.responseXML, null);
}
t.done();
}
- })
- let safelist = ""
+ });
+ let safelist = "";
if (safelistContentType) {
- safelist = "?safelist_content_type"
+ safelist = "?safelist_content_type";
}
- client.open(method, "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.host+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.py')+safelist+"&code=" + code)
+ client.open(method, "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.host+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.py')+safelist+"&code=" + code);
if (explicitType !== null) {
- client.setRequestHeader("Content-Type", explicitType)
+ client.setRequestHeader("Content-Type", explicitType);
}
- client.send(body)
- }, document.title + " (" + name + ")")
+ client.send(body);
+ }, document.title + " (" + name + ")");
}
+ // corsenabled.py safelists methods GET, POST, PUT, and FOO
redirect("301")
redirect("301", "301 GET with explicit Content-Type", "GET", null, "application/x-pony")
redirect("301", "301 GET with explicit Content-Type safelisted", "GET", null, "application/x-pony", true)
+ redirect("303", "303 GET with explicit Content-Type safelisted", "GET", null, "application/x-pony", true)
redirect("302")
redirect("303")
- redirect("303", "303 LALA with string and explicit Content-Type safelisted", "LALA", "test", "application/x-pony", true)
+ redirect("302", "302 FOO with string and explicit Content-Type safelisted", "FOO", "test", "application/x-pony", true)
+ redirect("303", "303 FOO with string and explicit Content-Type safelisted", "FOO", "test", "application/x-pony", true)
redirect("307")
redirect("307", "307 post with null", "POST", null)
redirect("307", "307 post with string", "POST", "hello")
diff --git a/testing/xpcshell/moz-http2/moz-http2-child.js b/testing/xpcshell/moz-http2/moz-http2-child.js
new file mode 100644
index 0000000000..4d4cdc276d
--- /dev/null
+++ b/testing/xpcshell/moz-http2/moz-http2-child.js
@@ -0,0 +1,29 @@
+/* eslint-env node */
+
+function sendBackResponse(evalResult, e) {
+ const output = { result: evalResult, error: "", errorStack: "" };
+ if (e) {
+ output.error = e.toString();
+ output.errorStack = e.stack;
+ }
+ process.send(output);
+}
+
+process.on("message", msg => {
+ const code = msg.code;
+ let evalResult = null;
+ try {
+ // eslint-disable-next-line no-eval
+ evalResult = eval(code);
+ if (evalResult instanceof Promise) {
+ evalResult
+ .then(x => sendBackResponse(x))
+ .catch(e => sendBackResponse(undefined, e));
+ return;
+ }
+ } catch (e) {
+ sendBackResponse(undefined, e);
+ return;
+ }
+ sendBackResponse(evalResult);
+});
diff --git a/testing/xpcshell/moz-http2/moz-http2.js b/testing/xpcshell/moz-http2/moz-http2.js
index 7ff6133312..310ac836b9 100644
--- a/testing/xpcshell/moz-http2/moz-http2.js
+++ b/testing/xpcshell/moz-http2/moz-http2.js
@@ -5,24 +5,20 @@
// This module is the stateful server side of test_http2.js and is meant
// to have node be restarted in between each invocation
-var node_http2_root = '../node-http2';
+/* eslint-env node */
+
+var node_http2_root = "../node-http2";
if (process.env.NODE_HTTP2_ROOT) {
node_http2_root = process.env.NODE_HTTP2_ROOT;
}
var http2 = require(node_http2_root);
-var fs = require('fs');
-var net = require('net');
-var url = require('url');
-var crypto = require('crypto');
+var fs = require("fs");
+var url = require("url");
+var crypto = require("crypto");
const dnsPacket = require(`${node_http2_root}/../dns-packet`);
const ip = require(`${node_http2_root}/../node-ip`);
-
-let http2_internal = null;
-try {
- http2_internal = require('http2');
-} catch (_) {
- // silently ignored
-}
+const { fork } = require("child_process");
+const path = require("path");
// Hook into the decompression code to log the decompressed name-value pairs
var compression_module = node_http2_root + "/lib/protocol/compressor";
@@ -41,34 +37,34 @@ HeaderSetDecompressor.prototype.read = function() {
decompressedPairs.push(pair);
}
return pair;
-}
+};
var connection_module = node_http2_root + "/lib/protocol/connection";
var http2_connection = require(connection_module);
var Connection = http2_connection.Connection;
var originalClose = Connection.prototype.close;
-Connection.prototype.close = function (error, lastId) {
+Connection.prototype.close = function(error, lastId) {
if (lastId !== undefined) {
this._lastIncomingStream = lastId;
}
originalClose.apply(this, arguments);
-}
+};
var framer_module = node_http2_root + "/lib/protocol/framer";
var http2_framer = require(framer_module);
var Serializer = http2_framer.Serializer;
var originalTransform = Serializer.prototype._transform;
-var newTransform = function (frame, encoding, done) {
- if (frame.type == 'DATA') {
+var newTransform = function(frame, encoding, done) {
+ if (frame.type == "DATA") {
// Insert our empty DATA frame
- emptyFrame = {};
- emptyFrame.type = 'DATA';
- emptyFrame.data = new Buffer(0);
+ const emptyFrame = {};
+ emptyFrame.type = "DATA";
+ emptyFrame.data = Buffer.alloc(0);
emptyFrame.flags = [];
emptyFrame.stream = frame.stream;
var buffers = [];
- Serializer['DATA'](emptyFrame, buffers);
+ Serializer.DATA(emptyFrame, buffers);
Serializer.commonHeader(emptyFrame, buffers);
for (var i = 0; i < buffers.length; i++) {
this.push(buffers[i]);
@@ -80,20 +76,23 @@ var newTransform = function (frame, encoding, done) {
originalTransform.apply(this, arguments);
};
-function getHttpContent(path) {
- var content = '' +
- '' +
- 'HOORAY!' +
- // 'You Win!' used in tests to check we reached this server
- 'You Win! (by requesting' + path + ')' +
- '';
+function getHttpContent(pathName) {
+ var content =
+ "" +
+ "" +
+ "HOORAY!" +
+ // 'You Win!' used in tests to check we reached this server
+ "You Win! (by requesting" +
+ pathName +
+ ")" +
+ "";
return content;
}
function generateContent(size) {
- var content = '';
+ var content = "";
for (var i = 0; i < size; i++) {
- content += '0';
+ content += "0";
}
return content;
}
@@ -106,9 +105,9 @@ var m = {
mp1start: 0,
mp2start: 0,
- checkReady: function() {
+ checkReady() {
if (this.mp1res != null && this.mp2res != null) {
- this.buf = generateContent(30*1024);
+ this.buf = generateContent(30 * 1024);
this.mp1start = 0;
this.mp2start = 0;
this.send(this.mp1res, 0);
@@ -116,7 +115,7 @@ var m = {
}
},
- send: function(res, start) {
+ send(res, start) {
var end = Math.min(start + 1024, this.buf.length);
var content = this.buf.substring(start, end);
res.write(content);
@@ -125,29 +124,29 @@ var m = {
} else {
res.end();
}
- }
+ },
};
var runlater = function() {};
runlater.prototype = {
- req : null,
- resp : null,
+ req: null,
+ resp: null,
- onTimeout : function onTimeout() {
+ onTimeout: function onTimeout() {
this.resp.writeHead(200);
this.resp.end("It's all good 750ms.");
- }
+ },
};
var moreData = function() {};
moreData.prototype = {
- req : null,
- resp : null,
+ req: null,
+ resp: null,
iter: 3,
- onTimeout : function onTimeout() {
+ onTimeout: function onTimeout() {
// 1mb of data
- content = generateContent(1024*1024);
+ const content = generateContent(1024 * 1024);
this.resp.write(content); // 1mb chunk
this.iter--;
if (!this.iter) {
@@ -155,7 +154,7 @@ moreData.prototype = {
} else {
setTimeout(executeRunLater, 1, this);
}
- }
+ },
};
function executeRunLater(arg) {
@@ -168,16 +167,38 @@ var originalCompressHeaders = Compressor.prototype.compress;
function insertSoftIllegalHpack(headers) {
var originalCompressed = originalCompressHeaders.apply(this, headers);
- var illegalLiteral = new Buffer([
- 0x00, // Literal, no index
- 0x08, // Name: not huffman encoded, 8 bytes long
- 0x3a, 0x69, 0x6c, 0x6c, 0x65, 0x67, 0x61, 0x6c, // :illegal
- 0x10, // Value: not huffman encoded, 16 bytes long
- // REALLY NOT LEGAL
- 0x52, 0x45, 0x41, 0x4c, 0x4c, 0x59, 0x20, 0x4e, 0x4f, 0x54, 0x20, 0x4c, 0x45, 0x47, 0x41, 0x4c
+ var illegalLiteral = Buffer.from([
+ 0x00, // Literal, no index
+ 0x08, // Name: not huffman encoded, 8 bytes long
+ 0x3a,
+ 0x69,
+ 0x6c,
+ 0x6c,
+ 0x65,
+ 0x67,
+ 0x61,
+ 0x6c, // :illegal
+ 0x10, // Value: not huffman encoded, 16 bytes long
+ // REALLY NOT LEGAL
+ 0x52,
+ 0x45,
+ 0x41,
+ 0x4c,
+ 0x4c,
+ 0x59,
+ 0x20,
+ 0x4e,
+ 0x4f,
+ 0x54,
+ 0x20,
+ 0x4c,
+ 0x45,
+ 0x47,
+ 0x41,
+ 0x4c,
]);
var newBufferLength = originalCompressed.length + illegalLiteral.length;
- var concatenated = new Buffer(newBufferLength);
+ var concatenated = Buffer.alloc(newBufferLength);
originalCompressed.copy(concatenated, 0);
illegalLiteral.copy(concatenated, originalCompressed.length);
return concatenated;
@@ -193,7 +214,7 @@ function insertHardIllegalHpack(headers) {
// Set the first bit to 1 to signal this is an indexed representation
illegalIndexed[0] |= 0x80;
var newBufferLength = originalCompressed.length + illegalIndexed.length;
- var concatenated = new Buffer(newBufferLength);
+ var concatenated = Buffer.alloc(newBufferLength);
originalCompressed.copy(concatenated, 0);
illegalIndexed.copy(concatenated, originalCompressed.length);
return concatenated;
@@ -205,9 +226,9 @@ var didRst = false;
var rstConnection = null;
var illegalheader_conn = null;
-var ns_confirm = 0;
var cname_confirm = 0;
+// eslint-disable-next-line complexity
function handleRequest(req, res) {
// We do this first to ensure nothing goes wonky in our tests that don't want
// the headers to have something illegal in them
@@ -221,549 +242,579 @@ function handleRequest(req, res) {
var pushPushServer1, pushPushServer2, pushPushServer3, pushPushServer4;
if (req.httpVersionMajor === 2) {
- res.setHeader('X-Connection-Http2', 'yes');
- res.setHeader('X-Http2-StreamId', '' + req.stream.id);
+ res.setHeader("X-Connection-Http2", "yes");
+ res.setHeader("X-Http2-StreamId", "" + req.stream.id);
} else {
- res.setHeader('X-Connection-Http2', 'no');
+ res.setHeader("X-Connection-Http2", "no");
}
- if (u.pathname === '/exit') {
- res.setHeader('Content-Type', 'text/plain');
- res.setHeader('Connection', 'close');
+ if (u.pathname === "/exit") {
+ res.setHeader("Content-Type", "text/plain");
+ res.setHeader("Connection", "close");
res.writeHead(200);
- res.end('ok');
+ res.end("ok");
process.exit();
}
- if (u.pathname === '/750ms') {
- var rl = new runlater();
+ if (u.pathname === "/750ms") {
+ let rl = new runlater();
rl.req = req;
rl.resp = res;
setTimeout(executeRunLater, 750, rl);
return;
- }
-
- else if ((u.pathname === '/multiplex1') && (req.httpVersionMajor === 2)) {
- res.setHeader('Content-Type', 'text/plain');
+ } else if (u.pathname === "/multiplex1" && req.httpVersionMajor === 2) {
+ res.setHeader("Content-Type", "text/plain");
res.writeHead(200);
m.mp1res = res;
m.checkReady();
return;
- }
-
- else if ((u.pathname === '/multiplex2') && (req.httpVersionMajor === 2)) {
- res.setHeader('Content-Type', 'text/plain');
+ } else if (u.pathname === "/multiplex2" && req.httpVersionMajor === 2) {
+ res.setHeader("Content-Type", "text/plain");
res.writeHead(200);
m.mp2res = res;
m.checkReady();
return;
- }
-
- else if (u.pathname === "/header") {
+ } else if (u.pathname === "/header") {
var val = req.headers["x-test-header"];
if (val) {
res.setHeader("X-Received-Test-Header", val);
}
- }
-
- else if (u.pathname === "/doubleheader") {
- res.setHeader('Content-Type', 'text/html');
+ } else if (u.pathname === "/doubleheader") {
+ res.setHeader("Content-Type", "text/html");
res.writeHead(200);
res.write(content);
res.writeHead(200);
res.end();
return;
- }
-
- else if (u.pathname === "/cookie_crumbling") {
+ } else if (u.pathname === "/cookie_crumbling") {
res.setHeader("X-Received-Header-Pairs", JSON.stringify(decompressedPairs));
- }
-
- else if (u.pathname === "/push") {
- push = res.push('/push.js');
+ } else if (u.pathname === "/push") {
+ push = res.push("/push.js");
push.writeHead(200, {
- 'content-type': 'application/javascript',
- 'pushed' : 'yes',
- 'content-length' : 11,
- 'X-Connection-Http2': 'yes'
+ "content-type": "application/javascript",
+ pushed: "yes",
+ "content-length": 11,
+ "X-Connection-Http2": "yes",
});
- push.end('// comments');
+ push.end("// comments");
content = ' body text';
- }
-
- else if (u.pathname === "/push.js") {
- content = '// comments';
+ } else if (u.pathname === "/push.js") {
+ content = "// comments";
res.setHeader("pushed", "no");
- }
-
- else if (u.pathname === "/push2") {
- push = res.push('/push2.js');
+ } else if (u.pathname === "/push2") {
+ push = res.push("/push2.js");
push.writeHead(200, {
- 'content-type': 'application/javascript',
- 'pushed' : 'yes',
+ "content-type": "application/javascript",
+ pushed: "yes",
// no content-length
- 'X-Connection-Http2': 'yes'
+ "X-Connection-Http2": "yes",
});
- push.end('// comments');
+ push.end("// comments");
content = ' body text';
- }
-
- else if (u.pathname === "/push5") {
- push = res.push('/push5.js');
+ } else if (u.pathname === "/push5") {
+ push = res.push("/push5.js");
push.writeHead(200, {
- 'content-type': 'application/javascript',
- 'pushed' : 'yes',
+ "content-type": "application/javascript",
+ pushed: "yes",
// no content-length
- 'X-Connection-Http2': 'yes'
+ "X-Connection-Http2": "yes",
});
content = generateContent(1024 * 150);
push.write(content);
push.end();
content = ' body text';
- }
-
- else if (u.pathname === "/pushapi1") {
- push1 = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort, path : '/pushapi1/1', method : 'GET',
- headers: {'x-pushed-request': 'true', 'x-foo' : 'bar'}});
+ } else if (u.pathname === "/pushapi1") {
+ push1 = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushapi1/1",
+ method: "GET",
+ headers: { "x-pushed-request": "true", "x-foo": "bar" },
+ });
push1.writeHead(200, {
- 'pushed' : 'yes',
- 'content-length' : 1,
- 'subresource' : '1',
- 'X-Connection-Http2': 'yes'
- });
- push1.end('1');
+ pushed: "yes",
+ "content-length": 1,
+ subresource: "1",
+ "X-Connection-Http2": "yes",
+ });
+ push1.end("1");
- push1a = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort, path : '/pushapi1/1', method : 'GET',
- headers: {'x-foo' : 'bar', 'x-pushed-request': 'true'}});
+ push1a = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushapi1/1",
+ method: "GET",
+ headers: { "x-foo": "bar", "x-pushed-request": "true" },
+ });
push1a.writeHead(200, {
- 'pushed' : 'yes',
- 'content-length' : 1,
- 'subresource' : '1a',
- 'X-Connection-Http2': 'yes'
+ pushed: "yes",
+ "content-length": 1,
+ subresource: "1a",
+ "X-Connection-Http2": "yes",
});
- push1a.end('1');
+ push1a.end("1");
- push2 = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort, path : '/pushapi1/2', method : 'GET',
- headers: {'x-pushed-request': 'true'}});
+ push2 = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushapi1/2",
+ method: "GET",
+ headers: { "x-pushed-request": "true" },
+ });
push2.writeHead(200, {
- 'pushed' : 'yes',
- 'subresource' : '2',
- 'content-length' : 1,
- 'X-Connection-Http2': 'yes'
+ pushed: "yes",
+ subresource: "2",
+ "content-length": 1,
+ "X-Connection-Http2": "yes",
});
- push2.end('2');
+ push2.end("2");
- push3 = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort, path : '/pushapi1/3', method : 'GET',
- headers: {'x-pushed-request': 'true', 'Accept-Encoding' : 'br'}});
+ push3 = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushapi1/3",
+ method: "GET",
+ headers: { "x-pushed-request": "true", "Accept-Encoding": "br" },
+ });
push3.writeHead(200, {
- 'pushed' : 'yes',
- 'content-length' : 6,
- 'subresource' : '3',
- 'content-encoding' : 'br',
- 'X-Connection-Http2': 'yes'
+ pushed: "yes",
+ "content-length": 6,
+ subresource: "3",
+ "content-encoding": "br",
+ "X-Connection-Http2": "yes",
});
- push3.end(new Buffer([0x8b, 0x00, 0x80, 0x33, 0x0a, 0x03])); // '3\n'
+ push3.end(Buffer.from([0x8b, 0x00, 0x80, 0x33, 0x0a, 0x03])); // '3\n'
- content = '0';
- }
-
- else if (u.pathname === "/big") {
+ content = "0";
+ } else if (u.pathname === "/big") {
content = generateContent(128 * 1024);
- var hash = crypto.createHash('md5');
+ var hash = crypto.createHash("md5");
hash.update(content);
- var md5 = hash.digest('hex');
+ let md5 = hash.digest("hex");
res.setHeader("X-Expected-MD5", md5);
- }
-
- else if (u.pathname === "/huge") {
+ } else if (u.pathname === "/huge") {
content = generateContent(1024);
- res.setHeader('Content-Type', 'text/plain');
+ res.setHeader("Content-Type", "text/plain");
res.writeHead(200);
// 1mb of data
- for (var i = 0; i < (1024 * 1); i++) {
+ for (let i = 0; i < 1024 * 1; i++) {
res.write(content); // 1kb chunk
}
res.end();
return;
- }
-
- else if (u.pathname === "/post" || u.pathname === "/patch") {
+ } else if (u.pathname === "/post" || u.pathname === "/patch") {
if (req.method != "POST" && req.method != "PATCH") {
res.writeHead(405);
- res.end('Unexpected method: ' + req.method);
+ res.end("Unexpected method: " + req.method);
return;
}
- var post_hash = crypto.createHash('md5');
- req.on('data', function receivePostData(chunk) {
+ var post_hash = crypto.createHash("md5");
+ req.on("data", function receivePostData(chunk) {
post_hash.update(chunk.toString());
});
- req.on('end', function finishPost() {
- var md5 = post_hash.digest('hex');
- res.setHeader('X-Calculated-MD5', md5);
+ req.on("end", function finishPost() {
+ let md5 = post_hash.digest("hex");
+ res.setHeader("X-Calculated-MD5", md5);
res.writeHead(200);
res.end(content);
});
return;
- }
-
- else if (u.pathname === "/750msPost") {
+ } else if (u.pathname === "/750msPost") {
if (req.method != "POST") {
res.writeHead(405);
- res.end('Unexpected method: ' + req.method);
+ res.end("Unexpected method: " + req.method);
return;
}
var accum = 0;
- req.on('data', function receivePostData(chunk) {
+ req.on("data", function receivePostData(chunk) {
accum += chunk.length;
});
- req.on('end', function finishPost() {
- res.setHeader('X-Recvd', accum);
- var rl = new runlater();
+ req.on("end", function finishPost() {
+ res.setHeader("X-Recvd", accum);
+ let rl = new runlater();
rl.req = req;
rl.resp = res;
setTimeout(executeRunLater, 750, rl);
- return;
});
return;
- }
-
- else if (u.pathname === "/h11required_stream") {
+ } else if (u.pathname === "/h11required_stream") {
if (req.httpVersionMajor === 2) {
h11required_conn = req.stream.connection;
- res.stream.reset('HTTP_1_1_REQUIRED');
+ res.stream.reset("HTTP_1_1_REQUIRED");
return;
}
- }
-
- else if (u.pathname === "/bigdownload") {
-
- res.setHeader('Content-Type', 'text/html');
+ } else if (u.pathname === "/bigdownload") {
+ res.setHeader("Content-Type", "text/html");
res.writeHead(200);
- var rl = new moreData();
+ let rl = new moreData();
rl.req = req;
rl.resp = res;
setTimeout(executeRunLater, 1, rl);
return;
- }
-
- else if (u.pathname === "/h11required_session") {
+ } else if (u.pathname === "/h11required_session") {
if (req.httpVersionMajor === 2) {
if (h11required_conn !== req.stream.connection) {
h11required_header = "no";
}
- res.stream.connection.close('HTTP_1_1_REQUIRED', res.stream.id - 2);
+ res.stream.connection.close("HTTP_1_1_REQUIRED", res.stream.id - 2);
return;
- } else {
- res.setHeader('X-H11Required-Stream-Ok', h11required_header);
}
- }
-
- else if (u.pathname === "/rstonce") {
+ res.setHeader("X-H11Required-Stream-Ok", h11required_header);
+ } else if (u.pathname === "/rstonce") {
if (!didRst && req.httpVersionMajor === 2) {
didRst = true;
rstConnection = req.stream.connection;
- req.stream.reset('REFUSED_STREAM');
+ req.stream.reset("REFUSED_STREAM");
return;
}
- if (rstConnection === null ||
- rstConnection !== req.stream.connection) {
- res.setHeader('Connection', 'close');
+ if (rstConnection === null || rstConnection !== req.stream.connection) {
+ res.setHeader("Connection", "close");
res.writeHead(400);
res.end("WRONG CONNECTION, HOMIE!");
return;
}
if (req.httpVersionMajor != 2) {
- res.setHeader('Connection', 'close');
+ res.setHeader("Connection", "close");
}
res.writeHead(200);
res.end("It's all good.");
return;
- }
-
- else if (u.pathname === "/continuedheaders") {
- var pushRequestHeaders = {'x-pushed-request': 'true'};
- var pushResponseHeaders = {'content-type': 'text/plain',
- 'content-length': '2',
- 'X-Connection-Http2': 'yes'};
- var pushHdrTxt = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
- var pullHdrTxt = pushHdrTxt.split('').reverse().join('');
- for (var i = 0; i < 265; i++) {
- pushRequestHeaders['X-Push-Test-Header-' + i] = pushHdrTxt;
- res.setHeader('X-Pull-Test-Header-' + i, pullHdrTxt);
+ } else if (u.pathname === "/continuedheaders") {
+ var pushRequestHeaders = { "x-pushed-request": "true" };
+ var pushResponseHeaders = {
+ "content-type": "text/plain",
+ "content-length": "2",
+ "X-Connection-Http2": "yes",
+ };
+ var pushHdrTxt =
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ var pullHdrTxt = pushHdrTxt
+ .split("")
+ .reverse()
+ .join("");
+ for (let i = 0; i < 265; i++) {
+ pushRequestHeaders["X-Push-Test-Header-" + i] = pushHdrTxt;
+ res.setHeader("X-Pull-Test-Header-" + i, pullHdrTxt);
}
push = res.push({
- hostname: 'localhost:' + serverPort,
+ hostname: "localhost:" + serverPort,
port: serverPort,
- path: '/continuedheaders/push',
- method: 'GET',
- headers: pushRequestHeaders
+ path: "/continuedheaders/push",
+ method: "GET",
+ headers: pushRequestHeaders,
});
push.writeHead(200, pushResponseHeaders);
push.end("ok");
- }
-
- else if (u.pathname === "/altsvc1") {
- if (req.httpVersionMajor != 2 ||
+ } else if (u.pathname === "/altsvc1") {
+ if (
+ req.httpVersionMajor != 2 ||
req.scheme != "http" ||
- req.headers['alt-used'] != ("foo.example.com:" + serverPort)) {
+ req.headers["alt-used"] != "foo.example.com:" + serverPort
+ ) {
res.writeHead(400);
res.end("WHAT?");
return;
}
// test the alt svc frame for use with altsvc2
- res.altsvc("foo.example.com", serverPort, "h2", 3600, req.headers['x-redirect-origin']);
- }
-
- else if (u.pathname === "/altsvc2") {
- if (req.httpVersionMajor != 2 ||
+ res.altsvc(
+ "foo.example.com",
+ serverPort,
+ "h2",
+ 3600,
+ req.headers["x-redirect-origin"]
+ );
+ } else if (u.pathname === "/altsvc2") {
+ if (
+ req.httpVersionMajor != 2 ||
req.scheme != "http" ||
- req.headers['alt-used'] != ("foo.example.com:" + serverPort)) {
+ req.headers["alt-used"] != "foo.example.com:" + serverPort
+ ) {
res.writeHead(400);
res.end("WHAT?");
return;
- }
+ }
}
// for use with test_altsvc.js
else if (u.pathname === "/altsvc-test") {
- res.setHeader('Cache-Control', 'no-cache');
- res.setHeader('Alt-Svc', 'h2=' + req.headers['x-altsvc']);
+ res.setHeader("Cache-Control", "no-cache");
+ res.setHeader("Alt-Svc", "h2=" + req.headers["x-altsvc"]);
}
// for use with test_trr.js
else if (u.pathname === "/dns-cname") {
// asking for cname.example.com
- var content;
- if(0 == cname_confirm) {
+ let rContent;
+ if (0 == cname_confirm) {
// ... this sends a CNAME back to pointing-elsewhere.example.com
- content = new Buffer("00000100000100010000000005636E616D65076578616D706C6503636F6D0000050001C00C0005000100000037002012706F696E74696E672D656C73657768657265076578616D706C6503636F6D00", "hex");
+ rContent = Buffer.from(
+ "00000100000100010000000005636E616D65076578616D706C6503636F6D0000050001C00C0005000100000037002012706F696E74696E672D656C73657768657265076578616D706C6503636F6D00",
+ "hex"
+ );
cname_confirm++;
- }
- else {
+ } else {
// ... this sends an A 99.88.77.66 entry back for pointing-elsewhere.example.com
- content = new Buffer("00000100000100010000000012706F696E74696E672D656C73657768657265076578616D706C6503636F6D0000010001C00C0001000100000037000463584D42", "hex");
+ rContent = Buffer.from(
+ "00000100000100010000000012706F696E74696E672D656C73657768657265076578616D706C6503636F6D0000010001C00C0001000100000037000463584D42",
+ "hex"
+ );
}
- res.setHeader('Content-Type', 'application/dns-message');
- res.setHeader('Content-Length', content.length);
+ res.setHeader("Content-Type", "application/dns-message");
+ res.setHeader("Content-Length", rContent.length);
res.writeHead(200);
- res.write(content);
+ res.write(rContent);
res.end("");
return;
-
- }
- else if (u.pathname == "/doh") {
- ns_confirm = 0; // back to first reply for dns-confirm
+ } else if (u.pathname == "/doh") {
cname_confirm = 0; // back to first reply for dns-cname
- let responseIP = u.query["responseIP"];
+ let responseIP = u.query.responseIP;
if (!responseIP) {
responseIP = "5.5.5.5";
}
- if (u.query["auth"]) {
+ if (u.query.auth) {
// There's a Set-Cookie: header in the response for "/dns" , which this
// request subsequently would include if the http channel wasn't
// anonymous. Thus, if there's a cookie in this request, we know Firefox
// mishaved. If there's not, we're fine.
- if (req.headers['cookie']) {
+ if (req.headers.cookie) {
res.writeHead(403);
res.end("cookie for me, not for you");
return;
}
- if (req.headers['authorization'] != "user:password") {
+ if (req.headers.authorization != "user:password") {
res.writeHead(401);
res.end("bad boy!");
return;
}
}
- if (u.query["push"]) {
- // push.example.com has AAAA entry 2018::2018
- var pcontent= new Buffer("0000010000010001000000000470757368076578616D706C6503636F6D00001C0001C00C001C000100000037001020180000000000000000000000002018", "hex");
+ if (u.query.push) {
+ // push.example.org has AAAA entry 2018::2018
+ let pcontent = dnsPacket.encode({
+ id: 0,
+ type: "response",
+ flags: dnsPacket.RECURSION_DESIRED,
+ questions: [{ name: "push.example.org", type: "AAAA", class: "IN" }],
+ answers: [
+ {
+ name: "push.example.org",
+ type: "AAAA",
+ ttl: 55,
+ class: "IN",
+ flush: false,
+ data: "2018::2018",
+ },
+ ],
+ });
push = res.push({
- hostname: 'foo.example.com:' + serverPort,
+ hostname: "foo.example.com:" + serverPort,
port: serverPort,
- path: '/dns-pushed-response?dns=AAAAAAABAAAAAAAABHB1c2gHZXhhbXBsZQNjb20AABwAAQ',
- method: 'GET',
+ path:
+ "/dns-pushed-response?dns=AAAAAAABAAAAAAAABHB1c2gHZXhhbXBsZQNvcmcAABwAAQ",
+ method: "GET",
headers: {
- 'accept' : 'application/dns-message'
- }
+ accept: "application/dns-message",
+ },
});
push.writeHead(200, {
- 'content-type': 'application/dns-message',
- 'pushed' : 'yes',
- 'content-length' : pcontent.length,
- 'X-Connection-Http2': 'yes'
+ "content-type": "application/dns-message",
+ pushed: "yes",
+ "content-length": pcontent.length,
+ "X-Connection-Http2": "yes",
});
push.end(pcontent);
}
- let payload = new Buffer("");
+ let payload = Buffer.from("");
function emitResponse(response, requestPayload) {
let packet = dnsPacket.decode(requestPayload);
+ // This shuts down the connection so we can test if the client reconnects
+ if (
+ packet.questions.length > 0 &&
+ packet.questions[0].name == "closeme.com"
+ ) {
+ response.stream.connection.close("INTERNAL_ERROR", response.stream.id);
+ return;
+ }
+
+ function responseType() {
+ if (
+ packet.questions.length > 0 &&
+ packet.questions[0].name == "confirm.example.com" &&
+ packet.questions[0].type == "NS"
+ ) {
+ return "NS";
+ }
+
+ return ip.isV4Format(responseIP) ? "A" : "AAAA";
+ }
+
+ function responseData() {
+ if (
+ packet.questions.length > 0 &&
+ packet.questions[0].name == "confirm.example.com" &&
+ packet.questions[0].type == "NS"
+ ) {
+ return "ns.example.com";
+ }
+
+ return responseIP;
+ }
+
+ let answers = [];
+ if (responseIP != "none" && responseType() == packet.questions[0].type) {
+ answers.push({
+ name: u.query.hostname ? u.query.hostname : packet.questions[0].name,
+ ttl: 55,
+ type: responseType(),
+ flush: false,
+ data: responseData(),
+ });
+ }
+
+ if (u.query.cnameloop) {
+ answers.push({
+ name: "cname.example.com",
+ type: "CNAME",
+ ttl: 55,
+ class: "IN",
+ flush: false,
+ data: "pointing-elsewhere.example.com",
+ });
+ }
+
+ if (req.headers["accept-language"] || req.headers["user-agent"]) {
+ // If we get this header, don't send back any response. This should
+ // cause the tests to fail. This is easier then actually sending back
+ // the header value into test_trr.js
+ answers = [];
+ }
+
let buf = dnsPacket.encode({
- type: 'query',
+ type: "response",
id: packet.id,
flags: dnsPacket.RECURSION_DESIRED,
questions: packet.questions,
- answers: [{
- name: packet.questions[0].name,
- ttl: 55,
- type: ip.isV4Format(responseIP) ? "A" : "AAAA",
- flush: false,
- data: responseIP,
- }],
+ answers,
});
- response.setHeader('Content-Length', buf.length);
- response.setHeader('Set-Cookie', 'trackyou=yes; path=/; max-age=100000;');
- response.setHeader('Content-Type', 'application/dns-message');
- response.writeHead(200);
- response.write(buf);
- response.end("");
- return;
+ function writeResponse(resp, buffer) {
+ resp.setHeader("Content-Length", buffer.length);
+ resp.setHeader("Set-Cookie", "trackyou=yes; path=/; max-age=100000;");
+ resp.setHeader("Content-Type", "application/dns-message");
+ resp.writeHead(200);
+ resp.write(buffer);
+ resp.end("");
+ }
+
+ let delay = undefined;
+ if (packet.questions[0].type == "A") {
+ delay = u.query.delayIPv4;
+ } else if (packet.questions[0].type == "AAAA") {
+ delay = u.query.delayIPv6;
+ }
+
+ if (delay) {
+ setTimeout(
+ arg => {
+ writeResponse(arg[0], arg[1]);
+ },
+ parseInt(delay),
+ [response, buf]
+ );
+ return;
+ }
+
+ writeResponse(response, buf);
}
- if (u.query["dns"]) {
- payload = Buffer.from(u.query["dns"], 'base64');
+ if (u.query.dns) {
+ payload = Buffer.from(u.query.dns, "base64");
emitResponse(res, payload);
return;
}
- req.on('data', function receiveData(chunk) {
+ req.on("data", function receiveData(chunk) {
payload = Buffer.concat([payload, chunk]);
});
- req.on('end', function finishedData() {
+ req.on("end", function finishedData() {
emitResponse(res, payload);
- return;
});
return;
- }
- else if (u.pathname === "/dns-cname-a") {
+ } else if (u.pathname === "/dns-cname-a") {
// test23 asks for cname-a.example.com
// this responds with a CNAME to here.example.com *and* an A record
// for here.example.com
- var content;
+ let rContent;
- content = new Buffer("0000" +
- "0100" +
- "0001" + // QDCOUNT
- "0002" + // ANCOUNT
- "00000000" + // NSCOUNT + ARCOUNT
- "07636E616D652d61" + // cname-a
- "076578616D706C6503636F6D00" + // .example.com
- "00010001" + // question type (A) + question class (IN)
-
- // answer record 1
- "C00C" + // name pointer to cname-a.example.com
- "0005" + // type (CNAME)
- "0001" + // class
- "00000037" + // TTL
- "0012" + // RDLENGTH
- "0468657265" + // here
- "076578616D706C6503636F6D00" + // .example.com
-
- // answer record 2, the A entry for the CNAME above
- "0468657265" + // here
- "076578616D706C6503636F6D00" + // .example.com
- "0001" + // type (A)
- "0001" + // class
- "00000037" + // TTL
- "0004" + // RDLENGTH
- "09080706", // IPv4 address
- "hex");
- res.setHeader('Content-Type', 'application/dns-message');
- res.setHeader('Content-Length', content.length);
+ rContent = Buffer.from(
+ "0000" +
+ "0100" +
+ "0001" + // QDCOUNT
+ "0002" + // ANCOUNT
+ "00000000" + // NSCOUNT + ARCOUNT
+ "07636E616D652d61" + // cname-a
+ "076578616D706C6503636F6D00" + // .example.com
+ "00010001" + // question type (A) + question class (IN)
+ // answer record 1
+ "C00C" + // name pointer to cname-a.example.com
+ "0005" + // type (CNAME)
+ "0001" + // class
+ "00000037" + // TTL
+ "0012" + // RDLENGTH
+ "0468657265" + // here
+ "076578616D706C6503636F6D00" + // .example.com
+ // answer record 2, the A entry for the CNAME above
+ "0468657265" + // here
+ "076578616D706C6503636F6D00" + // .example.com
+ "0001" + // type (A)
+ "0001" + // class
+ "00000037" + // TTL
+ "0004" + // RDLENGTH
+ "09080706", // IPv4 address
+ "hex"
+ );
+ res.setHeader("Content-Type", "application/dns-message");
+ res.setHeader("Content-Length", rContent.length);
res.writeHead(200);
- res.write(content);
+ res.write(rContent);
res.end("");
return;
-
- }
- else if (u.pathname === "/dns-cname-loop") {
- // asking for cname.example.com
- var content;
- // ... this always sends a CNAME back to pointing-elsewhere.example.com. Loop time!
- content = new Buffer("00000100000100010000000005636E616D65076578616D706C6503636F6D0000050001C00C0005000100000037002012706F696E74696E672D656C73657768657265076578616D706C65C01A00", "hex");
- res.setHeader('Content-Type', 'application/dns-message');
- res.setHeader('Content-Length', content.length);
- res.writeHead(200);
- res.write(content);
- res.end("");
- return;
-
- }
- else if (u.pathname === "/dns-ns") {
- // confirm.example.com has NS entry ns.example.com
- var content= new Buffer("00000100000100010000000007636F6E6669726D076578616D706C6503636F6D0000020001C00C00020001000000370012026E73076578616D706C6503636F6D010A00", "hex");
- res.setHeader('Content-Type', 'application/dns-message');
- res.setHeader('Content-Length', content.length);
- res.writeHead(200);
- res.write(content);
- res.end("");
- return;
- }
- else if (u.pathname === '/dns-750ms') {
+ } else if (u.pathname === "/dns-750ms") {
// it's just meant to be this slow - the test doesn't care about the actual response
return;
}
- // for use with test_trr.js
- else if (u.pathname === "/dns-confirm") {
- if (0 == ns_confirm) {
- // confirm.example.com has NS entry ns.example.com
- var content= new Buffer("00000100000100010000000007636F6E6669726D076578616D706C6503636F6D0000020001C00C00020001000000370012026E73076578616D706C6503636F6D010A00", "hex");
- ns_confirm++;
- } else if (2 >= ns_confirm) {
- // next response: 10b-100.example.com has AAAA entry 1::FFFF
-
- // we expect two requests for this name (A + AAAA), respond identically
- // for both and expect the client to reject the wrong one
- var content= new Buffer("000001000001000100000000" + "073130622d313030" +
- "076578616D706C6503636F6D00001C0001C00C001C00010000003700100001000000000000000000000000FFFF", "hex");
- ns_confirm++;
- } else {
- // everything else is just wrong
- return;
- }
- res.setHeader('Content-Type', 'application/dns-message');
- res.setHeader('Content-Length', content.length);
- res.writeHead(200);
- res.write(content);
- res.end("");
- return;
- }
// for use with test_esni_dns_fetch.js
else if (u.pathname === "/esni-dns") {
- content = new Buffer("0000" +
- "8180" +
- "0001" + // QDCOUNT
- "0001" + // ANCOUNT
- "00000000" + // NSCOUNT + ARCOUNT
- "055F65736E69076578616D706C6503636F6D00" + // _esni.example.com
- "00100001" + // question type (TXT) + question class (IN)
+ content = Buffer.from(
+ "0000" +
+ "8180" +
+ "0001" + // QDCOUNT
+ "0001" + // ANCOUNT
+ "00000000" + // NSCOUNT + ARCOUNT
+ "055F65736E69076578616D706C6503636F6D00" + // _esni.example.com
+ "00100001" + // question type (TXT) + question class (IN)
+ "C00C" + // name pointer to .example.com
+ "0010" + // type (TXT)
+ "0001" + // class
+ "00000037" + // TTL
+ "0021" + // RDLENGTH
+ "2062586B67646D39705932556761584D6762586B676347467A63336476636D513D", // esni keys.
+ "hex"
+ );
- "C00C" + // name pointer to .example.com
- "0010" + // type (TXT)
- "0001" + // class
- "00000037" + // TTL
- "0021" + // RDLENGTH
- "2062586B67646D39705932556761584D6762586B676347467A63336476636D513D", // esni keys.
- "hex");
-
- res.setHeader('Content-Type', 'application/dns-message');
- res.setHeader('Content-Length', content.length);
+ res.setHeader("Content-Type", "application/dns-message");
+ res.setHeader("Content-Length", content.length);
res.writeHead(200);
res.write(content);
res.end("");
@@ -773,229 +824,262 @@ function handleRequest(req, res) {
// for use with test_esni_dns_fetch.js
else if (u.pathname === "/esni-dns-push") {
// _esni_push.example.com has A entry 127.0.0.1
- var content= new Buffer("0000010000010001000000000A5F65736E695F70757368076578616D706C6503636F6D0000010001C00C000100010000003700047F000001", "hex");
+ let rContent = Buffer.from(
+ "0000010000010001000000000A5F65736E695F70757368076578616D706C6503636F6D0000010001C00C000100010000003700047F000001",
+ "hex"
+ );
// _esni_push.example.com has TXT entry 2062586B67646D39705932556761584D6762586B676347467A63336476636D513D
- var pcontent= new Buffer("0000818000010001000000000A5F65736E695F70757368076578616D706C6503636F6D0000100001C00C001000010000003700212062586B67646D39705932556761584D6762586B676347467A63336476636D513D", "hex");
+ var pcontent = Buffer.from(
+ "0000818000010001000000000A5F65736E695F70757368076578616D706C6503636F6D0000100001C00C001000010000003700212062586B67646D39705932556761584D6762586B676347467A63336476636D513D",
+ "hex"
+ );
push = res.push({
- hostname: 'foo.example.com:' + serverPort,
+ hostname: "foo.example.com:" + serverPort,
port: serverPort,
- path: '/dns-pushed-response?dns=AAABAAABAAAAAAABCl9lc25pX3B1c2gHZXhhbXBsZQNjb20AABAAAQAAKRAAAAAAAAAIAAgABAABAAA',
- method: 'GET',
+ path:
+ "/dns-pushed-response?dns=AAABAAABAAAAAAABCl9lc25pX3B1c2gHZXhhbXBsZQNjb20AABAAAQAAKRAAAAAAAAAIAAgABAABAAA",
+ method: "GET",
headers: {
- 'accept' : 'application/dns-message'
- }
+ accept: "application/dns-message",
+ },
});
push.writeHead(200, {
- 'content-type': 'application/dns-message',
- 'pushed' : 'yes',
- 'content-length' : pcontent.length,
- 'X-Connection-Http2': 'yes'
+ "content-type": "application/dns-message",
+ pushed: "yes",
+ "content-length": pcontent.length,
+ "X-Connection-Http2": "yes",
});
push.end(pcontent);
- res.setHeader('Content-Type', 'application/dns-message');
- res.setHeader('Content-Length', content.length);
+ res.setHeader("Content-Type", "application/dns-message");
+ res.setHeader("Content-Length", rContent.length);
res.writeHead(200);
- res.write(content);
+ res.write(rContent);
res.end("");
return;
- }
-
- else if (u.pathname === "/.well-known/http-opportunistic") {
- res.setHeader('Cache-Control', 'no-cache');
- res.setHeader('Content-Type', 'application/json');
+ } else if (u.pathname === "/.well-known/http-opportunistic") {
+ res.setHeader("Cache-Control", "no-cache");
+ res.setHeader("Content-Type", "application/json");
res.writeHead(200, "OK");
- res.end('{"http://' + req.headers['host'] + '": { "tls-ports": [' + serverPort + '] }}');
+ res.end('["http://' + req.headers.host + '"]');
+ return;
+ } else if (u.pathname === "/stale-while-revalidate-loop-test") {
+ res.setHeader(
+ "Cache-Control",
+ "s-maxage=86400, stale-while-revalidate=86400, immutable"
+ );
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
+ res.setHeader("X-Content-Type-Options", "nosniff");
+ res.setHeader("Content-Length", "1");
+ res.writeHead(200, "OK");
+ res.end("1");
return;
}
// for PushService tests.
else if (u.pathname === "/pushSubscriptionSuccess/subscribe") {
- res.setHeader("Location",
- 'https://localhost:' + serverPort + '/pushSubscriptionSuccesss');
- res.setHeader("Link",
- '; rel="urn:ietf:params:push", ' +
- '; rel="urn:ietf:params:push:receipt"');
+ res.setHeader(
+ "Location",
+ "https://localhost:" + serverPort + "/pushSubscriptionSuccesss"
+ );
+ res.setHeader(
+ "Link",
+ '; rel="urn:ietf:params:push", ' +
+ '; rel="urn:ietf:params:push:receipt"'
+ );
res.writeHead(201, "OK");
res.end("");
return;
- }
-
- else if (u.pathname === "/pushSubscriptionSuccesss") {
+ } else if (u.pathname === "/pushSubscriptionSuccesss") {
// do nothing.
return;
- }
-
- else if (u.pathname === "/pushSubscriptionMissingLocation/subscribe") {
- res.setHeader("Link",
- '; rel="urn:ietf:params:push", ' +
- '; rel="urn:ietf:params:push:receipt"');
+ } else if (u.pathname === "/pushSubscriptionMissingLocation/subscribe") {
+ res.setHeader(
+ "Link",
+ '; rel="urn:ietf:params:push", ' +
+ '; rel="urn:ietf:params:push:receipt"'
+ );
res.writeHead(201, "OK");
res.end("");
return;
- }
-
- else if (u.pathname === "/pushSubscriptionMissingLink/subscribe") {
- res.setHeader("Location",
- 'https://localhost:' + serverPort + '/subscriptionMissingLink');
+ } else if (u.pathname === "/pushSubscriptionMissingLink/subscribe") {
+ res.setHeader(
+ "Location",
+ "https://localhost:" + serverPort + "/subscriptionMissingLink"
+ );
res.writeHead(201, "OK");
res.end("");
return;
- }
-
- else if (u.pathname === "/pushSubscriptionLocationBogus/subscribe") {
- res.setHeader("Location", '1234');
- res.setHeader("Link",
- '; rel="urn:ietf:params:push:receipt"');
+ } else if (u.pathname === "/pushSubscriptionLocationBogus/subscribe") {
+ res.setHeader("Location", "1234");
+ res.setHeader(
+ "Link",
+ '; rel="urn:ietf:params:push:receipt"'
+ );
res.writeHead(201, "OK");
res.end("");
return;
- }
-
- else if (u.pathname === "/pushSubscriptionMissingLink1/subscribe") {
- res.setHeader("Location",
- 'https://localhost:' + serverPort + '/subscriptionMissingLink1');
- res.setHeader("Link",
- '; rel="urn:ietf:params:push:receipt"');
+ } else if (u.pathname === "/pushSubscriptionMissingLink1/subscribe") {
+ res.setHeader(
+ "Location",
+ "https://localhost:" + serverPort + "/subscriptionMissingLink1"
+ );
+ res.setHeader(
+ "Link",
+ '; rel="urn:ietf:params:push:receipt"'
+ );
res.writeHead(201, "OK");
res.end("");
return;
- }
-
- else if (u.pathname === "/pushSubscriptionMissingLink2/subscribe") {
- res.setHeader("Location",
- 'https://localhost:' + serverPort + '/subscriptionMissingLink2');
- res.setHeader("Link",
- '; rel="urn:ietf:params:push"');
+ } else if (u.pathname === "/pushSubscriptionMissingLink2/subscribe") {
+ res.setHeader(
+ "Location",
+ "https://localhost:" + serverPort + "/subscriptionMissingLink2"
+ );
+ res.setHeader(
+ "Link",
+ '; rel="urn:ietf:params:push"'
+ );
res.writeHead(201, "OK");
res.end("");
return;
- }
-
- else if (u.pathname === "/subscriptionMissingLink2") {
+ } else if (u.pathname === "/subscriptionMissingLink2") {
// do nothing.
return;
- }
-
- else if (u.pathname === "/pushSubscriptionNot201Code/subscribe") {
- res.setHeader("Location",
- 'https://localhost:' + serverPort + '/subscriptionNot2xxCode');
- res.setHeader("Link",
- '; rel="urn:ietf:params:push", ' +
- '; rel="urn:ietf:params:push:receipt"');
+ } else if (u.pathname === "/pushSubscriptionNot201Code/subscribe") {
+ res.setHeader(
+ "Location",
+ "https://localhost:" + serverPort + "/subscriptionNot2xxCode"
+ );
+ res.setHeader(
+ "Link",
+ '; rel="urn:ietf:params:push", ' +
+ '; rel="urn:ietf:params:push:receipt"'
+ );
res.writeHead(200, "OK");
res.end("");
return;
- }
-
- else if (u.pathname ==="/pushNotifications/subscription1") {
- pushPushServer1 = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort,
- path : '/pushNotificationsDeliver1', method : 'GET',
- headers: { 'Encryption-Key': 'keyid="notification1"; dh="BO_tgGm-yvYAGLeRe16AvhzaUcpYRiqgsGOlXpt0DRWDRGGdzVLGlEVJMygqAUECarLnxCiAOHTP_znkedrlWoU"',
- 'Encryption': 'keyid="notification1";salt="uAZaiXpOSfOLJxtOCZ09dA"',
- 'Content-Encoding': 'aesgcm128',
- }
- });
+ } else if (u.pathname === "/pushNotifications/subscription1") {
+ pushPushServer1 = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushNotificationsDeliver1",
+ method: "GET",
+ headers: {
+ "Encryption-Key":
+ 'keyid="notification1"; dh="BO_tgGm-yvYAGLeRe16AvhzaUcpYRiqgsGOlXpt0DRWDRGGdzVLGlEVJMygqAUECarLnxCiAOHTP_znkedrlWoU"',
+ Encryption: 'keyid="notification1";salt="uAZaiXpOSfOLJxtOCZ09dA"',
+ "Content-Encoding": "aesgcm128",
+ },
+ });
pushPushServer1.writeHead(200, {
- 'subresource' : '1'
- });
+ subresource: "1",
+ });
- pushPushServer1.end('370aeb3963f12c4f12bf946bd0a7a9ee7d3eaff8f7aec62b530fc25cfa', 'hex');
+ pushPushServer1.end(
+ "370aeb3963f12c4f12bf946bd0a7a9ee7d3eaff8f7aec62b530fc25cfa",
+ "hex"
+ );
return;
- }
-
- else if (u.pathname ==="/pushNotifications/subscription2") {
- pushPushServer2 = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort,
- path : '/pushNotificationsDeliver3', method : 'GET',
- headers: { 'Encryption-Key': 'keyid="notification2"; dh="BKVdQcgfncpNyNWsGrbecX0zq3eHIlHu5XbCGmVcxPnRSbhjrA6GyBIeGdqsUL69j5Z2CvbZd-9z1UBH0akUnGQ"',
- 'Encryption': 'keyid="notification2";salt="vFn3t3M_k42zHBdpch3VRw"',
- 'Content-Encoding': 'aesgcm128',
- }
- });
+ } else if (u.pathname === "/pushNotifications/subscription2") {
+ pushPushServer2 = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushNotificationsDeliver3",
+ method: "GET",
+ headers: {
+ "Encryption-Key":
+ 'keyid="notification2"; dh="BKVdQcgfncpNyNWsGrbecX0zq3eHIlHu5XbCGmVcxPnRSbhjrA6GyBIeGdqsUL69j5Z2CvbZd-9z1UBH0akUnGQ"',
+ Encryption: 'keyid="notification2";salt="vFn3t3M_k42zHBdpch3VRw"',
+ "Content-Encoding": "aesgcm128",
+ },
+ });
pushPushServer2.writeHead(200, {
- 'subresource' : '1'
- });
+ subresource: "1",
+ });
- pushPushServer2.end('66df5d11daa01e5c802ff97cdf7f39684b5bf7c6418a5cf9b609c6826c04b25e403823607ac514278a7da945', 'hex');
+ pushPushServer2.end(
+ "66df5d11daa01e5c802ff97cdf7f39684b5bf7c6418a5cf9b609c6826c04b25e403823607ac514278a7da945",
+ "hex"
+ );
return;
- }
-
- else if (u.pathname ==="/pushNotifications/subscription3") {
- pushPushServer3 = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort,
- path : '/pushNotificationsDeliver3', method : 'GET',
- headers: { 'Encryption-Key': 'keyid="notification3";dh="BD3xV_ACT8r6hdIYES3BJj1qhz9wyv7MBrG9vM2UCnjPzwE_YFVpkD-SGqE-BR2--0M-Yf31wctwNsO1qjBUeMg"',
- 'Encryption': 'keyid="notification3"; salt="DFq188piWU7osPBgqn4Nlg"; rs=24',
- 'Content-Encoding': 'aesgcm128',
- }
- });
+ } else if (u.pathname === "/pushNotifications/subscription3") {
+ pushPushServer3 = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushNotificationsDeliver3",
+ method: "GET",
+ headers: {
+ "Encryption-Key":
+ 'keyid="notification3";dh="BD3xV_ACT8r6hdIYES3BJj1qhz9wyv7MBrG9vM2UCnjPzwE_YFVpkD-SGqE-BR2--0M-Yf31wctwNsO1qjBUeMg"',
+ Encryption:
+ 'keyid="notification3"; salt="DFq188piWU7osPBgqn4Nlg"; rs=24',
+ "Content-Encoding": "aesgcm128",
+ },
+ });
pushPushServer3.writeHead(200, {
- 'subresource' : '1'
- });
+ subresource: "1",
+ });
- pushPushServer3.end('2caaeedd9cf1059b80c58b6c6827da8ff7de864ac8bea6d5775892c27c005209cbf9c4de0c3fbcddb9711d74eaeebd33f7275374cb42dd48c07168bc2cc9df63e045ce2d2a2408c66088a40c', 'hex');
+ pushPushServer3.end(
+ "2caaeedd9cf1059b80c58b6c6827da8ff7de864ac8bea6d5775892c27c005209cbf9c4de0c3fbcddb9711d74eaeebd33f7275374cb42dd48c07168bc2cc9df63e045ce2d2a2408c66088a40c",
+ "hex"
+ );
return;
- }
-
- else if (u.pathname == "/pushNotifications/subscription4") {
- pushPushServer4 = res.push(
- { hostname: 'localhost:' + serverPort, port: serverPort,
- path : '/pushNotificationsDeliver4', method : 'GET',
- headers: { 'Crypto-Key': 'keyid="notification4";dh="BJScXUUTcs7D8jJWI1AOxSgAKkF7e56ay4Lek52TqDlWo1yGd5czaxFWfsuP4j7XNWgGYm60-LKpSUMlptxPFVQ"',
- 'Encryption': 'keyid="notification4"; salt="sn9p2QqF3V6KBclda8vx7w"',
- 'Content-Encoding': 'aesgcm',
- }
- });
+ } else if (u.pathname == "/pushNotifications/subscription4") {
+ pushPushServer4 = res.push({
+ hostname: "localhost:" + serverPort,
+ port: serverPort,
+ path: "/pushNotificationsDeliver4",
+ method: "GET",
+ headers: {
+ "Crypto-Key":
+ 'keyid="notification4";dh="BJScXUUTcs7D8jJWI1AOxSgAKkF7e56ay4Lek52TqDlWo1yGd5czaxFWfsuP4j7XNWgGYm60-LKpSUMlptxPFVQ"',
+ Encryption: 'keyid="notification4"; salt="sn9p2QqF3V6KBclda8vx7w"',
+ "Content-Encoding": "aesgcm",
+ },
+ });
pushPushServer4.writeHead(200, {
- 'subresource' : '1'
- });
+ subresource: "1",
+ });
- pushPushServer4.end('9eba7ba6192544a39bd9e9b58e702d0748f1776b27f6616cdc55d29ed5a015a6db8f2dd82cd5751a14315546194ff1c18458ab91eb36c9760ccb042670001fd9964557a079553c3591ee131ceb259389cfffab3ab873f873caa6a72e87d262b8684c3260e5940b992234deebf57a9ff3a8775742f3cbcb152d249725a28326717e19cce8506813a155eff5df9bdba9e3ae8801d3cc2b7e7f2f1b6896e63d1fdda6f85df704b1a34db7b2dd63eba11ede154300a318c6f83c41a3d32356a196e36bc905b99195fd91ae4ff3f545c42d17f1fdc1d5bd2bf7516d0765e3a859fffac84f46160b79cedda589f74c25357cf6988cd8ba83867ebd86e4579c9d3b00a712c77fcea3b663007076e21f9819423faa830c2176ff1001c1690f34be26229a191a938517', 'hex');
+ pushPushServer4.end(
+ "9eba7ba6192544a39bd9e9b58e702d0748f1776b27f6616cdc55d29ed5a015a6db8f2dd82cd5751a14315546194ff1c18458ab91eb36c9760ccb042670001fd9964557a079553c3591ee131ceb259389cfffab3ab873f873caa6a72e87d262b8684c3260e5940b992234deebf57a9ff3a8775742f3cbcb152d249725a28326717e19cce8506813a155eff5df9bdba9e3ae8801d3cc2b7e7f2f1b6896e63d1fdda6f85df704b1a34db7b2dd63eba11ede154300a318c6f83c41a3d32356a196e36bc905b99195fd91ae4ff3f545c42d17f1fdc1d5bd2bf7516d0765e3a859fffac84f46160b79cedda589f74c25357cf6988cd8ba83867ebd86e4579c9d3b00a712c77fcea3b663007076e21f9819423faa830c2176ff1001c1690f34be26229a191a938517",
+ "hex"
+ );
return;
- }
-
- else if ((u.pathname === "/pushNotificationsDeliver1") ||
- (u.pathname === "/pushNotificationsDeliver2") ||
- (u.pathname === "/pushNotificationsDeliver3")) {
+ } else if (
+ u.pathname === "/pushNotificationsDeliver1" ||
+ u.pathname === "/pushNotificationsDeliver2" ||
+ u.pathname === "/pushNotificationsDeliver3"
+ ) {
res.writeHead(410, "GONE");
res.end("");
return;
- }
-
- else if (u.pathname === "/illegalhpacksoft") {
+ } else if (u.pathname === "/illegalhpacksoft") {
// This will cause the compressor to compress a header that is not legal,
// but only affects the stream, not the session.
illegalheader_conn = req.stream.connection;
Compressor.prototype.compress = insertSoftIllegalHpack;
// Fall through to the default response behavior
- }
-
- else if (u.pathname === "/illegalhpackhard") {
+ } else if (u.pathname === "/illegalhpackhard") {
// This will cause the compressor to insert an HPACK instruction that will
// cause a session failure.
Compressor.prototype.compress = insertHardIllegalHpack;
// Fall through to default response behavior
- }
-
- else if (u.pathname === "/illegalhpack_validate") {
+ } else if (u.pathname === "/illegalhpack_validate") {
if (req.stream.connection === illegalheader_conn) {
- res.setHeader('X-Did-Goaway', 'no');
+ res.setHeader("X-Did-Goaway", "no");
} else {
- res.setHeader('X-Did-Goaway', 'yes');
+ res.setHeader("X-Did-Goaway", "yes");
}
// Fall through to the default response behavior
- }
-
- else if (u.pathname === "/foldedheader") {
- res.setHeader('X-Folded-Header', 'this is\n folded');
+ } else if (u.pathname === "/foldedheader") {
+ res.setHeader("X-Folded-Header", "this is\n folded");
// Fall through to the default response behavior
- }
-
- else if (u.pathname === "/emptydata") {
+ } else if (u.pathname === "/emptydata") {
// Overwrite the original transform with our version that will insert an
// empty DATA frame at the beginning of the stream response, then fall
// through to the default response behavior.
@@ -1004,145 +1088,149 @@ function handleRequest(req, res) {
// for use with test_immutable.js
else if (u.pathname === "/immutable-test-without-attribute") {
- res.setHeader('Cache-Control', 'max-age=100000');
- res.setHeader('Etag', '1');
+ res.setHeader("Cache-Control", "max-age=100000");
+ res.setHeader("Etag", "1");
if (req.headers["if-none-match"]) {
res.setHeader("x-conditional", "true");
}
// default response from here
- }
- else if (u.pathname === "/immutable-test-with-attribute") {
- res.setHeader('Cache-Control', 'max-age=100000, immutable');
- res.setHeader('Etag', '2');
+ } else if (u.pathname === "/immutable-test-with-attribute") {
+ res.setHeader("Cache-Control", "max-age=100000, immutable");
+ res.setHeader("Etag", "2");
if (req.headers["if-none-match"]) {
res.setHeader("x-conditional", "true");
}
// default response from here
- }
- else if (u.pathname === "/origin-4") {
- var originList = [ ];
- req.stream.connection.originFrame(originList);
- res.setHeader("x-client-port", req.remotePort);
- }
- else if (u.pathname === "/origin-6") {
- var originList = [ "https://alt1.example.com:" + serverPort,
- "https://alt2.example.com:" + serverPort,
- "https://bar.example.com:" + serverPort ];
- req.stream.connection.originFrame(originList);
- res.setHeader("x-client-port", req.remotePort);
- }
- else if (u.pathname === "/origin-11-a") {
+ } else if (u.pathname === "/origin-4") {
+ let originList = [];
+ req.stream.connection.originFrame(originList);
+ res.setHeader("x-client-port", req.remotePort);
+ } else if (u.pathname === "/origin-6") {
+ let originList = [
+ "https://alt1.example.com:" + serverPort,
+ "https://alt2.example.com:" + serverPort,
+ "https://bar.example.com:" + serverPort,
+ ];
+ req.stream.connection.originFrame(originList);
+ res.setHeader("x-client-port", req.remotePort);
+ } else if (u.pathname === "/origin-11-a") {
res.setHeader("x-client-port", req.remotePort);
- pushb = res.push(
- { hostname: 'foo.example.com:' + serverPort, port: serverPort, path : '/origin-11-b', method : 'GET',
- headers: {'x-pushed-request': 'true', 'x-foo' : 'bar'}});
+ const pushb = res.push({
+ hostname: "foo.example.com:" + serverPort,
+ port: serverPort,
+ path: "/origin-11-b",
+ method: "GET",
+ headers: { "x-pushed-request": "true", "x-foo": "bar" },
+ });
pushb.writeHead(200, {
- 'pushed' : 'yes',
- 'content-length' : 1
- });
- pushb.end('1');
+ pushed: "yes",
+ "content-length": 1,
+ });
+ pushb.end("1");
- pushc = res.push(
- { hostname: 'bar.example.com:' + serverPort, port: serverPort, path : '/origin-11-c', method : 'GET',
- headers: {'x-pushed-request': 'true', 'x-foo' : 'bar'}});
+ const pushc = res.push({
+ hostname: "bar.example.com:" + serverPort,
+ port: serverPort,
+ path: "/origin-11-c",
+ method: "GET",
+ headers: { "x-pushed-request": "true", "x-foo": "bar" },
+ });
pushc.writeHead(200, {
- 'pushed' : 'yes',
- 'content-length' : 1
- });
- pushc.end('1');
+ pushed: "yes",
+ "content-length": 1,
+ });
+ pushc.end("1");
- pushd = res.push(
- { hostname: 'madeup.example.com:' + serverPort, port: serverPort, path : '/origin-11-d', method : 'GET',
- headers: {'x-pushed-request': 'true', 'x-foo' : 'bar'}});
+ const pushd = res.push({
+ hostname: "madeup.example.com:" + serverPort,
+ port: serverPort,
+ path: "/origin-11-d",
+ method: "GET",
+ headers: { "x-pushed-request": "true", "x-foo": "bar" },
+ });
pushd.writeHead(200, {
- 'pushed' : 'yes',
- 'content-length' : 1
- });
- pushd.end('1');
+ pushed: "yes",
+ "content-length": 1,
+ });
+ pushd.end("1");
- pushe = res.push(
- { hostname: 'alt1.example.com:' + serverPort, port: serverPort, path : '/origin-11-e', method : 'GET',
- headers: {'x-pushed-request': 'true', 'x-foo' : 'bar'}});
+ const pushe = res.push({
+ hostname: "alt1.example.com:" + serverPort,
+ port: serverPort,
+ path: "/origin-11-e",
+ method: "GET",
+ headers: { "x-pushed-request": "true", "x-foo": "bar" },
+ });
pushe.writeHead(200, {
- 'pushed' : 'yes',
- 'content-length' : 1
- });
- pushe.end('1');
- }
- else if (u.pathname.substring(0,8) === "/origin-") { // test_origin.js coalescing
+ pushed: "yes",
+ "content-length": 1,
+ });
+ pushe.end("1");
+ } else if (u.pathname.substring(0, 8) === "/origin-") {
+ // test_origin.js coalescing
res.setHeader("x-client-port", req.remotePort);
- }
-
- else if (u.pathname === "/statusphrase") {
+ } else if (u.pathname === "/statusphrase") {
// Fortunately, the node-http2 API is dumb enough to allow this right on
// through, so we can easily test rejecting this on gecko's end.
res.writeHead("200 OK");
res.end(content);
return;
- }
-
- else if (u.pathname === "/doublepush") {
- push1 = res.push('/doublypushed');
+ } else if (u.pathname === "/doublepush") {
+ push1 = res.push("/doublypushed");
push1.writeHead(200, {
- 'content-type': 'text/plain',
- 'pushed' : 'yes',
- 'content-length' : 6,
- 'X-Connection-Http2': 'yes'
+ "content-type": "text/plain",
+ pushed: "yes",
+ "content-length": 6,
+ "X-Connection-Http2": "yes",
});
- push1.end('pushed');
+ push1.end("pushed");
- push2 = res.push('/doublypushed');
+ push2 = res.push("/doublypushed");
push2.writeHead(200, {
- 'content-type': 'text/plain',
- 'pushed' : 'yes',
- 'content-length' : 6,
- 'X-Connection-Http2': 'yes'
+ "content-type": "text/plain",
+ pushed: "yes",
+ "content-length": 6,
+ "X-Connection-Http2": "yes",
});
- push2.end('pushed');
- }
-
- else if (u.pathname === "/doublypushed") {
- content = 'not pushed';
- }
-
- else if (u.pathname === "/diskcache") {
+ push2.end("pushed");
+ } else if (u.pathname === "/doublypushed") {
+ content = "not pushed";
+ } else if (u.pathname === "/diskcache") {
content = "this was pulled via h2";
- }
-
- else if (u.pathname === "/pushindisk") {
+ } else if (u.pathname === "/pushindisk") {
var pushedContent = "this was pushed via h2";
- push = res.push('/diskcache');
+ push = res.push("/diskcache");
push.writeHead(200, {
- 'content-type': 'text/html',
- 'pushed' : 'yes',
- 'content-length' : pushedContent.length,
- 'X-Connection-Http2': 'yes'
+ "content-type": "text/html",
+ pushed: "yes",
+ "content-length": pushedContent.length,
+ "X-Connection-Http2": "yes",
});
push.end(pushedContent);
}
// For test_header_Server_Timing.js
else if (u.pathname === "/server-timing") {
- res.setHeader('Content-Type', 'text/plain');
- res.setHeader('Content-Length', '12');
- res.setHeader('Trailer', 'Server-Timing');
- res.setHeader('Server-Timing', 'metric; dur=123.4; desc=description, metric2; dur=456.78; desc=description1');
- res.write('data reached');
- res.addTrailers({'Server-Timing': 'metric3; dur=789.11; desc=description2, metric4; dur=1112.13; desc=description3'});
+ res.setHeader("Content-Type", "text/plain");
+ res.setHeader("Content-Length", "12");
+ res.setHeader("Trailer", "Server-Timing");
+ res.setHeader(
+ "Server-Timing",
+ "metric; dur=123.4; desc=description, metric2; dur=456.78; desc=description1"
+ );
+ res.write("data reached");
+ res.addTrailers({
+ "Server-Timing":
+ "metric3; dur=789.11; desc=description2, metric4; dur=1112.13; desc=description3",
+ });
res.end();
return;
}
- else if (u.pathname === "/proxy-session-counter") {
- // Incremented with every newly created session on the proxy
- res.end(proxy_session_count.toString());
- return;
- }
-
- res.setHeader('Content-Type', 'text/html');
+ res.setHeader("Content-Type", "text/html");
if (req.httpVersionMajor != 2) {
- res.setHeader('Connection', 'close');
+ res.setHeader("Connection", "close");
}
res.writeHead(200);
res.end(content);
@@ -1151,95 +1239,41 @@ function handleRequest(req, res) {
// Set up the SSL certs for our server - this server has a cert for foo.example.com
// signed by netwerk/tests/unit/http2-ca.pem
var options = {
- key: fs.readFileSync(__dirname + '/http2-cert.key'),
- cert: fs.readFileSync(__dirname + '/http2-cert.pem'),
+ key: fs.readFileSync(__dirname + "/http2-cert.key"),
+ cert: fs.readFileSync(__dirname + "/http2-cert.pem"),
};
if (process.env.HTTP2_LOG !== undefined) {
var log_module = node_http2_root + "/test/util";
- options.log = require(log_module).createLogger('server')
+ options.log = require(log_module).createLogger("server");
}
var server = http2.createServer(options, handleRequest);
-server.on('connection', function(socket) {
- socket.on('error', function() {
+server.on("connection", function(socket) {
+ socket.on("error", function() {
// Ignoring SSL socket errors, since they usually represent a connection that was tore down
// by the browser because of an untrusted certificate. And this happens at least once, when
// the first test case if done.
});
});
-
-var proxy = http2_internal ? http2_internal.createSecureServer(options) : null;
-var proxy_session_count = 0;
-
-if (http2_internal) {
- proxy.on('session', () => {
- // Can be queried directly on the h2 server under "/proxy-session-counter"
- ++proxy_session_count;
- });
-
- proxy.on('stream', (stream, headers) => {
- if (headers[':method'] !== 'CONNECT') {
- // Only accept CONNECT requests
- stream.close(http2.constants.NGHTTP2_REFUSED_STREAM);
- return;
- }
-
- const target = headers[':authority'];
-
- const authorization_token = headers['proxy-authorization'];
- if ('authorization-token' != authorization_token || target == '407.example.com:443') {
- stream.respond({ ':status': 407 });
- // Deliberately send no Proxy-Authenticate header
- stream.end();
- return;
- }
- if (target == '404.example.com:443') {
- // 404 Not Found, a response code that a proxy should return when the host can't be found
- stream.respond({ ':status': 404 });
- stream.end();
- return;
- }
- if (target == '429.example.com:443') {
- // 429 Too Many Requests, a response code that a proxy should return when receiving too many requests
- stream.respond({ ':status': 429 });
- stream.end();
- return;
- }
- if (target == '502.example.com:443') {
- // 502 Bad Gateway, a response code mostly resembling immediate connection error
- stream.respond({ ':status': 502 });
- stream.end();
- return;
- }
- if (target == '504.example.com:443') {
- // 504 Gateway Timeout, did not receive a timely response from an upstream server
- stream.respond({ ':status': 504 });
- stream.end();
- return;
- }
-
- const socket = net.connect(serverPort, '127.0.0.1', () => {
- try {
- stream.respond({ ':status': 200 });
- socket.pipe(stream);
- stream.pipe(socket);
- } catch (exception) {
- stream.close(http2.constants.NGHTTP2_STREAM_CLOSED);
- }
- });
- socket.on('error', (error) => {
- throw `Unxpected error when conneting the HTTP/2 server from the HTTP/2 proxy during CONNECT handling: '${error}'`;
- });
- });
+function makeid(length) {
+ var result = "";
+ var characters =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+ var charactersLength = characters.length;
+ for (var i = 0; i < length; i++) {
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
+ }
+ return result;
}
+let globalObjects = {};
var serverPort;
-const listen = (server, envport) => {
- if (!server) {
+const listen = (serv, envport) => {
+ if (!serv) {
return Promise.resolve(0);
}
@@ -1252,15 +1286,160 @@ const listen = (server, envport) => {
}
}
return new Promise(resolve => {
- server.listen(portSelection, "0.0.0.0", 200, () => {
- resolve(server.address().port);
+ serv.listen(portSelection, "0.0.0.0", 2000, () => {
+ resolve(serv.address().port);
});
});
+};
+
+const http = require("http");
+let httpServer = http.createServer((req, res) => {
+ if (req.method != "POST") {
+ let u = url.parse(req.url, true);
+ if (u.pathname == "/test") {
+ // This path is used to test that the server is working properly
+ res.writeHead(200);
+ res.end("OK");
+ return;
+ }
+ res.writeHead(405);
+ res.end("Unexpected method: " + req.method);
+ return;
+ }
+
+ let code = "";
+ req.on("data", function receivePostData(chunk) {
+ code += chunk;
+ });
+ req.on("end", function finishPost() {
+ let u = url.parse(req.url, true);
+ if (u.pathname == "/fork") {
+ let id = forkProcess();
+ computeAndSendBackResponse(id);
+ return;
+ }
+
+ if (u.pathname.startsWith("/kill/")) {
+ let id = u.pathname.slice(6);
+ let forked = globalObjects[id];
+ if (!forked) {
+ computeAndSendBackResponse(undefined, new Error("could not find id"));
+ return;
+ }
+
+ new Promise((resolve, reject) => {
+ forked.resolve = resolve;
+ forked.reject = reject;
+ forked.kill();
+ })
+ .then(x =>
+ computeAndSendBackResponse(
+ undefined,
+ new Error(`incorrectly resolved ${x}`)
+ )
+ )
+ .catch(e => {
+ // We indicate a proper shutdown by resolving with undefined.
+ if (e && e.toString().match(/child process exit closing code/)) {
+ e = undefined;
+ }
+ computeAndSendBackResponse(undefined, e);
+ });
+ return;
+ }
+
+ if (u.pathname.startsWith("/execute/")) {
+ let id = u.pathname.slice(9);
+ let forked = globalObjects[id];
+ if (!forked) {
+ computeAndSendBackResponse(undefined, new Error("could not find id"));
+ return;
+ }
+
+ new Promise((resolve, reject) => {
+ forked.resolve = resolve;
+ forked.reject = reject;
+ forked.send({ code });
+ })
+ .then(x => sendBackResponse(x))
+ .catch(e => computeAndSendBackResponse(undefined, e));
+ }
+
+ function computeAndSendBackResponse(evalResult, e) {
+ let output = { result: evalResult, error: "", errorStack: "" };
+ if (e) {
+ output.error = e.toString();
+ output.errorStack = e.stack;
+ }
+ sendBackResponse(output);
+ }
+
+ function sendBackResponse(output) {
+ output = JSON.stringify(output);
+
+ res.setHeader("Content-Length", output.length);
+ res.setHeader("Content-Type", "application/json");
+ res.writeHead(200);
+ res.write(output);
+ res.end("");
+ }
+ });
+});
+
+function forkProcess() {
+ let scriptPath = path.resolve(__dirname, "moz-http2-child.js");
+ let id = makeid(6);
+ let forked = fork(scriptPath);
+ forked.errors = "";
+ globalObjects[id] = forked;
+ forked.on("message", msg => {
+ if (forked.resolve) {
+ forked.resolve(msg);
+ forked.resolve = null;
+ } else {
+ console.log(`forked process without handler sent: ${msg}`);
+ forked.errors += `forked process without handler sent: ${JSON.stringify(
+ msg
+ )}\n`;
+ }
+ });
+
+ let exitFunction = (code, signal) => {
+ if (globalObjects[id]) {
+ delete globalObjects[id];
+ } else {
+ // already called
+ return;
+ }
+
+ if (!forked.reject) {
+ console.log(
+ `child process ${id} closing code: ${code} signal: ${signal}`
+ );
+ return;
+ }
+
+ if (forked.errors != "") {
+ forked.reject(forked.errors);
+ forked.errors = "";
+ forked.reject = null;
+ return;
+ }
+
+ forked.reject(`child process exit closing code: ${code} signal: ${signal}`);
+ forked.reject = null;
+ };
+
+ forked.on("error", exitFunction);
+ forked.on("close", exitFunction);
+ forked.on("exit", exitFunction);
+
+ return id;
}
Promise.all([
- listen(server, process.env.MOZHTTP2_PORT).then(port => serverPort = port),
- listen(proxy, process.env.MOZHTTP2_PROXY_PORT)
-]).then(([serverPort, proxyPort]) => {
- console.log(`HTTP2 server listening on ports ${serverPort},${proxyPort}`);
+ listen(server, process.env.MOZHTTP2_PORT).then(port => (serverPort = port)),
+ listen(httpServer, process.env.MOZNODE_EXEC_PORT),
+]).then(([sPort, nodeExecPort]) => {
+ console.log(`HTTP2 server listening on ports ${sPort},${nodeExecPort}`);
});
diff --git a/testing/xpcshell/node-http2/lib/http.js b/testing/xpcshell/node-http2/lib/http.js
index aa3af05e52..6e626df42f 100644
--- a/testing/xpcshell/node-http2/lib/http.js
+++ b/testing/xpcshell/node-http2/lib/http.js
@@ -1104,7 +1104,7 @@ OutgoingRequest.prototype._start = function _start(stream, options) {
delete headers.host;
if (options.auth) {
- headers.authorization = 'Basic ' + new Buffer(options.auth).toString('base64');
+ headers.authorization = 'Basic ' + Buffer.from(options.auth).toString('base64');
}
headers[':scheme'] = options.protocol.slice(0, -1);
diff --git a/testing/xpcshell/node-http2/lib/protocol/compressor.js b/testing/xpcshell/node-http2/lib/protocol/compressor.js
index 3923a91073..498468403c 100644
--- a/testing/xpcshell/node-http2/lib/protocol/compressor.js
+++ b/testing/xpcshell/node-http2/lib/protocol/compressor.js
@@ -66,7 +66,7 @@ function entryFromPair(pair) {
var DEFAULT_HEADER_TABLE_LIMIT = 4096;
function size(entry) {
- return (new Buffer(entry[0] + entry[1], 'utf8')).length + 32;
+ return (Buffer.from(entry[0] + entry[1], 'utf8')).length + 32;
}
// The `add(index, entry)` can be used to [manage the header table][tablemgmt]:
@@ -396,7 +396,7 @@ HeaderSetCompressor.prototype._flush = function _flush(callback) {
HeaderSetCompressor.integer = function writeInteger(I, N) {
var limit = Math.pow(2,N) - 1;
if (I < limit) {
- return [new Buffer([I])];
+ return [Buffer.from([I])];
}
var bytes = [];
@@ -418,7 +418,7 @@ HeaderSetCompressor.integer = function writeInteger(I, N) {
I = Q;
}
- return [new Buffer(bytes)];
+ return [Buffer.from(bytes)];
};
// The inverse algorithm:
@@ -530,7 +530,7 @@ HuffmanTable.prototype.encode = function encode(buffer) {
add(this.codes[256] >> (this.lengths[256] - space));
}
- return new Buffer(result);
+ return Buffer.from(result);
};
HuffmanTable.prototype.decode = function decode(buffer) {
@@ -552,7 +552,7 @@ HuffmanTable.prototype.decode = function decode(buffer) {
}
}
- return new Buffer(result);
+ return Buffer.from(result);
};
// The initializer arrays for the Huffman tables are generated with feeding the tables from the
@@ -852,7 +852,7 @@ HuffmanTable.huffmanTable = new HuffmanTable([
// +---+---+---+---+---+---+---+---+
HeaderSetCompressor.string = function writeString(str) {
- str = new Buffer(str, 'utf8');
+ str = Buffer.from(str, 'utf8');
var huffman = HuffmanTable.huffmanTable.encode(str);
if (huffman.length < str.length) {
@@ -1341,7 +1341,7 @@ function concat(buffers) {
size += buffers[i].length;
}
- var concatenated = new Buffer(size);
+ var concatenated = Buffer.alloc(size);
for (var cursor = 0, j = 0; j < buffers.length; cursor += buffers[j].length, j++) {
buffers[j].copy(concatenated, cursor);
}
diff --git a/testing/xpcshell/node-http2/lib/protocol/connection.js b/testing/xpcshell/node-http2/lib/protocol/connection.js
index d1e515de27..8c203675fa 100644
--- a/testing/xpcshell/node-http2/lib/protocol/connection.js
+++ b/testing/xpcshell/node-http2/lib/protocol/connection.js
@@ -515,7 +515,7 @@ Connection.prototype._generatePingId = function _generatePingId() {
// Sending a ping and calling `callback` when the answer arrives
Connection.prototype.ping = function ping(callback) {
var id = this._generatePingId();
- var data = new Buffer(id, 'hex');
+ var data = Buffer.from(id, 'hex');
this._pings[id] = callback;
this._log.debug({ data: data }, 'Sending PING.');
diff --git a/testing/xpcshell/node-http2/lib/protocol/endpoint.js b/testing/xpcshell/node-http2/lib/protocol/endpoint.js
index a218db040a..127f4c4c5c 100644
--- a/testing/xpcshell/node-http2/lib/protocol/endpoint.js
+++ b/testing/xpcshell/node-http2/lib/protocol/endpoint.js
@@ -78,7 +78,7 @@ Endpoint.prototype = Object.create(Duplex.prototype, { constructor: { value: End
// Handshake
// ---------
-var CLIENT_PRELUDE = new Buffer('PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n');
+var CLIENT_PRELUDE = Buffer.from('PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n');
// Writing the client header is simple and synchronous.
Endpoint.prototype._writePrelude = function _writePrelude() {
diff --git a/testing/xpcshell/node-http2/lib/protocol/framer.js b/testing/xpcshell/node-http2/lib/protocol/framer.js
index 303c6426b1..055402f8d8 100644
--- a/testing/xpcshell/node-http2/lib/protocol/framer.js
+++ b/testing/xpcshell/node-http2/lib/protocol/framer.js
@@ -81,7 +81,7 @@ Deserializer.prototype = Object.create(Transform.prototype, { constructor: { val
// payload). The `_cursor` is used to track the progress.
Deserializer.prototype._next = function(size) {
this._cursor = 0;
- this._buffer = new Buffer(size);
+ this._buffer = Buffer.alloc(size);
this._waitingForHeader = !this._waitingForHeader;
if (this._waitingForHeader) {
this._frame = {};
@@ -204,7 +204,7 @@ var genericAttributes = ['type', 'flags', 'stream'];
var typeSpecificAttributes = {};
Serializer.commonHeader = function writeCommonHeader(frame, buffers) {
- var headerBuffer = new Buffer(COMMON_HEADER_SIZE);
+ var headerBuffer = Buffer.alloc(COMMON_HEADER_SIZE);
var size = 0;
for (var i = 0; i < buffers.length; i++) {
@@ -363,7 +363,7 @@ typeSpecificAttributes.HEADERS = ['priorityDependency', 'priorityWeight', 'exclu
Serializer.HEADERS = function writeHeadersPriority(frame, buffers) {
if (frame.flags.PRIORITY) {
- var buffer = new Buffer(5);
+ var buffer = Buffer.alloc(5);
assert((0 <= frame.priorityDependency) && (frame.priorityDependency <= 0x7fffffff), frame.priorityDependency);
buffer.writeUInt32BE(frame.priorityDependency, 0);
if (frame.exclusiveDependency) {
@@ -397,7 +397,7 @@ Deserializer.HEADERS = function readHeadersPriority(buffer, frame) {
}
if (frame.flags.PRIORITY) {
- var dependencyData = new Buffer(4);
+ var dependencyData = Buffer.alloc(4);
buffer.copy(dependencyData, 0, dataOffset, dataOffset + 4);
dataOffset += 4;
frame.exclusiveDependency = !!(dependencyData[0] & 0x80);
@@ -442,7 +442,7 @@ typeSpecificAttributes.PRIORITY = ['priorityDependency', 'priorityWeight', 'excl
// The payload of a PRIORITY frame contains an exclusive bit, a 31-bit dependency, and an 8-bit weight
Serializer.PRIORITY = function writePriority(frame, buffers) {
- var buffer = new Buffer(5);
+ var buffer = Buffer.alloc(5);
assert((0 <= frame.priorityDependency) && (frame.priorityDependency <= 0x7fffffff), frame.priorityDependency);
buffer.writeUInt32BE(frame.priorityDependency, 0);
if (frame.exclusiveDependency) {
@@ -459,7 +459,7 @@ Deserializer.PRIORITY = function readPriority(buffer, frame) {
// PRIORITY frames are 5 bytes long. Bad peer!
return 'FRAME_SIZE_ERROR';
}
- var dependencyData = new Buffer(4);
+ var dependencyData = Buffer.alloc(4);
buffer.copy(dependencyData, 0, 0, 4);
frame.exclusiveDependency = !!(dependencyData[0] & 0x80);
dependencyData[0] &= 0x7f;
@@ -490,7 +490,7 @@ typeSpecificAttributes.RST_STREAM = ['error'];
// code (see Error Codes). The error code indicates why the stream is being terminated.
Serializer.RST_STREAM = function writeRstStream(frame, buffers) {
- var buffer = new Buffer(4);
+ var buffer = Buffer.alloc(4);
var code = errorCodes.indexOf(frame.error);
assert((0 <= code) && (code <= 0xffffffff), code);
buffer.writeUInt32BE(code, 0);
@@ -555,7 +555,7 @@ Serializer.SETTINGS = function writeSettings(frame, buffers) {
});
assert(settingsLeft.length === 0, 'Unknown settings: ' + settingsLeft.join(', '));
- var buffer = new Buffer(settings.length * 6);
+ var buffer = Buffer.alloc(settings.length * 6);
for (var i = 0; i < settings.length; i++) {
buffer.writeUInt16BE(settings[i].id & 0xffff, i*6);
buffer.writeUInt32BE(settings[i].value, i*6 + 2);
@@ -651,7 +651,7 @@ typeSpecificAttributes.PUSH_PROMISE = ['promised_stream', 'headers', 'data'];
// additional context for the stream.
Serializer.PUSH_PROMISE = function writePushPromise(frame, buffers) {
- var buffer = new Buffer(4);
+ var buffer = Buffer.alloc(4);
var promised_stream = frame.promised_stream;
assert((0 <= promised_stream) && (promised_stream <= 0x7fffffff), promised_stream);
@@ -745,7 +745,7 @@ typeSpecificAttributes.GOAWAY = ['last_stream', 'error'];
// closing the connection.
Serializer.GOAWAY = function writeGoaway(frame, buffers) {
- var buffer = new Buffer(8);
+ var buffer = Buffer.alloc(8);
var last_stream = frame.last_stream;
assert((0 <= last_stream) && (last_stream <= 0x7fffffff), last_stream);
@@ -790,7 +790,7 @@ typeSpecificAttributes.WINDOW_UPDATE = ['window_size'];
// reserved.
Serializer.WINDOW_UPDATE = function writeWindowUpdate(frame, buffers) {
- var buffer = new Buffer(4);
+ var buffer = Buffer.alloc(4);
var window_size = frame.window_size;
assert((0 < window_size) && (window_size <= 0x7fffffff), window_size);
@@ -880,7 +880,7 @@ function hexencode(s) {
for (var i = 0; i < s.length; i++) {
if (!istchar(s[i])) {
t += '%';
- t += new Buffer(s[i]).toString('hex');
+ t += Buffer.from(s[i]).toString('hex');
} else {
t += s[i];
}
@@ -889,17 +889,17 @@ function hexencode(s) {
}
Serializer.ALTSVC = function writeAltSvc(frame, buffers) {
- var buffer = new Buffer(2);
+ var buffer = Buffer.alloc(2);
buffer.writeUInt16BE(frame.origin.length, 0);
buffers.push(buffer);
- buffers.push(new Buffer(frame.origin, 'ascii'));
+ buffers.push(Buffer.from(frame.origin, 'ascii'));
var fieldValue = hexencode(frame.protocolID) + '="' + frame.host + ':' + frame.port + '"';
if (frame.maxAge !== 86400) { // 86400 is the default
fieldValue += "; ma=" + frame.maxAge;
}
- buffers.push(new Buffer(fieldValue, 'ascii'));
+ buffers.push(Buffer.from(fieldValue, 'ascii'));
};
function stripquotes(s) {
@@ -1023,7 +1023,7 @@ function unescape(s) {
hexvalue += s[i];
}
if (hexvalue.length > 0) {
- t += new Buffer(hexvalue, 'hex').toString();
+ t += Buffer.from(hexvalue, 'hex').toString();
} else {
t += '%';
}
@@ -1078,10 +1078,10 @@ typeSpecificAttributes.ORIGIN = ['originList'];
Serializer.ORIGIN = function writeOrigin(frame, buffers) {
for (var i = 0; i < frame.originList.length; i++) {
- var buffer = new Buffer(2);
+ var buffer = Buffer.alloc(2);
buffer.writeUInt16BE(frame.originList[i].length, 0);
buffers.push(buffer);
- buffers.push(new Buffer(frame.originList[i], 'ascii'));
+ buffers.push(Buffer.from(frame.originList[i], 'ascii'));
}
};
diff --git a/testing/xpcshell/node-http2/lib/protocol/stream.js b/testing/xpcshell/node-http2/lib/protocol/stream.js
index e9fcc6b7db..b80dff0098 100644
--- a/testing/xpcshell/node-http2/lib/protocol/stream.js
+++ b/testing/xpcshell/node-http2/lib/protocol/stream.js
@@ -345,7 +345,7 @@ Stream.prototype._send = function _send() {
// flag on the last frame. If there's no frame in the queue, or if it doesn't support this flag,
// then we create a 0 length DATA frame. We could do this all the time, but putting the flag on an
// existing frame is a nice optimization.
-var emptyBuffer = new Buffer(0);
+var emptyBuffer = Buffer.alloc(0);
Stream.prototype._finishing = function _finishing() {
var endFrame = {
type: 'DATA',
diff --git a/testing/xpcshell/node-http2/test/compressor.js b/testing/xpcshell/node-http2/test/compressor.js
index f86baf5db9..4588b8a3fd 100644
--- a/testing/xpcshell/node-http2/test/compressor.js
+++ b/testing/xpcshell/node-http2/test/compressor.js
@@ -12,27 +12,27 @@ var Decompressor = compressor.Decompressor;
var test_integers = [{
N: 5,
I: 10,
- buffer: new Buffer([10])
+ buffer: Buffer.from([10])
}, {
N: 0,
I: 10,
- buffer: new Buffer([10])
+ buffer: Buffer.from([10])
}, {
N: 5,
I: 1337,
- buffer: new Buffer([31, 128 + 26, 10])
+ buffer: Buffer.from([31, 128 + 26, 10])
}, {
N: 0,
I: 1337,
- buffer: new Buffer([128 + 57, 10])
+ buffer: Buffer.from([128 + 57, 10])
}];
var test_strings = [{
string: 'www.foo.com',
- buffer: new Buffer('89f1e3c2f29ceb90f4ff', 'hex')
+ buffer: Buffer.from('89f1e3c2f29ceb90f4ff', 'hex')
}, {
string: 'éáűőúöüó€',
- buffer: new Buffer('13c3a9c3a1c5b1c591c3bac3b6c3bcc3b3e282ac', 'hex')
+ buffer: Buffer.from('13c3a9c3a1c5b1c591c3bac3b6c3bcc3b3e282ac', 'hex')
}];
test_huffman_request = {
@@ -85,7 +85,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('82', 'hex')
+ buffer: Buffer.from('82', 'hex')
}, {
// index
header: {
@@ -96,7 +96,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('86', 'hex')
+ buffer: Buffer.from('86', 'hex')
}, {
// index
header: {
@@ -107,7 +107,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('84', 'hex')
+ buffer: Buffer.from('84', 'hex')
}, {
// literal w/index, name index
header: {
@@ -118,7 +118,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('41' + '89f1e3c2f29ceb90f4ff', 'hex')
+ buffer: Buffer.from('41' + '89f1e3c2f29ceb90f4ff', 'hex')
}, {
// indexed
header: {
@@ -129,7 +129,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('82', 'hex')
+ buffer: Buffer.from('82', 'hex')
}, {
// indexed
header: {
@@ -140,7 +140,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('87', 'hex')
+ buffer: Buffer.from('87', 'hex')
}, {
// indexed
header: {
@@ -151,7 +151,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('84', 'hex')
+ buffer: Buffer.from('84', 'hex')
}, {
// literal w/index, name index
header: {
@@ -162,7 +162,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('41' + '89f1e3c2f18ec5c87a7f', 'hex')
+ buffer: Buffer.from('41' + '89f1e3c2f18ec5c87a7f', 'hex')
}, {
// literal w/index, name index
header: {
@@ -173,7 +173,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('58' + '86a8eb10649cbf', 'hex')
+ buffer: Buffer.from('58' + '86a8eb10649cbf', 'hex')
}, {
// index
header: {
@@ -184,7 +184,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('82', 'hex')
+ buffer: Buffer.from('82', 'hex')
}, {
// index
header: {
@@ -195,7 +195,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('87', 'hex')
+ buffer: Buffer.from('87', 'hex')
}, {
// literal w/index, name index
header: {
@@ -206,7 +206,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('44' + '8b6096a127a56ac699d72211', 'hex')
+ buffer: Buffer.from('44' + '8b6096a127a56ac699d72211', 'hex')
}, {
// index
header: {
@@ -217,7 +217,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('C0', 'hex')
+ buffer: Buffer.from('C0', 'hex')
}, {
// literal w/index, new name & value
header: {
@@ -228,7 +228,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('40' + '8825a849e95ba97d7f' + '8925a849e95bb8e8b4bf', 'hex')
+ buffer: Buffer.from('40' + '8825a849e95ba97d7f' + '8925a849e95bb8e8b4bf', 'hex')
}, {
// index
header: {
@@ -239,7 +239,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('82', 'hex')
+ buffer: Buffer.from('82', 'hex')
}, {
// index
header: {
@@ -250,7 +250,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('87', 'hex')
+ buffer: Buffer.from('87', 'hex')
}, {
// index
header: {
@@ -261,7 +261,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('BF', 'hex')
+ buffer: Buffer.from('BF', 'hex')
}, {
// index
header: {
@@ -272,7 +272,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('C2', 'hex')
+ buffer: Buffer.from('C2', 'hex')
}, {
// index
header: {
@@ -283,7 +283,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('C1', 'hex')
+ buffer: Buffer.from('C1', 'hex')
}, {
// index
header: {
@@ -294,7 +294,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('BE', 'hex')
+ buffer: Buffer.from('BE', 'hex')
}, {
// Literal w/o index, name index
header: {
@@ -305,7 +305,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('07' + '86f138d25ee5b3', 'hex')
+ buffer: Buffer.from('07' + '86f138d25ee5b3', 'hex')
}, {
// Literal w/o index, new name & value
header: {
@@ -316,7 +316,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('00' + '8294e7' + '03626172', 'hex')
+ buffer: Buffer.from('00' + '8294e7' + '03626172', 'hex')
}, {
// Literal never indexed, name index
header: {
@@ -327,7 +327,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('17' + '86f138d25ee5b3', 'hex')
+ buffer: Buffer.from('17' + '86f138d25ee5b3', 'hex')
}, {
// Literal never indexed, new name & value
header: {
@@ -338,7 +338,7 @@ var test_headers = [{
contextUpdate: false,
newMaxSize: 0
},
- buffer: new Buffer('10' + '8294e7' + '03626172', 'hex')
+ buffer: Buffer.from('10' + '8294e7' + '03626172', 'hex')
}, {
header: {
name: -1,
@@ -348,7 +348,7 @@ var test_headers = [{
contextUpdate: true,
newMaxSize: 100
},
- buffer: new Buffer('3F45', 'hex')
+ buffer: Buffer.from('3F45', 'hex')
}];
var test_header_sets = [{
@@ -398,12 +398,12 @@ describe('compressor.js', function() {
var table = HuffmanTable.huffmanTable;
for (var decoded in test_huffman_request) {
var encoded = test_huffman_request[decoded];
- expect(table.encode(new Buffer(decoded)).toString('hex')).to.equal(encoded);
+ expect(table.encode(Buffer.from(decoded)).toString('hex')).to.equal(encoded);
}
table = HuffmanTable.huffmanTable;
for (decoded in test_huffman_response) {
encoded = test_huffman_response[decoded];
- expect(table.encode(new Buffer(decoded)).toString('hex')).to.equal(encoded);
+ expect(table.encode(Buffer.from(decoded)).toString('hex')).to.equal(encoded);
}
});
});
@@ -412,12 +412,12 @@ describe('compressor.js', function() {
var table = HuffmanTable.huffmanTable;
for (var decoded in test_huffman_request) {
var encoded = test_huffman_request[decoded];
- expect(table.decode(new Buffer(encoded, 'hex')).toString()).to.equal(decoded);
+ expect(table.decode(Buffer.from(encoded, 'hex')).toString()).to.equal(decoded);
}
table = HuffmanTable.huffmanTable;
for (decoded in test_huffman_response) {
encoded = test_huffman_response[decoded];
- expect(table.decode(new Buffer(encoded, 'hex')).toString()).to.equal(decoded);
+ expect(table.decode(Buffer.from(encoded, 'hex')).toString()).to.equal(decoded);
}
});
});
@@ -509,12 +509,12 @@ describe('compressor.js', function() {
flags: {
END_HEADERS: false
},
- data: new Buffer(5)
+ data: Buffer.alloc(5)
});
decompressor.write({
type: 'DATA',
flags: {},
- data: new Buffer(5)
+ data: Buffer.alloc(5)
});
expect(error_occured).to.be.equal(true);
});
@@ -564,7 +564,7 @@ describe('compressor.js', function() {
while (Math.random() > 0.1) {
buffer.push(Math.floor(Math.random() * 256))
}
- buffer = new Buffer(buffer);
+ buffer = Buffer.from(buffer);
var table = HuffmanTable.huffmanTable;
var result = table.decode(table.encode(buffer));
expect(result).to.deep.equal(buffer);
diff --git a/testing/xpcshell/node-http2/test/connection.js b/testing/xpcshell/node-http2/test/connection.js
index 2c68857f7f..21785d620a 100644
--- a/testing/xpcshell/node-http2/test/connection.js
+++ b/testing/xpcshell/node-http2/test/connection.js
@@ -73,7 +73,7 @@ describe('connection.js', function() {
flags: {
'PONG': true
},
- data: new Buffer(8)
+ data: Buffer.alloc(8)
});
});
});
@@ -102,11 +102,11 @@ describe('connection.js', function() {
':method': 'GET',
':path': '/'
};
- var request_data = new Buffer(0);
+ var request_data = Buffer.alloc(0);
var response_headers = {
':status': '200'
};
- var response_data = new Buffer('12345678', 'hex');
+ var response_data = Buffer.from('12345678', 'hex');
// Setting up server
s.on('stream', function(server_stream) {
@@ -140,8 +140,8 @@ describe('connection.js', function() {
var response_headers = { ':status': '200' };
var push_request_headers = { ':method': 'get', ':path': '/x' };
var push_response_headers = { ':status': '200' };
- var response_content = new Buffer(10);
- var push_content = new Buffer(10);
+ var response_content = Buffer.alloc(10);
+ var push_content = Buffer.alloc(10);
done = util.callNTimes(5, done);
diff --git a/testing/xpcshell/node-http2/test/flow.js b/testing/xpcshell/node-http2/test/flow.js
index a077c68451..a64ab010c9 100644
--- a/testing/xpcshell/node-http2/test/flow.js
+++ b/testing/xpcshell/node-http2/test/flow.js
@@ -96,7 +96,7 @@ describe('flow.js', function() {
expect(flow.read()).to.equal(dataFrame);
});
it('should also split DATA frames when needed', function() {
- var buffer = new Buffer(10);
+ var buffer = Buffer.alloc(10);
var dataFrame = { type: 'DATA', flags: {}, stream: util.random(0, 100), data: buffer };
flow._send = util.noop;
flow._window = 5;
@@ -132,7 +132,7 @@ describe('flow.js', function() {
callback();
};
- var buffer = new Buffer(util.random(10, 100));
+ var buffer = Buffer.alloc(util.random(10, 100));
flow.write({ type: 'DATA', flags: {}, data: buffer });
flow.once('readable', function() {
expect(flow.read()).to.be.deep.equal({
@@ -163,10 +163,10 @@ describe('flow.js', function() {
var input = [];
flow1._send = function _send() {
if (input.length >= frameNumber) {
- this.push({ type: 'DATA', flags: { END_STREAM: true }, data: new Buffer(0) });
+ this.push({ type: 'DATA', flags: { END_STREAM: true }, data: Buffer.alloc(0) });
this.push(null);
} else {
- var buffer = new Buffer(util.random(1000, 100000));
+ var buffer = Buffer.allocUnsafe(util.random(1000, 100000));
input.push(buffer);
this.push({ type: 'DATA', flags: {}, data: buffer });
}
@@ -207,10 +207,10 @@ describe('flow.js', function() {
var input = [];
flow1._send = function _send() {
if (input.length >= frameNumber) {
- this.push({ type: 'DATA', flags: { END_STREAM: true }, data: new Buffer(0) });
+ this.push({ type: 'DATA', flags: { END_STREAM: true }, data: Buffer.alloc(0) });
this.push(null);
} else {
- var buffer = new Buffer(util.random(1000, 100000));
+ var buffer = Buffer.allocUnsafe(util.random(1000, 100000));
input.push(buffer);
this.push({ type: 'DATA', flags: {}, data: buffer });
}
diff --git a/testing/xpcshell/node-http2/test/framer.js b/testing/xpcshell/node-http2/test/framer.js
index 59cc711ba0..e2eb693665 100644
--- a/testing/xpcshell/node-http2/test/framer.js
+++ b/testing/xpcshell/node-http2/test/framer.js
@@ -26,10 +26,10 @@ var test_frames = [{
PADDED: false },
stream: 10,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
// length + type + flags + stream + content
- buffer: new Buffer('000004' + '00' + '00' + '0000000A' + '12345678', 'hex')
+ buffer: Buffer.from('000004' + '00' + '00' + '0000000A' + '12345678', 'hex')
}, {
frame: {
@@ -38,9 +38,9 @@ var test_frames = [{
PADDED: false, RESERVED5: false, PRIORITY: false },
stream: 15,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
- buffer: new Buffer('000004' + '01' + '00' + '0000000F' + '12345678', 'hex')
+ buffer: Buffer.from('000004' + '01' + '00' + '0000000F' + '12345678', 'hex')
}, {
frame: {
@@ -52,9 +52,9 @@ var test_frames = [{
priorityWeight: 5,
exclusiveDependency: false,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
- buffer: new Buffer('000009' + '01' + '20' + '0000000F' + '0000000A' + '05' + '12345678', 'hex')
+ buffer: Buffer.from('000009' + '01' + '20' + '0000000F' + '0000000A' + '05' + '12345678', 'hex')
}, {
@@ -67,9 +67,9 @@ var test_frames = [{
priorityWeight: 5,
exclusiveDependency: true,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
- buffer: new Buffer('000009' + '01' + '20' + '0000000F' + '8000000A' + '05' + '12345678', 'hex')
+ buffer: Buffer.from('000009' + '01' + '20' + '0000000F' + '8000000A' + '05' + '12345678', 'hex')
}, {
frame: {
@@ -81,7 +81,7 @@ var test_frames = [{
priorityWeight: 5,
exclusiveDependency: false
},
- buffer: new Buffer('000005' + '02' + '00' + '0000000A' + '00000009' + '05', 'hex')
+ buffer: Buffer.from('000005' + '02' + '00' + '0000000A' + '00000009' + '05', 'hex')
}, {
frame: {
@@ -93,7 +93,7 @@ var test_frames = [{
priorityWeight: 5,
exclusiveDependency: true
},
- buffer: new Buffer('000005' + '02' + '00' + '0000000A' + '80000009' + '05', 'hex')
+ buffer: Buffer.from('000005' + '02' + '00' + '0000000A' + '80000009' + '05', 'hex')
}, {
frame: {
@@ -103,7 +103,7 @@ var test_frames = [{
error: 'INTERNAL_ERROR'
},
- buffer: new Buffer('000004' + '03' + '00' + '0000000A' + '00000002', 'hex')
+ buffer: Buffer.from('000004' + '03' + '00' + '0000000A' + '00000002', 'hex')
}, {
frame: {
@@ -119,7 +119,7 @@ var test_frames = [{
SETTINGS_MAX_FRAME_SIZE: 0x00010000
}
},
- buffer: new Buffer('00001E' + '04' + '00' + '0000000A' + '0001' + '12345678' +
+ buffer: Buffer.from('00001E' + '04' + '00' + '0000000A' + '0001' + '12345678' +
'0002' + '00000001' +
'0003' + '01234567' +
'0004' + '89ABCDEF' +
@@ -133,9 +133,9 @@ var test_frames = [{
stream: 15,
promised_stream: 3,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
- buffer: new Buffer('000008' + '05' + '00' + '0000000F' + '00000003' + '12345678', 'hex')
+ buffer: Buffer.from('000008' + '05' + '00' + '0000000F' + '00000003' + '12345678', 'hex')
}, {
frame: {
@@ -143,9 +143,9 @@ var test_frames = [{
flags: { ACK: false },
stream: 15,
- data: new Buffer('1234567887654321', 'hex')
+ data: Buffer.from('1234567887654321', 'hex')
},
- buffer: new Buffer('000008' + '06' + '00' + '0000000F' + '1234567887654321', 'hex')
+ buffer: Buffer.from('000008' + '06' + '00' + '0000000F' + '1234567887654321', 'hex')
}, {
frame: {
@@ -156,7 +156,7 @@ var test_frames = [{
last_stream: 0x12345678,
error: 'PROTOCOL_ERROR'
},
- buffer: new Buffer('000008' + '07' + '00' + '0000000A' + '12345678' + '00000001', 'hex')
+ buffer: Buffer.from('000008' + '07' + '00' + '0000000A' + '12345678' + '00000001', 'hex')
}, {
frame: {
@@ -166,17 +166,17 @@ var test_frames = [{
window_size: 0x12345678
},
- buffer: new Buffer('000004' + '08' + '00' + '0000000A' + '12345678', 'hex')
+ buffer: Buffer.from('000004' + '08' + '00' + '0000000A' + '12345678', 'hex')
}, {
frame: {
type: 'CONTINUATION',
flags: { RESERVED1: false, RESERVED2: false, END_HEADERS: true },
stream: 10,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
// length + type + flags + stream + content
- buffer: new Buffer('000004' + '09' + '04' + '0000000A' + '12345678', 'hex')
+ buffer: Buffer.from('000004' + '09' + '04' + '0000000A' + '12345678', 'hex')
}, {
frame: {
type: 'ALTSVC',
@@ -189,7 +189,7 @@ var test_frames = [{
host: "altsvc.example.com",
origin: ""
},
- buffer: new Buffer(new Buffer('00002B' + '0A' + '00' + '00000000' + '0000', 'hex') + new Buffer('h2="altsvc.example.com:4443"; ma=31536000', 'ascii'))
+ buffer: Buffer.from(Buffer.from('00002B' + '0A' + '00' + '00000000' + '0000', 'hex') + Buffer.from('h2="altsvc.example.com:4443"; ma=31536000', 'ascii'))
}, {
frame: {
type: 'ALTSVC',
@@ -202,7 +202,7 @@ var test_frames = [{
host: "altsvc.example.com",
origin: "https://onlyme.example.com"
},
- buffer: new Buffer(new Buffer('000045' + '0A' + '00' + '00000000' + '001A', 'hex') + new Buffer('https://onlyme.example.comh2="altsvc.example.com:4443"; ma=31536000', 'ascii'))
+ buffer: Buffer.from(Buffer.from('000045' + '0A' + '00' + '00000000' + '001A', 'hex') + Buffer.from('https://onlyme.example.comh2="altsvc.example.com:4443"; ma=31536000', 'ascii'))
}, {
frame: {
@@ -210,7 +210,7 @@ var test_frames = [{
flags: { },
stream: 10
},
- buffer: new Buffer('000000' + '0B' + '00' + '0000000A', 'hex')
+ buffer: Buffer.from('000000' + '0B' + '00' + '0000000A', 'hex')
}];
var deserializer_test_frames = test_frames.slice(0);
@@ -220,10 +220,10 @@ var padded_test_frames = [{
flags: { END_STREAM: false, RESERVED2: false, RESERVED4: false,
PADDED: true },
stream: 10,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
// length + type + flags + stream + pad length + content + padding
- buffer: new Buffer('00000B' + '00' + '08' + '0000000A' + '06' + '12345678' + '000000000000', 'hex')
+ buffer: Buffer.from('00000B' + '00' + '08' + '0000000A' + '06' + '12345678' + '000000000000', 'hex')
}, {
frame: {
@@ -232,10 +232,10 @@ var padded_test_frames = [{
PADDED: true, RESERVED5: false, PRIORITY: false },
stream: 15,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
// length + type + flags + stream + pad length + data + padding
- buffer: new Buffer('00000B' + '01' + '08' + '0000000F' + '06' + '12345678' + '000000000000', 'hex')
+ buffer: Buffer.from('00000B' + '01' + '08' + '0000000F' + '06' + '12345678' + '000000000000', 'hex')
}, {
frame: {
@@ -247,10 +247,10 @@ var padded_test_frames = [{
priorityWeight: 5,
exclusiveDependency: false,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
// length + type + flags + stream + pad length + priority dependency + priority weight + data + padding
- buffer: new Buffer('000010' + '01' + '28' + '0000000F' + '06' + '0000000A' + '05' + '12345678' + '000000000000', 'hex')
+ buffer: Buffer.from('000010' + '01' + '28' + '0000000F' + '06' + '0000000A' + '05' + '12345678' + '000000000000', 'hex')
}, {
frame: {
@@ -262,10 +262,10 @@ var padded_test_frames = [{
priorityWeight: 5,
exclusiveDependency: true,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
// length + type + flags + stream + pad length + priority dependency + priority weight + data + padding
- buffer: new Buffer('000010' + '01' + '28' + '0000000F' + '06' + '8000000A' + '05' + '12345678' + '000000000000', 'hex')
+ buffer: Buffer.from('000010' + '01' + '28' + '0000000F' + '06' + '8000000A' + '05' + '12345678' + '000000000000', 'hex')
}, {
frame: {
@@ -275,10 +275,10 @@ var padded_test_frames = [{
stream: 15,
promised_stream: 3,
- data: new Buffer('12345678', 'hex')
+ data: Buffer.from('12345678', 'hex')
},
// length + type + flags + stream + pad length + promised stream + data + padding
- buffer: new Buffer('00000F' + '05' + '08' + '0000000F' + '06' + '00000003' + '12345678' + '000000000000', 'hex')
+ buffer: Buffer.from('00000F' + '05' + '08' + '0000000F' + '06' + '00000003' + '12345678' + '000000000000', 'hex')
}];
for (var idx = 0; idx < padded_test_frames.length; idx++) {
@@ -322,7 +322,7 @@ describe('framer.js', function() {
for (var i = 0; i < test_frames.length; i++) {
var test = test_frames[i];
stream.write(test.frame);
- var chunk, buffer = new Buffer(0);
+ var chunk, buffer = Buffer.alloc(0);
while (chunk = stream.read()) {
buffer = util.concat([buffer, chunk]);
}
@@ -384,7 +384,7 @@ describe('framer.js', function() {
describe('`frame`', function() {
var format = framer.serializers.frame;
it('should assign a unique ID to each frame', function() {
- var frame1 = { type: 'DATA', data: new Buffer(10) };
+ var frame1 = { type: 'DATA', data: Buffer.alloc(10) };
var frame2 = { type: 'PRIORITY', priority: 1 };
expect(format(frame1).id).to.be.equal(format(frame1));
expect(format(frame2).id).to.be.equal(format(frame2));
diff --git a/testing/xpcshell/node-http2/test/stream.js b/testing/xpcshell/node-http2/test/stream.js
index 90e0ef64b0..9e60932b8e 100644
--- a/testing/xpcshell/node-http2/test/stream.js
+++ b/testing/xpcshell/node-http2/test/stream.js
@@ -105,25 +105,25 @@ var example_frames = [
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} },
{ type: 'RST_STREAM', flags: {}, error: 'CANCEL' },
{ type: 'HEADERS', flags: {}, headers: {}, priority: undefined },
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'PUSH_PROMISE', flags: {}, headers: {}, promised_stream: new Stream(util.log, null) }
];
var invalid_incoming_frames = {
IDLE: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} },
{ type: 'RST_STREAM', flags: {}, error: 'CANCEL' }
],
RESERVED_LOCAL: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'HEADERS', flags: {}, headers: {}, priority: undefined },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} },
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} }
],
RESERVED_REMOTE: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} },
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} }
],
@@ -132,7 +132,7 @@ var invalid_incoming_frames = {
HALF_CLOSED_LOCAL: [
],
HALF_CLOSED_REMOTE: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'HEADERS', flags: {}, headers: {}, priority: undefined },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} }
]
@@ -140,17 +140,17 @@ var invalid_incoming_frames = {
var invalid_outgoing_frames = {
IDLE: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} }
],
RESERVED_LOCAL: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} },
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} }
],
RESERVED_REMOTE: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'HEADERS', flags: {}, headers: {}, priority: undefined },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} },
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} }
@@ -158,7 +158,7 @@ var invalid_outgoing_frames = {
OPEN: [
],
HALF_CLOSED_LOCAL: [
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'HEADERS', flags: {}, headers: {}, priority: undefined },
{ type: 'PUSH_PROMISE', flags: {}, headers: {} }
],
@@ -167,7 +167,7 @@ var invalid_outgoing_frames = {
CLOSED: [
{ type: 'WINDOW_UPDATE', flags: {}, settings: {} },
{ type: 'HEADERS', flags: {}, headers: {}, priority: undefined },
- { type: 'DATA', flags: {}, data: new Buffer(5) },
+ { type: 'DATA', flags: {}, data: Buffer.alloc(5) },
{ type: 'PUSH_PROMISE', flags: {}, headers: {}, promised_stream: new Stream(util.log, null) }
]
};
@@ -260,11 +260,11 @@ describe('stream.js', function() {
{ wait : 5 },
{ method : { name: 'end', arguments: [] } },
{ event : { name: 'state', data: ['HALF_CLOSED_LOCAL'] } },
- { outgoing: { type: 'DATA', flags: { END_STREAM: true }, data: new Buffer(0) } },
+ { outgoing: { type: 'DATA', flags: { END_STREAM: true }, data: Buffer.alloc(0) } },
{ wait : 10 },
{ incoming: { type: 'HEADERS', flags: { }, headers: { ':status': 200 } } },
- { incoming: { type: 'DATA' , flags: { END_STREAM: true }, data: new Buffer(5) } },
+ { incoming: { type: 'DATA' , flags: { END_STREAM: true }, data: Buffer.alloc(5) } },
{ event : { name: 'headers', data: [{ ':status': 200 }] } },
{ event : { name: 'state', data: ['CLOSED'] } },
@@ -274,15 +274,15 @@ describe('stream.js', function() {
});
describe('answering request', function() {
it('should trigger the appropriate state transitions and outgoing frames', function(done) {
- var payload = new Buffer(5);
+ var payload = Buffer.alloc(5);
execute_sequence([
{ incoming: { type: 'HEADERS', flags: { }, headers: { ':path': '/' } } },
{ event : { name: 'state', data: ['OPEN'] } },
{ event : { name: 'headers', data: [{ ':path': '/' }] } },
{ wait : 5 },
- { incoming: { type: 'DATA', flags: { }, data: new Buffer(5) } },
- { incoming: { type: 'DATA', flags: { END_STREAM: true }, data: new Buffer(10) } },
+ { incoming: { type: 'DATA', flags: { }, data: Buffer.alloc(5) } },
+ { incoming: { type: 'DATA', flags: { END_STREAM: true }, data: Buffer.alloc(10) } },
{ event : { name: 'state', data: ['HALF_CLOSED_REMOTE'] } },
{ wait : 5 },
@@ -300,7 +300,7 @@ describe('stream.js', function() {
});
describe('sending push stream', function() {
it('should trigger the appropriate state transitions and outgoing frames', function(done) {
- var payload = new Buffer(5);
+ var payload = Buffer.alloc(5);
var pushStream;
execute_sequence([
@@ -348,7 +348,7 @@ describe('stream.js', function() {
});
describe('receiving push stream', function() {
it('should trigger the appropriate state transitions and outgoing frames', function(done) {
- var payload = new Buffer(5);
+ var payload = Buffer.alloc(5);
var original_stream = createStream();
var promised_stream = createStream();
diff --git a/testing/xpcshell/node-http2/test/util.js b/testing/xpcshell/node-http2/test/util.js
index 52c6a1be36..c612e38b14 100644
--- a/testing/xpcshell/node-http2/test/util.js
+++ b/testing/xpcshell/node-http2/test/util.js
@@ -63,7 +63,7 @@ exports.concat = function concat(buffers) {
size += buffers[i].length;
}
- var concatenated = new Buffer(size);
+ var concatenated = Buffer.alloc(size);
for (var cursor = 0, j = 0; j < buffers.length; cursor += buffers[j].length, j++) {
buffers[j].copy(concatenated, cursor);
}
diff --git a/testing/xpcshell/node-ip/lib/ip.js b/testing/xpcshell/node-ip/lib/ip.js
index c1799a8c50..a66a2555c6 100644
--- a/testing/xpcshell/node-ip/lib/ip.js
+++ b/testing/xpcshell/node-ip/lib/ip.js
@@ -10,7 +10,7 @@ ip.toBuffer = function(ip, buff, offset) {
var result;
if (this.isV4Format(ip)) {
- result = buff || new Buffer(offset + 4);
+ result = buff || Buffer.alloc(offset + 4);
ip.split(/\./g).map(function(byte) {
result[offset++] = parseInt(byte, 10) & 0xff;
});
@@ -45,7 +45,7 @@ ip.toBuffer = function(ip, buff, offset) {
sections.splice.apply(sections, argv);
}
- result = buff || new Buffer(offset + 16);
+ result = buff || Buffer.alloc(offset + 16);
for (i = 0; i < sections.length; i++) {
var word = parseInt(sections[i], 16);
result[offset++] = (word >> 8) & 0xff;
@@ -110,7 +110,7 @@ ip.fromPrefixLen = function(prefixlen, family) {
if (family === 'ipv6') {
len = 16;
}
- var buff = new Buffer(len);
+ var buff = Buffer.alloc(len);
for (var i = 0, n = buff.length; i < n; ++i) {
var bits = 8;
@@ -129,7 +129,7 @@ ip.mask = function(addr, mask) {
addr = ip.toBuffer(addr);
mask = ip.toBuffer(mask);
- var result = new Buffer(Math.max(addr.length, mask.length));
+ var result = Buffer.alloc(Math.max(addr.length, mask.length));
var i = 0;
// Same protocol - do bitwise and
diff --git a/testing/xpcshell/node-ip/test/api-test.js b/testing/xpcshell/node-ip/test/api-test.js
index 2e390f986d..1af09a4f6f 100644
--- a/testing/xpcshell/node-ip/test/api-test.js
+++ b/testing/xpcshell/node-ip/test/api-test.js
@@ -14,7 +14,7 @@ describe('IP library for node.js', function() {
});
it('should convert to buffer IPv4 address in-place', function() {
- var buf = new Buffer(128);
+ var buf = Buffer.alloc(128);
var offset = 64;
ip.toBuffer('127.0.0.1', buf, offset);
assert.equal(buf.toString('hex', offset, offset + 4), '7f000001');
@@ -30,7 +30,7 @@ describe('IP library for node.js', function() {
});
it('should convert to buffer IPv6 address in-place', function() {
- var buf = new Buffer(128);
+ var buf = Buffer.alloc(128);
var offset = 64;
ip.toBuffer('::1', buf, offset);
assert(/(00){15,15}01/.test(buf.toString('hex', offset, offset + 16)));
diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py
index 72ea4b7cc2..c516043077 100644
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -1148,7 +1148,7 @@ class XPCShellTests(object):
msg, 0)
if searchObj:
self.env["MOZHTTP2_PORT"] = searchObj.group(1)
- self.env["MOZHTTP2_PROXY_PORT"] = searchObj.group(2)
+ self.env["MOZNODE_EXEC_PORT"] = searchObj.group(2)
except OSError as e:
# This occurs if the subprocess couldn't be started
self.log.error('Could not run %s server: %s' % (name, str(e)))