Chromium Code Reviews| Index: LayoutTests/navigatorcontentutils/register-protocol-handler.html |
| diff --git a/LayoutTests/navigatorcontentutils/register-protocol-handler.html b/LayoutTests/navigatorcontentutils/register-protocol-handler.html |
| index 5501432fa49436f100272390e8ab95ad2cd87286..cd2b66516ec33233a84f0450aae99dd24b068576 100644 |
| --- a/LayoutTests/navigatorcontentutils/register-protocol-handler.html |
| +++ b/LayoutTests/navigatorcontentutils/register-protocol-handler.html |
| @@ -6,8 +6,10 @@ |
| <p>This test makes sure that navigator.registerProtocolHandler throws the proper exceptions and has no-op default implementation.</p> |
| <pre id="console"></pre> |
| <script> |
| -if (window.testRunner) |
| +if (window.testRunner) { |
| + testRunner.setAllowUniversalAccessFromFileURLs(false); |
|
abarth-chromium
2014/08/06 18:34:55
This is impossible. Instead, you need to put this
pals
2014/08/06 18:46:47
I shall move it to http/tests.
pals
2014/08/07 14:06:06
Done.
|
| testRunner.dumpAsText(); |
| +} |
| if (window.internals) |
| internals.setNavigatorContentUtilsClientMock(document); |
| @@ -82,6 +84,21 @@ invalid_urls.forEach(function (url) { |
| debug('FAIL Invalid url "' + url + '" allowed.'); |
| }); |
| +// Test that the API throws SecurityError exception if the URL's origin differs from the document's origin. |
| +succeeded = false; |
| +var errorMessage; |
| +try { |
| + window.navigator.registerProtocolHandler('web+myprotocol', "http://www.example.com/soup?url=%s", "title"); |
| +} catch (e) { |
| + succeeded = true; |
| + errorMessage = e.message; |
| +} |
| + |
| +if (succeeded) |
| + debug('PASS URL with origin different than document origin threw SecurityError exception: "' + errorMessage + '".'); |
| +else |
| + debug('FAIL URL with origin different than document origin is allowed.'); |
| + |
| // Test that the API has default no-op implementation. |
| var succeeded = true; |
| try { |