Skip to content

Instantly share code, notes, and snippets.

@allstarschh
Last active June 2, 2016 04:05
Show Gist options
  • Save allstarschh/b90dec8cb9af30b3ddb47e8861f335a0 to your computer and use it in GitHub Desktop.
Save allstarschh/b90dec8cb9af30b3ddb47e8861f335a0 to your computer and use it in GitHub Desktop.
mike's comment for userContextId
diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm
index b42440d..5ae8cce 100644
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -2919,21 +2919,19 @@ var SessionStoreInternal = {
let numVisibleTabs = 0;
for (var t = 0; t < newTabCount; t++) {
// When trying to restore into existing tab, we check if the userContextId
// is matched, otherwise we create a new tab for restoring.
let reuse = false;
if (t < openTabCount) {
- // If the tab (winData.tabs[t]) doesn't have userContextId, the value
- // will be undefined, but getAttribute("usercontextid") will be "", so
- // we use `|| ""` to let it has a default value "".
- let userContextId = winData.tabs[t].userContextId || "";
- reuse = tabbrowser.tabs[t].getAttribute("usercontextid") == userContextId;
+ let userContextId = winData.tabs[t].userContextId;
+ reuse = !userContextId ||
+ tabbrowser.tabs[t].getAttribute("usercontextid") == userContextId;
}
let tab;
if (reuse) {
tab = tabbrowser.tabs[t];
} else {
// There will be 2 cases when we try to create a new tab:
// 1. When we have more tabs then existing tabs. i.e. t > openTabCount.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment