tenfourfox/browser/base/content/test/social/social_sidebar.html
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

48 lines
1.7 KiB
HTML

<html>
<head>
<meta charset="utf-8">
<script>
var testwindow;
function pingWorker() {
var port = navigator.mozSocial.getWorker().port;
port.onmessage = function(e) {
var topic = e.data.topic;
switch (topic) {
case "test-flyout-open":
navigator.mozSocial.openPanel("social_flyout.html");
break;
case "test-flyout-close":
navigator.mozSocial.closePanel();
break;
case "test-chatbox-open":
var url = "social_chat.html";
var data = e.data.data;
if (data && data.id) {
url = url + "?id="+data.id;
}
navigator.mozSocial.openChatWindow(url, function(chatwin) {
// Note that the following .focus() call should *not* arrange
// to steal focus - see browser_social_chatwindowfocus.js
if (data && data.stealFocus && chatwin) {
chatwin.focus();
}
port.postMessage({topic: "chatbox-opened",
result: chatwin ? "ok" : "failed"});
});
break;
case "test-isVisible":
port.postMessage({topic: "test-isVisible-response",
result: navigator.mozSocial.isVisible});
break;
}
}
port.postMessage({topic: "sidebar-message", result: "ok"});
}
</script>
</head>
<body onload="pingWorker();">
<p>This is a test social sidebar.</p>
<button id="chat-opener" onclick="navigator.mozSocial.openChatWindow('./social_chat.html');"/>
</body>
</html>