forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1602090 part 2. Create separate CheckMayLoad and CheckMayLoadWith…
…Reporting APIs. r=ckerschb CheckMayLoadAndReport takes a window ID. This allows us to report errors from it to the web console as needed. Most consumers know statically whether they want reporting or not, so there's no reason to force the ones that don't to provide window ids. Differential Revision: https://phabricator.services.mozilla.com/D56388 --HG-- extra : moz-landing-system : lando
- Loading branch information
Showing
19 changed files
with
165 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
devtools/client/webconsole/test/browser/browser_webconsole_same_origin_errors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
// Ensure that same-origin errors are logged to the console. | ||
|
||
"use strict"; | ||
|
||
const TEST_URI = | ||
"http://example.com/browser/devtools/client/webconsole/test/browser/test-same-origin-required-load.html"; | ||
|
||
add_task(async function() { | ||
const hud = await openNewTabAndConsole(TEST_URI); | ||
|
||
const targetURL = "http://example.org"; | ||
const onErrorMessage = waitForMessage(hud, "may not load data"); | ||
SpecialPowers.spawn(gBrowser.selectedBrowser, [targetURL], url => { | ||
XPCNativeWrapper.unwrap(content).testTrack(url); | ||
}); | ||
const message = await onErrorMessage; | ||
const node = message.node; | ||
ok( | ||
node.classList.contains("error"), | ||
"The message has the expected classname" | ||
); | ||
ok( | ||
node.textContent.includes(targetURL), | ||
"The message is about the thing we were expecting" | ||
); | ||
}); |
26 changes: 26 additions & 0 deletions
26
devtools/client/webconsole/test/browser/test-same-origin-required-load.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Test loads that are required to be same-origin (no CORS involved)</title> | ||
<script> | ||
/* exported testTrack */ | ||
"use strict"; | ||
|
||
function testTrack(url) { | ||
const body = document.body; | ||
const video = document.createElement("video"); | ||
const track = document.createElement("track"); | ||
track.src = url; | ||
track.default = true; | ||
video.append(track); | ||
body.append(video); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.