From d33012de8f87de1a606d732393af476a0f0cef18 Mon Sep 17 00:00:00 2001 From: Justin Mayfield Date: Thu, 30 Nov 2017 15:31:37 -0700 Subject: [PATCH] Use window.location instead of document.location when possible Fixes inclusion of the request.url value for service workers. --- src/raven.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/raven.js b/src/raven.js index d85f893e27c0..f714838df61f 100644 --- a/src/raven.js +++ b/src/raven.js @@ -1629,10 +1629,12 @@ Raven.prototype = { }; } + if (_window.location && _window.location.href) { + httpData.url = _window.location.href; + } else if (_document.location && _document.location.href) { + httpData.url = _document.location.href; + } if (this._hasDocument) { - if (_document.location && _document.location.href) { - httpData.url = _document.location.href; - } if (_document.referrer) { if (!httpData.headers) httpData.headers = {}; httpData.headers.Referer = _document.referrer;