Skip to content

Commit

Permalink
try/catch run block for cross-original exception
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Sep 10, 2014
1 parent 4fff1ed commit 7789031
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
20 changes: 12 additions & 8 deletions examples/client/vendor/satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,20 @@
.run(['$window', '$location', 'satellizer.utils', function($window, $location, utils) {
var params = $window.location.search.substring(1);
var qs = Object.keys($location.search()).length ? $location.search() : utils.parseQueryString(params);

if ($window.opener && $window.opener.location.origin === $window.location.origin) {
if (qs.oauth_token && qs.oauth_verifier) {
$window.opener.postMessage({ oauth_token: qs.oauth_token, oauth_verifier: qs.oauth_verifier }, $window.location.origin);
} else if (qs.code) {
$window.opener.postMessage({ code: qs.code }, $window.location.origin);
} else if (qs.error) {
$window.opener.postMessage({ error: qs.error }, $window.location.origin);
try {
if ($window.opener && $window.opener.location.origin === $window.location.origin) {
if (qs.oauth_token && qs.oauth_verifier) {
$window.opener.postMessage({ oauth_token: qs.oauth_token, oauth_verifier: qs.oauth_verifier }, $window.location.origin);
} else if (qs.code) {
$window.opener.postMessage({ code: qs.code }, $window.location.origin);
} else if (qs.error) {
$window.opener.postMessage({ error: qs.error }, $window.location.origin);
}
}
} catch(ex) {

}

}]);

})(window, window.angular);
20 changes: 12 additions & 8 deletions satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,20 @@
.run(['$window', '$location', 'satellizer.utils', function($window, $location, utils) {
var params = $window.location.search.substring(1);
var qs = Object.keys($location.search()).length ? $location.search() : utils.parseQueryString(params);

if ($window.opener && $window.opener.location.origin === $window.location.origin) {
if (qs.oauth_token && qs.oauth_verifier) {
$window.opener.postMessage({ oauth_token: qs.oauth_token, oauth_verifier: qs.oauth_verifier }, $window.location.origin);
} else if (qs.code) {
$window.opener.postMessage({ code: qs.code }, $window.location.origin);
} else if (qs.error) {
$window.opener.postMessage({ error: qs.error }, $window.location.origin);
try {
if ($window.opener && $window.opener.location.origin === $window.location.origin) {
if (qs.oauth_token && qs.oauth_verifier) {
$window.opener.postMessage({ oauth_token: qs.oauth_token, oauth_verifier: qs.oauth_verifier }, $window.location.origin);
} else if (qs.code) {
$window.opener.postMessage({ code: qs.code }, $window.location.origin);
} else if (qs.error) {
$window.opener.postMessage({ error: qs.error }, $window.location.origin);
}
}
} catch(ex) {

}

}]);

})(window, window.angular);
2 changes: 1 addition & 1 deletion satellizer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7789031

Please sign in to comment.