| Index: chrome/ext/background.js | 
| diff --git a/chrome/ext/background.js b/chrome/ext/background.js | 
| index 7d751930c9cd9f3861debf503dfa25e43cc14db2..0405d0a739aafbfb47eb07115ffa65c086be4f80 100644 | 
| --- a/chrome/ext/background.js | 
| +++ b/chrome/ext/background.js | 
| @@ -57,24 +57,24 @@ | 
|  | 
| function afterTabLoaded(callback) | 
| { | 
| -     return openedTab => | 
| -     { | 
| -       let onUpdated = (tabId, changeInfo, tab) => | 
| -       { | 
| -         if (tabId == openedTab.id && changeInfo.status == "complete") | 
| -         { | 
| -           chrome.tabs.onUpdated.removeListener(onUpdated); | 
| -           callback(new Page(openedTab)); | 
| -         } | 
| -       }; | 
| -       chrome.tabs.onUpdated.addListener(onUpdated); | 
| -     }; | 
| +    return openedTab => | 
| +    { | 
| +      let onUpdated = (tabId, changeInfo, tab) => | 
| +      { | 
| +        if (tabId == openedTab.id && changeInfo.status == "complete") | 
| +        { | 
| +          chrome.tabs.onUpdated.removeListener(onUpdated); | 
| +          callback(new Page(openedTab)); | 
| +        } | 
| +      }; | 
| +      chrome.tabs.onUpdated.addListener(onUpdated); | 
| +    }; | 
| } | 
|  | 
| ext.pages = { | 
| open(url, callback) | 
| { | 
| -      chrome.tabs.create({url: url}, callback && afterTabLoaded(callback)); | 
| +      chrome.tabs.create({url}, callback && afterTabLoaded(callback)); | 
| }, | 
| query(info, callback) | 
| { | 
| @@ -131,7 +131,7 @@ | 
| { | 
| if (frameId == 0) | 
| { | 
| -      let page = new Page({id: tabId, url: url}); | 
| +      let page = new Page({id: tabId, url}); | 
|  | 
| if (eagerlyUpdatedPages.get(page) != url) | 
| { | 
| @@ -147,11 +147,13 @@ | 
| chrome.tabs.get(tabId, () => | 
| { | 
| // If the tab is prerendered, chrome.tabs.get() sets | 
| -          // chrome.runtime.lastError and we have to dispatch the onLoading event, | 
| -          // since the onUpdated event isn't dispatched for prerendered tabs. | 
| -          // However, we have to keep relying on the unUpdated event for tabs that | 
| -          // are already visible. Otherwise browser action changes get overridden | 
| -          // when Chrome automatically resets them on navigation. | 
| +          // chrome.runtime.lastError and we have to dispatch the | 
| +          // onLoading event, since the onUpdated event isn't | 
| +          // dispatched for prerendered tabs.  However, we have to | 
| +          // keep relying on the unUpdated event for tabs that are | 
| +          // already visible. Otherwise browser action changes get | 
| +          // overridden when Chrome automatically resets them on | 
| +          // navigation. | 
| if (chrome.runtime.lastError) | 
| ext.pages.onLoading._dispatch(page); | 
| }); | 
| @@ -234,7 +236,7 @@ | 
| }, | 
| _queueChanges() | 
| { | 
| -      chrome.tabs.get(this._tabId, function() | 
| +      chrome.tabs.get(this._tabId, () => | 
| { | 
| // If the tab is prerendered, chrome.tabs.get() sets | 
| // chrome.runtime.lastError and we have to delay our changes | 
| @@ -253,10 +255,8 @@ | 
| chrome.tabs.onReplaced.addListener(onReplaced); | 
| } | 
| else | 
| -        { | 
| this._applyChanges(); | 
| -        } | 
| -      }.bind(this)); | 
| +      }); | 
| }, | 
| _addChange(name, value) | 
| { | 
| @@ -275,9 +275,7 @@ | 
| setBadge(badge) | 
| { | 
| if (!badge) | 
| -      { | 
| this._addChange("badgeText", ""); | 
| -      } | 
| else | 
| { | 
| if ("number" in badge) | 
| @@ -378,7 +376,8 @@ | 
| return (framesOfTabs[tabId] || {})[frameId]; | 
| }; | 
|  | 
| -  let handlerBehaviorChangedQuota = chrome.webRequest.MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES; | 
| +  let handlerBehaviorChangedQuota = | 
| +    chrome.webRequest.MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES; | 
|  | 
| function propagateHandlerBehaviorChange() | 
| { | 
| @@ -387,7 +386,9 @@ | 
| // Otherwise Chrome notifies the user that this extension is causing issues. | 
| if (handlerBehaviorChangedQuota > 0) | 
| { | 
| -      chrome.webNavigation.onBeforeNavigate.removeListener(propagateHandlerBehaviorChange); | 
| +      chrome.webNavigation.onBeforeNavigate.removeListener( | 
| +        propagateHandlerBehaviorChange | 
| +      ); | 
| chrome.webRequest.handlerBehaviorChanged(); | 
|  | 
| handlerBehaviorChangedQuota--; | 
| @@ -403,7 +404,7 @@ | 
| // There wouldn't be any visible effect when calling it earlier, | 
| // but it's an expensive operation and that way we avoid to call | 
| // it multiple times, if multiple filters are added/removed. | 
| -      let onBeforeNavigate = chrome.webNavigation.onBeforeNavigate; | 
| +      let {onBeforeNavigate} = chrome.webNavigation; | 
| if (!onBeforeNavigate.hasListener(propagateHandlerBehaviorChange)) | 
| onBeforeNavigate.addListener(propagateHandlerBehaviorChange); | 
| } | 
| @@ -420,11 +421,16 @@ | 
| let frames = framesOfTabs[tab.id] = Object.create(null); | 
|  | 
| for (let i = 0; i < details.length; i++) | 
| -            frames[details[i].frameId] = {url: new URL(details[i].url), parent: null}; | 
| +          { | 
| +            frames[details[i].frameId] = { | 
| +              url: new URL(details[i].url), | 
| +              parent: null | 
| +            }; | 
| +          } | 
|  | 
| for (let i = 0; i < details.length; i++) | 
| { | 
| -            let parentFrameId = details[i].parentFrameId; | 
| +            let {parentFrameId} = details[i]; | 
|  | 
| if (parentFrameId != -1) | 
| frames[details[i].frameId].parent = frames[parentFrameId]; | 
| @@ -446,17 +452,11 @@ | 
| // has triggered this request. For most requests (e.g. images) we | 
| // can just use the request's frame ID, but for subdocument requests | 
| // (e.g. iframes) we must instead use the request's parent frame ID. | 
| -    let frameId; | 
| -    let requestType; | 
| -    if (details.type == "sub_frame") | 
| +    let {frameId, type} = details; | 
| +    if (type == "sub_frame") | 
| { | 
| frameId = details.parentFrameId; | 
| -      requestType = "SUBDOCUMENT"; | 
| -    } | 
| -    else | 
| -    { | 
| -      frameId = details.frameId; | 
| -      requestType = details.type.toUpperCase(); | 
| +      type = "SUBDOCUMENT"; | 
| } | 
|  | 
| let frame = ext.getFrame(details.tabId, frameId); | 
| @@ -464,7 +464,7 @@ | 
| { | 
| let results = ext.webRequest.onBeforeRequest._dispatch( | 
| new URL(details.url), | 
| -        requestType, | 
| +        type.toUpperCase(), | 
| new Page({id: details.tabId}), | 
| frame | 
| ); | 
| @@ -504,7 +504,9 @@ | 
| }; | 
| } | 
|  | 
| -    return ext.onMessage._dispatch(message, sender, sendResponse).indexOf(true) != -1; | 
| +    return ext.onMessage._dispatch( | 
| +      message, sender, sendResponse | 
| +    ).indexOf(true) != -1; | 
| }); | 
|  | 
|  | 
| @@ -535,9 +537,7 @@ | 
| ext.showOptions = callback => | 
| { | 
| if (!callback) | 
| -      { | 
| chrome.runtime.openOptionsPage(); | 
| -      } | 
| else | 
| { | 
| chrome.runtime.openOptionsPage(() => | 
| @@ -589,9 +589,7 @@ | 
| callback(new Page(tab)); | 
| } | 
| else | 
| -          { | 
| ext.pages.open(optionsUrl, callback); | 
| -          } | 
| }); | 
| }); | 
| }; | 
|  |