Changeset 235050 in webkit
- Timestamp:
- Aug 20, 2018 4:47:38 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r235026 r235050 1 2018-08-20 Rob Buis <rbuis@igalia.com> 2 3 Throw an exception if window.open() gets passed a URL that cannot be parsed 4 https://bugs.webkit.org/show_bug.cgi?id=171656 5 6 Reviewed by Darin Adler. 7 8 * fast/dom/Window/open-invalid-url-expected.txt: 9 * fast/dom/Window/open-invalid-url.html: 10 1 11 2018-08-20 Ms2ger <Ms2ger@igalia.com> 2 12 -
trunk/LayoutTests/fast/dom/Window/open-invalid-url-expected.txt
r178527 r235050 1 CONSOLE MESSAGE: line 1: Unable to open a window with invalid URL '/'.2 3 1 ALERT: PASS 4 2 -
trunk/LayoutTests/fast/dom/Window/open-invalid-url.html
r120792 r235050 12 12 var a = window.open("about:blank","moonshine") 13 13 function mountainGoat() { 14 a.window.eval('setTimeout(" alert(window.open(\'/\') ? \'FAIL\' : \'PASS\'); if (window.testRunner) testRunner.notifyDone()", 0)')14 a.window.eval('setTimeout("try { window.open(\'/\'); alert(\'FAIL\'); } catch(ex) { alert(\'PASS\'); }; if (window.testRunner) testRunner.notifyDone()", 0)') 15 15 } 16 16 setTimeout("mountainGoat()", 0) -
trunk/LayoutTests/imported/w3c/ChangeLog
r235025 r235050 1 2018-08-20 Rob Buis <rbuis@igalia.com> 2 3 Throw an exception if window.open() gets passed a URL that cannot be parsed 4 https://bugs.webkit.org/show_bug.cgi?id=171656 5 6 Reviewed by Darin Adler. 7 8 * web-platform-tests/url/failure-expected.txt: 9 1 10 2018-08-20 Rob Buis <rbuis@igalia.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/failure-expected.txt
r225085 r235050 1 1 CONSOLE MESSAGE: line 38: Not allowed to load local resource: example:1 2 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL ''.3 4 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL ''.5 6 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL ''.7 8 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://user:pass@/'.9 10 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://foo:-80/'.11 12 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://user@/www.example.com'.13 14 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://@/www.example.com'.15 16 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https:@/www.example.com'.17 18 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://a:b@/www.example.com'.19 20 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://@:www.example.com'.21 22 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://�'.23 24 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://%EF%BF%BD'.25 26 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://x x:12'.27 28 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://[www.google.com]/'.29 30 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://31 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc:// /'.32 33 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://@/'.34 35 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://te@s:t@/'.36 37 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://:/'.38 39 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://:12/'.40 41 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://[/'.42 43 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://\/'.44 45 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'sc://]/'.46 47 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'ftp://example.com%80/'.48 49 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'ftp://example.com%A0/'.50 51 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://example.com%80/'.52 53 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://example.com%A0/'.54 55 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://0x100000000/test'.56 57 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://256.0.0.1/test'.58 59 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://[0::0::0]'.60 61 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://[0:.0]'.62 63 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://[0:0:]'.64 65 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://[0:1:2:3:4:5:6:7.0.0.0.1]'.66 67 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://[0:1.00.0.0.0]'.68 69 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://[0:1.290.0.0.0]'.70 71 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'https://[0:1.23.23]'.72 73 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://?'.74 75 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://#'.76 77 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'non-special://[:80/'.78 79 CONSOLE MESSAGE: line 38: Unable to open a window with invalid URL 'http://[::127.0.0.0.1]'.80 81 2 82 3 PASS Loading data… … … 90 11 PASS sendBeacon(): file://example:test/ should throw 91 12 FAIL Location's href: file://example:test/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 92 FAIL window.open(): file://example:test/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 13 PASS window.open(): file://example:test/ should throw 93 14 PASS URL's href: file://example%/ should throw 94 15 FAIL XHR: file://example%/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 95 16 PASS sendBeacon(): file://example%/ should throw 96 17 FAIL Location's href: file://example%/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 97 FAIL window.open(): file://example%/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 18 PASS window.open(): file://example%/ should throw 98 19 PASS URL's href: file://[example]/ should throw 99 20 FAIL XHR: file://[example]/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 100 21 PASS sendBeacon(): file://[example]/ should throw 101 22 FAIL Location's href: file://[example]/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 102 FAIL window.open(): file://[example]/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 23 PASS window.open(): file://[example]/ should throw 103 24 PASS URL's href: http://user:pass@/ should throw 104 25 FAIL XHR: http://user:pass@/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 105 26 PASS sendBeacon(): http://user:pass@/ should throw 106 27 FAIL Location's href: http://user:pass@/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 107 FAIL window.open(): http://user:pass@/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 28 PASS window.open(): http://user:pass@/ should throw 108 29 PASS URL's href: http://foo:-80/ should throw 109 30 FAIL XHR: http://foo:-80/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 110 31 PASS sendBeacon(): http://foo:-80/ should throw 111 32 FAIL Location's href: http://foo:-80/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 112 FAIL window.open(): http://foo:-80/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 33 PASS window.open(): http://foo:-80/ should throw 113 34 PASS URL's href: http:/:@/www.example.com should throw 114 35 FAIL XHR: http:/:@/www.example.com should throw assert_throws: function "() => client.open("GET", test.input)" did not throw … … 120 41 PASS sendBeacon(): http://user@/www.example.com should throw 121 42 FAIL Location's href: http://user@/www.example.com should throw assert_throws: function "() => self[0].location = test.input" did not throw 122 FAIL window.open(): http://user@/www.example.com should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 43 PASS window.open(): http://user@/www.example.com should throw 123 44 PASS URL's href: http:@/www.example.com should throw 124 45 FAIL XHR: http:@/www.example.com should throw assert_throws: function "() => client.open("GET", test.input)" did not throw … … 135 56 PASS sendBeacon(): http://@/www.example.com should throw 136 57 FAIL Location's href: http://@/www.example.com should throw assert_throws: function "() => self[0].location = test.input" did not throw 137 FAIL window.open(): http://@/www.example.com should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 58 PASS window.open(): http://@/www.example.com should throw 138 59 PASS URL's href: https:@/www.example.com should throw 139 60 FAIL XHR: https:@/www.example.com should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 140 61 PASS sendBeacon(): https:@/www.example.com should throw 141 62 FAIL Location's href: https:@/www.example.com should throw assert_throws: function "() => self[0].location = test.input" did not throw 142 FAIL window.open(): https:@/www.example.com should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 63 PASS window.open(): https:@/www.example.com should throw 143 64 PASS URL's href: http:a:b@/www.example.com should throw 144 65 FAIL XHR: http:a:b@/www.example.com should throw assert_throws: function "() => client.open("GET", test.input)" did not throw … … 155 76 PASS sendBeacon(): http://a:b@/www.example.com should throw 156 77 FAIL Location's href: http://a:b@/www.example.com should throw assert_throws: function "() => self[0].location = test.input" did not throw 157 FAIL window.open(): http://a:b@/www.example.com should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 78 PASS window.open(): http://a:b@/www.example.com should throw 158 79 PASS URL's href: http::@/www.example.com should throw 159 80 FAIL XHR: http::@/www.example.com should throw assert_throws: function "() => client.open("GET", test.input)" did not throw … … 175 96 PASS sendBeacon(): http://@:www.example.com should throw 176 97 FAIL Location's href: http://@:www.example.com should throw assert_throws: function "() => self[0].location = test.input" did not throw 177 FAIL window.open(): http://@:www.example.com should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 98 PASS window.open(): http://@:www.example.com should throw 178 99 PASS URL's href: https://� should throw 179 100 FAIL XHR: https://� should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 180 101 PASS sendBeacon(): https://� should throw 181 102 FAIL Location's href: https://� should throw assert_throws: function "() => self[0].location = test.input" did not throw 182 FAIL window.open(): https://� should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 103 PASS window.open(): https://� should throw 183 104 PASS URL's href: https://%EF%BF%BD should throw 184 105 FAIL XHR: https://%EF%BF%BD should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 185 106 PASS sendBeacon(): https://%EF%BF%BD should throw 186 107 FAIL Location's href: https://%EF%BF%BD should throw assert_throws: function "() => self[0].location = test.input" did not throw 187 FAIL window.open(): https://%EF%BF%BD should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 108 PASS window.open(): https://%EF%BF%BD should throw 188 109 PASS URL's href: https://x x:12 should throw 189 110 FAIL XHR: https://x x:12 should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 190 111 PASS sendBeacon(): https://x x:12 should throw 191 112 FAIL Location's href: https://x x:12 should throw assert_throws: function "() => self[0].location = test.input" did not throw 192 FAIL window.open(): https://x x:12 should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 113 PASS window.open(): https://x x:12 should throw 193 114 PASS URL's href: http://[www.google.com]/ should throw 194 115 FAIL XHR: http://[www.google.com]/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 195 116 PASS sendBeacon(): http://[www.google.com]/ should throw 196 117 FAIL Location's href: http://[www.google.com]/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 197 FAIL window.open(): http://[www.google.com]/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 118 PASS window.open(): http://[www.google.com]/ should throw 198 119 PASS URL's href: sc://\0/ should throw 199 120 FAIL XHR: sc://\0/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 200 121 PASS sendBeacon(): sc://\0/ should throw 201 122 FAIL Location's href: sc://\0/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 202 FAIL window.open(): sc://\0/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 123 PASS window.open(): sc://\0/ should throw 203 124 PASS URL's href: sc:// / should throw 204 125 FAIL XHR: sc:// / should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 205 126 PASS sendBeacon(): sc:// / should throw 206 127 FAIL Location's href: sc:// / should throw assert_throws: function "() => self[0].location = test.input" did not throw 207 FAIL window.open(): sc:// / should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 128 PASS window.open(): sc:// / should throw 208 129 PASS URL's href: sc://@/ should throw 209 130 FAIL XHR: sc://@/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 210 131 PASS sendBeacon(): sc://@/ should throw 211 132 FAIL Location's href: sc://@/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 212 FAIL window.open(): sc://@/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 133 PASS window.open(): sc://@/ should throw 213 134 PASS URL's href: sc://te@s:t@/ should throw 214 135 FAIL XHR: sc://te@s:t@/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 215 136 PASS sendBeacon(): sc://te@s:t@/ should throw 216 137 FAIL Location's href: sc://te@s:t@/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 217 FAIL window.open(): sc://te@s:t@/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 138 PASS window.open(): sc://te@s:t@/ should throw 218 139 PASS URL's href: sc://:/ should throw 219 140 FAIL XHR: sc://:/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 220 141 PASS sendBeacon(): sc://:/ should throw 221 142 FAIL Location's href: sc://:/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 222 FAIL window.open(): sc://:/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 143 PASS window.open(): sc://:/ should throw 223 144 PASS URL's href: sc://:12/ should throw 224 145 FAIL XHR: sc://:12/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 225 146 PASS sendBeacon(): sc://:12/ should throw 226 147 FAIL Location's href: sc://:12/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 227 FAIL window.open(): sc://:12/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 148 PASS window.open(): sc://:12/ should throw 228 149 PASS URL's href: sc://[/ should throw 229 150 FAIL XHR: sc://[/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 230 151 PASS sendBeacon(): sc://[/ should throw 231 152 FAIL Location's href: sc://[/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 232 FAIL window.open(): sc://[/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 153 PASS window.open(): sc://[/ should throw 233 154 PASS URL's href: sc://\/ should throw 234 155 FAIL XHR: sc://\/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 235 156 PASS sendBeacon(): sc://\/ should throw 236 157 FAIL Location's href: sc://\/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 237 FAIL window.open(): sc://\/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 158 PASS window.open(): sc://\/ should throw 238 159 PASS URL's href: sc://]/ should throw 239 160 FAIL XHR: sc://]/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 240 161 PASS sendBeacon(): sc://]/ should throw 241 162 FAIL Location's href: sc://]/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 242 FAIL window.open(): sc://]/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 163 PASS window.open(): sc://]/ should throw 243 164 PASS URL's href: ftp://example.com%80/ should throw 244 165 FAIL XHR: ftp://example.com%80/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 245 166 PASS sendBeacon(): ftp://example.com%80/ should throw 246 167 FAIL Location's href: ftp://example.com%80/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 247 FAIL window.open(): ftp://example.com%80/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 168 PASS window.open(): ftp://example.com%80/ should throw 248 169 PASS URL's href: ftp://example.com%A0/ should throw 249 170 FAIL XHR: ftp://example.com%A0/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 250 171 PASS sendBeacon(): ftp://example.com%A0/ should throw 251 172 FAIL Location's href: ftp://example.com%A0/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 252 FAIL window.open(): ftp://example.com%A0/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 173 PASS window.open(): ftp://example.com%A0/ should throw 253 174 PASS URL's href: https://example.com%80/ should throw 254 175 FAIL XHR: https://example.com%80/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 255 176 PASS sendBeacon(): https://example.com%80/ should throw 256 177 FAIL Location's href: https://example.com%80/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 257 FAIL window.open(): https://example.com%80/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 178 PASS window.open(): https://example.com%80/ should throw 258 179 PASS URL's href: https://example.com%A0/ should throw 259 180 FAIL XHR: https://example.com%A0/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 260 181 PASS sendBeacon(): https://example.com%A0/ should throw 261 182 FAIL Location's href: https://example.com%A0/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 262 FAIL window.open(): https://example.com%A0/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 183 PASS window.open(): https://example.com%A0/ should throw 263 184 PASS URL's href: https://0x100000000/test should throw 264 185 FAIL XHR: https://0x100000000/test should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 265 186 PASS sendBeacon(): https://0x100000000/test should throw 266 187 FAIL Location's href: https://0x100000000/test should throw assert_throws: function "() => self[0].location = test.input" did not throw 267 FAIL window.open(): https://0x100000000/test should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 188 PASS window.open(): https://0x100000000/test should throw 268 189 PASS URL's href: https://256.0.0.1/test should throw 269 190 FAIL XHR: https://256.0.0.1/test should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 270 191 PASS sendBeacon(): https://256.0.0.1/test should throw 271 192 FAIL Location's href: https://256.0.0.1/test should throw assert_throws: function "() => self[0].location = test.input" did not throw 272 FAIL window.open(): https://256.0.0.1/test should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 193 PASS window.open(): https://256.0.0.1/test should throw 273 194 PASS URL's href: https://[0::0::0] should throw 274 195 FAIL XHR: https://[0::0::0] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 275 196 PASS sendBeacon(): https://[0::0::0] should throw 276 197 FAIL Location's href: https://[0::0::0] should throw assert_throws: function "() => self[0].location = test.input" did not throw 277 FAIL window.open(): https://[0::0::0] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 198 PASS window.open(): https://[0::0::0] should throw 278 199 PASS URL's href: https://[0:.0] should throw 279 200 FAIL XHR: https://[0:.0] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 280 201 PASS sendBeacon(): https://[0:.0] should throw 281 202 FAIL Location's href: https://[0:.0] should throw assert_throws: function "() => self[0].location = test.input" did not throw 282 FAIL window.open(): https://[0:.0] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 203 PASS window.open(): https://[0:.0] should throw 283 204 PASS URL's href: https://[0:0:] should throw 284 205 FAIL XHR: https://[0:0:] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 285 206 PASS sendBeacon(): https://[0:0:] should throw 286 207 FAIL Location's href: https://[0:0:] should throw assert_throws: function "() => self[0].location = test.input" did not throw 287 FAIL window.open(): https://[0:0:] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 208 PASS window.open(): https://[0:0:] should throw 288 209 PASS URL's href: https://[0:1:2:3:4:5:6:7.0.0.0.1] should throw 289 210 FAIL XHR: https://[0:1:2:3:4:5:6:7.0.0.0.1] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 290 211 PASS sendBeacon(): https://[0:1:2:3:4:5:6:7.0.0.0.1] should throw 291 212 FAIL Location's href: https://[0:1:2:3:4:5:6:7.0.0.0.1] should throw assert_throws: function "() => self[0].location = test.input" did not throw 292 FAIL window.open(): https://[0:1:2:3:4:5:6:7.0.0.0.1] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 213 PASS window.open(): https://[0:1:2:3:4:5:6:7.0.0.0.1] should throw 293 214 PASS URL's href: https://[0:1.00.0.0.0] should throw 294 215 FAIL XHR: https://[0:1.00.0.0.0] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 295 216 PASS sendBeacon(): https://[0:1.00.0.0.0] should throw 296 217 FAIL Location's href: https://[0:1.00.0.0.0] should throw assert_throws: function "() => self[0].location = test.input" did not throw 297 FAIL window.open(): https://[0:1.00.0.0.0] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 218 PASS window.open(): https://[0:1.00.0.0.0] should throw 298 219 PASS URL's href: https://[0:1.290.0.0.0] should throw 299 220 FAIL XHR: https://[0:1.290.0.0.0] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 300 221 PASS sendBeacon(): https://[0:1.290.0.0.0] should throw 301 222 FAIL Location's href: https://[0:1.290.0.0.0] should throw assert_throws: function "() => self[0].location = test.input" did not throw 302 FAIL window.open(): https://[0:1.290.0.0.0] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 223 PASS window.open(): https://[0:1.290.0.0.0] should throw 303 224 PASS URL's href: https://[0:1.23.23] should throw 304 225 FAIL XHR: https://[0:1.23.23] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 305 226 PASS sendBeacon(): https://[0:1.23.23] should throw 306 227 FAIL Location's href: https://[0:1.23.23] should throw assert_throws: function "() => self[0].location = test.input" did not throw 307 FAIL window.open(): https://[0:1.23.23] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 228 PASS window.open(): https://[0:1.23.23] should throw 308 229 PASS URL's href: http://? should throw 309 230 FAIL XHR: http://? should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 310 231 PASS sendBeacon(): http://? should throw 311 232 FAIL Location's href: http://? should throw assert_throws: function "() => self[0].location = test.input" did not throw 312 FAIL window.open(): http://? should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 233 PASS window.open(): http://? should throw 313 234 PASS URL's href: http://# should throw 314 235 FAIL XHR: http://# should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 315 236 PASS sendBeacon(): http://# should throw 316 237 FAIL Location's href: http://# should throw assert_throws: function "() => self[0].location = test.input" did not throw 317 FAIL window.open(): http://# should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 238 PASS window.open(): http://# should throw 318 239 PASS URL's href: non-special://[:80/ should throw 319 240 FAIL XHR: non-special://[:80/ should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 320 241 PASS sendBeacon(): non-special://[:80/ should throw 321 242 FAIL Location's href: non-special://[:80/ should throw assert_throws: function "() => self[0].location = test.input" did not throw 322 FAIL window.open(): non-special://[:80/ should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 243 PASS window.open(): non-special://[:80/ should throw 323 244 PASS URL's href: http://[::127.0.0.0.1] should throw 324 245 FAIL XHR: http://[::127.0.0.0.1] should throw assert_throws: function "() => client.open("GET", test.input)" did not throw 325 246 PASS sendBeacon(): http://[::127.0.0.0.1] should throw 326 247 FAIL Location's href: http://[::127.0.0.0.1] should throw assert_throws: function "() => self[0].location = test.input" did not throw 327 FAIL window.open(): http://[::127.0.0.0.1] should throw assert_throws: function "() => self.open(test.input).close()" threw object "TypeError: null is not an object (evaluating 'self.open(test.input).close')" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 248 PASS window.open(): http://[::127.0.0.0.1] should throw 328 249 -
trunk/Source/WebCore/ChangeLog
r235026 r235050 1 2018-08-20 Rob Buis <rbuis@igalia.com> 2 3 Throw an exception if window.open() gets passed a URL that cannot be parsed 4 https://bugs.webkit.org/show_bug.cgi?id=171656 5 6 Reviewed by Darin Adler. 7 8 Throw a SyntaxError exception when an invalid url gets passed into window.open(). 9 10 Tests: imported/w3c/web-platform-tests/url/failure.html 11 fast/dom/Window/open-invalid-url.html 12 13 * page/DOMWindow.cpp: 14 (WebCore::DOMWindow::createWindow): 15 (WebCore::DOMWindow::open): 16 (WebCore::DOMWindow::showModalDialog): 17 * page/DOMWindow.h: 18 * page/DOMWindow.idl: 19 * testing/Internals.cpp: 20 (WebCore::Internals::openDummyInspectorFrontend): 21 1 22 2018-08-20 Ms2ger <Ms2ger@igalia.com> 2 23 -
trunk/Source/WebCore/page/DOMWindow.cpp
r234995 r235050 2236 2236 } 2237 2237 2238 RefPtr<Frame> DOMWindow::createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures& windowFeatures, DOMWindow& activeWindow, Frame& firstFrame, Frame& openerFrame, const WTF::Function<void(DOMWindow&)>& prepareDialogFunction)2238 ExceptionOr<RefPtr<Frame>> DOMWindow::createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures& windowFeatures, DOMWindow& activeWindow, Frame& firstFrame, Frame& openerFrame, const WTF::Function<void(DOMWindow&)>& prepareDialogFunction) 2239 2239 { 2240 2240 Frame* activeFrame = activeWindow.frame(); 2241 2241 if (!activeFrame) 2242 return nullptr;2242 return RefPtr<Frame> { nullptr }; 2243 2243 2244 2244 Document* activeDocument = activeWindow.document(); 2245 2245 if (!activeDocument) 2246 return nullptr;2246 return RefPtr<Frame> { nullptr }; 2247 2247 2248 2248 URL completedURL = urlString.isEmpty() ? URL(ParsedURLString, emptyString()) : firstFrame.document()->completeURL(urlString); 2249 if (!completedURL.isEmpty() && !completedURL.isValid()) { 2250 // Don't expose client code to invalid URLs. 2251 activeWindow.printErrorMessage("Unable to open a window with invalid URL '" + completedURL.string() + "'.\n"); 2252 return nullptr; 2253 } 2249 if (!completedURL.isEmpty() && !completedURL.isValid()) 2250 return Exception { SyntaxError }; 2254 2251 2255 2252 // For whatever reason, Firefox uses the first frame to determine the outgoingReferrer. We replicate that behavior here. … … 2266 2263 RefPtr<Frame> newFrame = WebCore::createWindow(*activeFrame, openerFrame, WTFMove(frameLoadRequest), windowFeatures, created); 2267 2264 if (!newFrame) 2268 return nullptr;2265 return RefPtr<Frame> { nullptr }; 2269 2266 2270 2267 if (!windowFeatures.noopener) … … 2273 2270 2274 2271 if (newFrame->document()->domWindow()->isInsecureScriptAccess(activeWindow, completedURL)) 2275 return windowFeatures.noopener ? nullptr: newFrame;2272 return windowFeatures.noopener ? RefPtr<Frame> { nullptr } : newFrame; 2276 2273 2277 2274 if (prepareDialogFunction) … … 2299 2296 // Navigating the new frame could result in it being detached from its page by a navigation policy delegate. 2300 2297 if (!newFrame->page()) 2301 return nullptr;2302 2303 return windowFeatures.noopener ? nullptr: newFrame;2304 } 2305 2306 RefPtr<WindowProxy> DOMWindow::open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString, const AtomicString& frameName, const String& windowFeaturesString)2307 { 2308 if (!isCurrentlyDisplayedInFrame()) 2309 return nullptr;2298 return RefPtr<Frame> { nullptr }; 2299 2300 return windowFeatures.noopener ? RefPtr<Frame> { nullptr } : newFrame; 2301 } 2302 2303 ExceptionOr<RefPtr<WindowProxy>> DOMWindow::open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString, const AtomicString& frameName, const String& windowFeaturesString) 2304 { 2305 if (!isCurrentlyDisplayedInFrame()) 2306 return RefPtr<WindowProxy> { nullptr }; 2310 2307 2311 2308 auto* activeDocument = activeWindow.document(); 2312 2309 if (!activeDocument) 2313 return nullptr;2310 return RefPtr<WindowProxy> { nullptr }; 2314 2311 2315 2312 auto* firstFrame = firstWindow.frame(); 2316 2313 if (!firstFrame) 2317 return nullptr;2314 return RefPtr<WindowProxy> { nullptr }; 2318 2315 2319 2316 #if ENABLE(CONTENT_EXTENSIONS) … … 2325 2322 for (auto& action : firstFrame->page()->userContentProvider().actionsForResourceLoad(resourceLoadInfo, *firstFrame->mainFrame().document()->loader()).first) { 2326 2323 if (action.type() == ContentExtensions::ActionType::BlockLoad) 2327 return nullptr;2324 return RefPtr<WindowProxy> { nullptr }; 2328 2325 } 2329 2326 } … … 2334 2331 // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker. 2335 2332 if (frameName.isEmpty() || !m_frame->loader().findFrameForNavigation(frameName, activeDocument)) 2336 return nullptr;2333 return RefPtr<WindowProxy> { nullptr }; 2337 2334 } 2338 2335 … … 2350 2347 if (targetFrame) { 2351 2348 if (!activeDocument->canNavigate(targetFrame)) 2352 return nullptr;2349 return RefPtr<WindowProxy> { nullptr }; 2353 2350 2354 2351 URL completedURL = firstFrame->document()->completeURL(urlString); … … 2368 2365 } 2369 2366 2370 auto newFrame = createWindow(urlString, frameName, parseWindowFeatures(windowFeaturesString), activeWindow, *firstFrame, *m_frame); 2371 return newFrame ? &newFrame->windowProxy() : nullptr; 2367 auto newFrameOrException = createWindow(urlString, frameName, parseWindowFeatures(windowFeaturesString), activeWindow, *firstFrame, *m_frame); 2368 if (newFrameOrException.hasException()) 2369 return newFrameOrException.releaseException(); 2370 2371 auto newFrame = newFrameOrException.releaseReturnValue(); 2372 return newFrame ? &newFrame->windowProxy() : RefPtr<WindowProxy> { nullptr }; 2372 2373 } 2373 2374 … … 2394 2395 return; 2395 2396 2396 RefPtr<Frame> dialogFrame = createWindow(urlString, emptyAtom(), parseDialogFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view())), activeWindow, *firstFrame, *m_frame, prepareDialogFunction); 2397 auto dialogFrameOrException = createWindow(urlString, emptyAtom(), parseDialogFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view())), activeWindow, *firstFrame, *m_frame, prepareDialogFunction); 2398 if (dialogFrameOrException.hasException()) 2399 return; 2400 RefPtr<Frame> dialogFrame = dialogFrameOrException.releaseReturnValue(); 2397 2401 if (!dialogFrame) 2398 2402 return; -
trunk/Source/WebCore/page/DOMWindow.h
r232613 r235050 160 160 void stop(); 161 161 162 WEBCORE_EXPORT RefPtr<WindowProxy> open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString, const AtomicString& frameName, const String& windowFeaturesString);162 WEBCORE_EXPORT ExceptionOr<RefPtr<WindowProxy>> open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString, const AtomicString& frameName, const String& windowFeaturesString); 163 163 164 164 void showModalDialog(const String& urlString, const String& dialogFeaturesString, DOMWindow& activeWindow, DOMWindow& firstWindow, const WTF::Function<void(DOMWindow&)>& prepareDialogFunction); … … 351 351 void willDetachPage() final; 352 352 353 static RefPtr<Frame> createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures&, DOMWindow& activeWindow, Frame& firstFrame, Frame& openerFrame, const WTF::Function<void(DOMWindow&)>& prepareDialogFunction = nullptr);353 static ExceptionOr<RefPtr<Frame>> createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures&, DOMWindow& activeWindow, Frame& firstFrame, Frame& openerFrame, const WTF::Function<void(DOMWindow&)>& prepareDialogFunction = nullptr); 354 354 bool isInsecureScriptAccess(DOMWindow& activeWindow, const String& urlString); 355 355 -
trunk/Source/WebCore/page/DOMWindow.idl
r234588 r235050 77 77 [Replaceable, DoNotCheckSecurityIf=CrossOriginWindowPolicyAllow] readonly attribute WindowProxy? parent; 78 78 [CheckSecurityForNode] readonly attribute Element? frameElement; 79 [CallWith=ActiveWindow&FirstWindow ] WindowProxy? open(optional USVString url = "about:blank", optional DOMString target = "_blank", optional [TreatNullAs=EmptyString] DOMString features = "");79 [CallWith=ActiveWindow&FirstWindow, MayThrowException] WindowProxy? open(optional USVString url = "about:blank", optional DOMString target = "_blank", optional [TreatNullAs=EmptyString] DOMString features = ""); 80 80 81 81 // The user agent. -
trunk/Source/WebCore/testing/Internals.cpp
r235014 r235050 2332 2332 auto* inspectedPage = contextDocument()->frame()->page(); 2333 2333 auto* window = inspectedPage->mainFrame().document()->domWindow(); 2334 auto frontendWindowProxy = window->open(*window, *window, url, "", "") ;2334 auto frontendWindowProxy = window->open(*window, *window, url, "", "").releaseReturnValue(); 2335 2335 m_inspectorFrontend = std::make_unique<InspectorStubFrontend>(*inspectedPage, downcast<DOMWindow>(frontendWindowProxy->window())); 2336 2336 return frontendWindowProxy;
Note: See TracChangeset
for help on using the changeset viewer.