IE, Chrome, Firefox plugins: gracefully disconnect when server connection drops.
1) Plugins fails gracefully in the face of a disconnect, returning undefined instead of making lots of noise.
2) Plugins invokes hosted.html's __gwt_disconnected() method the first time the session is detected as dropped. This glasspanels the app.
Review by: jat
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7129 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/plugins/xpcom/FFSessionHandler.cpp b/plugins/xpcom/FFSessionHandler.cpp
index a2b5cc4..b7ad7ff 100755
--- a/plugins/xpcom/FFSessionHandler.cpp
+++ b/plugins/xpcom/FFSessionHandler.cpp
@@ -128,6 +128,26 @@
}
}
+void FFSessionHandler::disconnectDetectedImpl() {
+ JSContext* ctx = getJSContext();
+ if (!ctx) {
+ return;
+ }
+
+ Debug::log(Debug::Debugging) << "Getting function \"__gwt_disconnected\""
+ << Debug::flush;
+
+ jsval funcVal;
+ if (!JS_GetProperty(ctx, global, "__gwt_disconnected", &funcVal)
+ || funcVal == JSVAL_VOID) {
+ Debug::log(Debug::Error) << "Could not get function \"__gwt_disconnected\""
+ << Debug::flush;
+ return;
+ }
+ jsval rval;
+ JS_CallFunctionValue(ctx, global, funcVal, 0, 0, &rval);
+}
+
void FFSessionHandler::freeValue(HostChannel& channel, int idCount, const int* ids) {
Debug::DebugStream& dbg = Debug::log(Debug::Spam)
<< "FFSessionHandler::freeValue [ ";