Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix #10821. Allow page reloads, navigating away and back etc. #10822

Merged
merged 5 commits into from
May 31, 2015

Conversation

busykai
Copy link
Contributor

@busykai busykai commented Apr 3, 2015

Fixes multi-browser case only.

Fix #10821: wait for 5 seconds after the last browser has closed connection before shutting down entire LiveDevelopment session.

It's a very simple and robust fix to address page reloads inflicted by protocol.reload() or by user-driven page reloads (or navigating back and forth on the page links).

A more sophisticated fix would consist of the remote end (a browser) letting know that the page is being unloaded. However, the only case where it would actually help is when the page is reloaded by the protocol command. It still would be impossible to distinguish intentional navigating away from a reload or navigating away by clicking a link on the page being previewed.

CC: @redmunds, @sebaslv

Also, show the malformed message when such message comes in. Removed the TODO
comment wrt sending back the error message: it is unclear what should be done
if a malformed message comes in. It is unlikely it will ever happen and even
then the error message in the browser should be enough.
It is a simple and robust fix for to address the page reloads, either inflicted
by protocol commands or by user-driven page reloads.
@busykai
Copy link
Contributor Author

busykai commented Apr 3, 2015

Plus this PR has a couple of clean-ups.

@@ -272,7 +272,6 @@
},

onClose: function () {
// TODO: This is absolutely temporary solution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, I guess this not an "absolutely temporary solution" after all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@le717 :) it's been reworked from its original version, but the comment was left. what we have now seems to be satisfactory.

@le717
Copy link
Contributor

le717 commented Apr 3, 2015

Thanks for putting this up. Hopefully it can be merged soon. I've been hitting this case a lot recently.

_close(false, "detached_target_closed");
}
setTimeout(function () {
if (_protocol.getConnectionIds().length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we combine the two conditions to if (_protocol.getConnectionIds().length === 0 && exports.status <= STATUS_ACTIVE)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it intentionally (for some reason), but you're right, no need.

@busykai
Copy link
Contributor Author

busykai commented May 31, 2015

@marcelgerber, did you try it? it's ready to merged otherwise, it seems.

marcelgerber added a commit that referenced this pull request May 31, 2015
…-browser

Fix #10821. Allow page reloads, navigating away and back etc.
@marcelgerber marcelgerber merged commit 3a0780e into master May 31, 2015
@marcelgerber marcelgerber deleted the kai/fix-10821-ld-allow-reload-in-browser branch May 31, 2015 20:53
@marcelgerber
Copy link
Contributor

Merged this. Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LivePreview is closed if browser is reloaded by user
3 participants