Skip to content

Commit

Permalink
Protect against X-O frame access that crashes some browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjansma committed Apr 4, 2016
1 parent 91996b3 commit 7ef308a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ Or via ``gulp``:

* v0.1.0 - 2015-12-10: Initial version
* v0.1.1 - 2016-04-04: `getCompressedUserTiming()` gathers Measures that end after the specified `from`
* v0.1.2 - 2016-04-04: Protect against X-O frame access that crashes some browsers

## Thanks

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "usertiming-compression",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/nicjansma/usertiming-compression.js",
"authors": [
"Nic Jansma <nic@nicj.net>"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "UserTiming compression and decompression",
"main": "./src/usertiming-compression",
"author": "Nic Jansma",
"version": "0.1.1",
"version": "0.1.2",
"repository": {
"type": "git",
"url": "http://github.com/nicjansma/usertiming-compression.js.git"
Expand Down
7 changes: 7 additions & 0 deletions src/usertiming-compression.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
}

try {
// Try to access location.href first to trigger any Cross-Origin
// warnings. There's also a bug in Chrome ~48 that might cause
// the browser to crash if accessing X-O frame.performance.
// https://code.google.com/p/chromium/issues/detail?id=585871
// This variable is not otherwise used.
var frameLoc = frame.location && frame.location.href;

if (!("performance" in frame) ||
!frame.performance ||
!frame.performance.getEntriesByType) {
Expand Down

0 comments on commit 7ef308a

Please sign in to comment.