Bug 842883 - (Part 4) Replace DOMWindowClose event with Tab:Close. r=mfinkle
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Sun, 24 Feb 2013 20:51:05 -0800
changeset 122880 fc79d441bec39084fcac12224ba73631f494a2cb
parent 122879 efdd184d9efd6ab0afce4c82056e67431fb2ca78
child 122881 42e55ecd4a704d2fccfa90315050f4bc38eb2255
push id1387
push userphilringnalda@gmail.com
push dateTue, 26 Feb 2013 22:32:56 +0000
treeherderfx-team@ad4cc4e97774 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs842883
milestone22.0a1
Bug 842883 - (Part 4) Replace DOMWindowClose event with Tab:Close. r=mfinkle
mobile/android/base/Tabs.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/Tabs.java
+++ b/mobile/android/base/Tabs.java
@@ -71,17 +71,16 @@ public class Tabs implements GeckoEventL
         registerEventListener("Content:LocationChange");
         registerEventListener("Content:SecurityChange");
         registerEventListener("Content:ReaderEnabled");
         registerEventListener("Content:StateChange");
         registerEventListener("Content:LoadError");
         registerEventListener("Content:PageShow");
         registerEventListener("DOMTitleChanged");
         registerEventListener("DOMLinkAdded");
-        registerEventListener("DOMWindowClose");
     }
 
     public void attachToActivity(GeckoApp activity) {
         mActivity = activity;
         mAccountManager = AccountManager.get(mActivity);
 
         // The listener will run on the background thread (see 2nd argument)
         mAccountManager.addOnAccountsUpdatedListener(mAccountListener = new OnAccountsUpdateListener() {
@@ -350,18 +349,16 @@ public class Tabs implements GeckoEventL
                 notifyListeners(tab, Tabs.TabEvents.LOAD_ERROR);
             } else if (event.equals("Content:PageShow")) {
                 notifyListeners(tab, TabEvents.PAGE_SHOW);
             } else if (event.equals("DOMTitleChanged")) {
                 tab.updateTitle(message.getString("title"));
             } else if (event.equals("DOMLinkAdded")) {
                 tab.updateFaviconURL(message.getString("href"), message.getInt("size"));
                 notifyListeners(tab, TabEvents.LINK_ADDED);
-            } else if (event.equals("DOMWindowClose")) {
-                closeTab(tab);
             }
         } catch (Exception e) { 
             Log.w(LOGTAG, "handleMessage threw for " + event, e);
         }
     }
 
     public void refreshThumbnails() {
         final ThumbnailHelper helper = ThumbnailHelper.getInstance();
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3505,17 +3505,17 @@ Tab.prototype = {
         if (!aEvent.isTrusted)
           return;
 
         // Find the relevant tab, and close it from Java
         if (this.browser.contentWindow == aEvent.target) {
           aEvent.preventDefault();
 
           sendMessageToJava({
-            type: "DOMWindowClose",
+            type: "Tab:Close",
             tabID: this.id
           });
         }
         break;
       }
 
       case "DOMWillOpenModalDialog": {
         if (!aEvent.isTrusted)