This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11784 from snyderp/11683-block-iframe-content-win…
…dow-and-loops block access to child frames' contentWindow, contentDocument, place guard in blocking proxy to prevent an infinite loop
- Loading branch information
Showing
3 changed files
with
268 additions
and
46 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
34 changes: 34 additions & 0 deletions
34
test/fixtures/fingerprinting-blocking-from-child-frames.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,34 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<div id="target"> | ||
proxy blocking being tested | ||
</div> | ||
<script> | ||
(function () { | ||
|
||
const targetElm = document.getElementById("target") | ||
const iframe = document.createElement("iframe") | ||
iframe.src = "https://example.com/" | ||
document.body.appendChild(iframe) | ||
|
||
// Accessing the `toDataUrl` property on the iframe-content-wrapping | ||
// proxy should trigger a finger printing notification. | ||
let iframeToDataUrl = iframe.contentWindow.HTMLCanvasElement.prototype.toDataURL | ||
|
||
// If this is the proxied version of the toDataURL method, then | ||
// we can look up any properties on it w/o throwing an exception. | ||
// The below throwing means the proxy isn't injected correctly, | ||
// and so the test should fail. | ||
|
||
try { | ||
iframeToDataUrl.nonexistant().properties['and'].methods() | ||
targetElm.innerText = "proxy blocking works" | ||
} catch (e) { | ||
targetElm.innerText = "proxy blocking fail" | ||
} | ||
}()) | ||
</script> | ||
</body> | ||
</html> |