зеркало из https://github.com/mozilla/gecko-dev.git
Bug 888336 - chat title not displayed after tearing off and reattaching a chat window, r=mixedpuppy.
This commit is contained in:
Родитель
ae3ec48da0
Коммит
58c940ef27
|
@ -146,8 +146,10 @@
|
|||
aTarget.content.setAttribute("origin", this.content.getAttribute("origin"));
|
||||
aTarget.content.popupnotificationanchor.className = this.content.popupnotificationanchor.className;
|
||||
this.content.socialErrorListener.remove();
|
||||
aTarget.content.socialErrorListener.remove();
|
||||
this.content.swapDocShells(aTarget.content);
|
||||
Social.setErrorListener(this.content, function(aBrowser) {
|
||||
Social.setErrorListener(this.content, function(aBrowser) {}); // 'this' will be destroyed soon.
|
||||
Social.setErrorListener(aTarget.content, function(aBrowser) {
|
||||
aBrowser.webNavigation.loadURI("about:socialerror?mode=compactInfo", null, null, null, null);
|
||||
});
|
||||
]]></body>
|
||||
|
@ -190,7 +192,7 @@
|
|||
let win = findChromeWindowForChats();
|
||||
let chatbar = win.SocialChatBar.chatbar;
|
||||
chatbar.openChat(provider, "about:blank", win => {
|
||||
chatbar.selectedChat.swapDocShells(this);
|
||||
this.swapDocShells(chatbar.selectedChat);
|
||||
chatbar.focus();
|
||||
this.close();
|
||||
});
|
||||
|
|
|
@ -29,6 +29,7 @@ function test() {
|
|||
var tests = {
|
||||
testTearoffChat: function(next) {
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
let chatTitle;
|
||||
let port = Social.provider.getWorkerPort();
|
||||
ok(port, "provider has a port");
|
||||
port.onmessage = function (e) {
|
||||
|
@ -41,6 +42,14 @@ var tests = {
|
|||
// chatbox is open, lets detach. The new chat window will be caught in
|
||||
// the window watcher below
|
||||
let doc = chats.selectedChat.contentDocument;
|
||||
// This message is (sometimes!) received a second time
|
||||
// before we start our tests from the onCloseWindow
|
||||
// callback.
|
||||
if (doc.location == "about:blank")
|
||||
return;
|
||||
chatTitle = doc.title;
|
||||
ok(chats.selectedChat.getAttribute("label") == chatTitle,
|
||||
"the new chatbox should show the title of the chat window");
|
||||
let div = doc.createElement("div");
|
||||
div.setAttribute("id", "testdiv");
|
||||
div.setAttribute("test", "1");
|
||||
|
@ -78,6 +87,8 @@ var tests = {
|
|||
chatbox.contentDocument &&
|
||||
chatbox.contentDocument.readyState == "complete";
|
||||
},function() {
|
||||
ok(chatbox.getAttribute("label") == chatTitle,
|
||||
"detached window should show the title of the chat window");
|
||||
let testdiv = chatbox.contentDocument.getElementById("testdiv");
|
||||
is(testdiv.getAttribute("test"), "1", "docshell should have been swapped");
|
||||
testdiv.setAttribute("test", "2");
|
||||
|
@ -94,6 +105,8 @@ var tests = {
|
|||
chats.selectedChat.contentDocument.readyState == "complete";
|
||||
},function () {
|
||||
ok(chats.selectedChat, "should have a chatbox in our window again");
|
||||
ok(chats.selectedChat.getAttribute("label") == chatTitle,
|
||||
"the new chatbox should show the title of the chat window again");
|
||||
let testdiv = chats.selectedChat.contentDocument.getElementById("testdiv");
|
||||
is(testdiv.getAttribute("test"), "2", "docshell should have been swapped");
|
||||
chats.selectedChat.close();
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
window.close();
|
||||
}, false);
|
||||
</script>
|
||||
<title>test chat window</title>
|
||||
</head>
|
||||
<body onload="pingWorker();">
|
||||
<p>This is a test social chat window.</p>
|
||||
|
|
Загрузка…
Ссылка в новой задаче