Bug 1497987 [wpt PR 13458] - Update test for 'noopener' feature of window.open, a=testonly
authorChris Dumez <cdumez@apple.com>
Sat, 13 Oct 2018 19:31:01 +0000
changeset 441140 6889ec30451700089a5ace06d3cd469a42e0b042
parent 441139 fd3050c5dd4fbd589a8a3b1bf7ca8811ef494946
child 441141 557a4d9d3524a94f9f99b971724cd348063c0bbf
push id108911
push userwptsync@mozilla.com
push dateSun, 14 Oct 2018 01:00:16 +0000
treeherdermozilla-inbound@5c8a070fcfe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1497987, 13458
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1497987 [wpt PR 13458] - Update test for 'noopener' feature of window.open, a=testonly Automatic update from web-platform-testsUpdate test for 'noopener' feature of window.open Update test for 'noopener' feature of window.open to reflect the changes made in https://github.com/whatwg/html/pull/4079. -- wpt-commits: 56e5e93ef1ce1097a1b8749423b52e1fa180f6aa wpt-pr: 13458
testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html
--- a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html
+++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html
@@ -35,18 +35,20 @@ test (t => {
   // Each of these variants should tokenize as feature ('noopener', '')
   // except where indicated
   // Note also that `value` is lowercased during tokenization
   var featureVariants = [
     'NOOPENER',
     'noOpenER',
     '  NOopener',
     '=NOOPENER',
-    'noopener=NOOPENER', // => ('noopener', 'noopener')
-    'NOOPENER=noopener' // => ('noopener', 'noopener')
+    'noopener=1',
+    'NOOPENER=1',
+    'NOOPENER=yes',
+    'noopener=YES',
   ];
   featureVariants.forEach(feature => {
     var win = window.open(windowURL, '', feature);
     assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
   });
 }, 'feature `name` should be converted to ASCII lowercase');
 
 test (t => {
@@ -77,62 +79,72 @@ test (t => {
   // before collecting `value`
   // Each of these variants should tokenize as feature ('noopener', '')
   // Except where indicated
   var featureVariants = [
     'noopener=  yes', // => ('noopener', 'yes')
     'noopener==,',
     'noopener=\n ,',
     'noopener = \t ,',
-    'noopener\n=\r noopener,', // => ('noopener', 'noopener')
+    'noopener\n=\r 1,', // => ('noopener', '1')
     'noopener=,yes', // => ('noopener'), ('yes')
-    'noopener= foo=,', // => ('noopener', 'foo')
+    'noopener= yes=,', // => ('noopener', 'yes')
     'noopener = \u000Cyes' // => ('noopener', 'yes')
   ];
   featureVariants.forEach(feature => {
     var win = window.open(windowURL, '', feature);
     assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
   });
 }, 'Tokenizing should ignore window feature separators except "," after initial "=" and before value');
 
 test (t => {
   // Tokenizing `value` should collect any non-separator code points until first separator
   var featureVariants = [
-    'noopener=noopener', // => ('noopener', 'noopener')
+    'noopener=1', // => ('noopener', 'noopener')
     'noopener=yes', // => ('noopener', 'yes')
     'noopener = yes ,', // => ('noopener', 'yes')
     'noopener=\nyes  ,', // => ('noopener', 'yes')
     'noopener=yes yes', // => ('noopener', 'yes'), ('yes', '')
     'noopener=yes\ts', // => ('noopener', 'yes'), ('s', '')
     'noopener==', // => ('noopener', '')
-    'noopener=0\n,', // => ('noopener', '0')
+    'noopener=1\n,', // => ('noopener', '1')
     '==noopener===', // => ('noopener', '')
     'noopener==\u000C' // => ('noopener', '')
   ];
   featureVariants.forEach(feature => {
     var win = window.open(windowURL, '', feature);
     assert_equals(win, null, `"${feature}" should set "noopener"`);
   });
 }, 'Tokenizing should read characters until first window feature separator as `value`');
 
 test (t => {
-  // If tokenizedFeatures contains an entry with the key "noopener"...disown opener
-  // i.e. `value` should be irrelevant
   var featureVariants = [
-    'noopener=false',
-    ',noopener=0, ',
-    'foo=bar,noopener=noopener,',
-    'noopener=true',
-    'noopener=foo\nbar\t'
+    'noopener=1',
+    'noopener=2',
+    'noopener=12345',
+    'noopener=1.5',
+    'noopener=-1',
   ];
   featureVariants.forEach(feature => {
     var win = window.open(windowURL, '', feature);
     assert_equals(win, null, `"${feature}" should activate feature "noopener"`);
   });
-}, '"noopener" should be based on name (key), not value');
+}, 'Integer values other than 0 should activate the feature');
+
+test (t => {
+  var featureVariants = [
+    'noopener=0',
+    'noopener=0.5',
+    'noopener=error',
+  ];
+  featureVariants.forEach(feature => {
+    var win = window.open(windowURL, '', feature);
+    assert_not_equals(win, null, `"${feature}" should NOT activate feature "noopener"`);
+  });
+}, 'Integer value of 0 should not activate the feature');
 
 test (t => {
   var invalidFeatureVariants = [
     '-noopener', //     => ('-noopener', '')
     'NOOPENERRRR', //   => ('noopenerrr', '')
     'noOpenErR', //     => ('noopenerr', '')
     'no_opener', //     => ('no_opener', '')
     ' no opener', //    => ('no', ''), ('opener', '')