Skip to content

Commit

Permalink
Merge pull request #2047 from rstudio/joe/bugfix/post-message
Browse files Browse the repository at this point in the history
Fix #2033: Rstudio Viewer window not closed on shiny::stopApp()
  • Loading branch information
alandipert authored Sep 14, 2018
2 parents d606463 + 51fbb5c commit 420ba95
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 49 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ shiny 1.1.0.9001

* Fixed [#2093](https://github.com/rstudio/shiny/issues/2093): Make sure bookmark scope directory does not exist before trying to create it. [#2168](https://github.com/rstudio/shiny/pull/2168)

### Bug fixes

* Fixed [#2033](https://github.com/rstudio/shiny/issues/2033): RStudio Viewer window not closed on `shiny::stopApp()`. Thanks, @vnijs! [#2047](https://github.com/rstudio/shiny/pull/2047)

### Documentation Updates

* Addressed [#1864](https://github.com/rstudio/shiny/issues/1864) by changing `optgroup` documentation to use `list` instead of `c`. ([#2084](https://github.com/rstudio/shiny/pull/2084))
Expand Down
22 changes: 2 additions & 20 deletions inst/www/shared/shiny.js

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

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

26 changes: 2 additions & 24 deletions srcjs/shinyapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,30 +141,8 @@ var ShinyApp = function() {
};

this.$notifyDisconnected = function() {

// function to normalize hostnames
var normalize = function(hostname) {
if (hostname === "127.0.0.1")
return "localhost";
else
return hostname;
};

// Send a 'disconnected' message to parent if we are on the same domin
var parentUrl = (parent !== window) ? document.referrer : null;
if (parentUrl) {
// parse the parent href
var a = document.createElement('a');
a.href = parentUrl;

// post the disconnected message if the hostnames are the same
if (normalize(a.hostname) === normalize(window.location.hostname)) {
var protocol = a.protocol.replace(':',''); // browser compatability
var origin = protocol + '://' + a.hostname;
if (a.port)
origin = origin + ':' + a.port;
parent.postMessage('disconnected', origin);
}
if (window.parent) {
window.parent.postMessage("disconnected", "*");
}
};

Expand Down

0 comments on commit 420ba95

Please sign in to comment.