diff --git a/browser/components/sessionstore/content/content-sessionStore.js b/browser/components/sessionstore/content/content-sessionStore.js index 71a392c1c47d..d33c7b75e15f 100644 --- a/browser/components/sessionstore/content/content-sessionStore.js +++ b/browser/components/sessionstore/content/content-sessionStore.js @@ -60,7 +60,7 @@ function createLazy(fn) { */ function isSessionStorageEvent(event) { try { - return event.storageArea == content.sessionStorage; + return event.storageArea == event.target.sessionStorage; } catch (ex if ex instanceof Ci.nsIException && ex.result == Cr.NS_ERROR_NOT_AVAILABLE) { // This page does not have a DOMSessionStorage // (this is typically the case for about: pages) diff --git a/browser/components/sessionstore/test/browser_sessionStorage.js b/browser/components/sessionstore/test/browser_sessionStorage.js index 289bb15941d6..4afd9e0551b7 100644 --- a/browser/components/sessionstore/test/browser_sessionStorage.js +++ b/browser/components/sessionstore/test/browser_sessionStorage.js @@ -29,7 +29,17 @@ add_task(function session_storage() { is(storage["http://mochi.test:8888"].test, OUTER_VALUE, "sessionStorage data for mochi.test has been serialized correctly"); - // Ensure that modifying sessionStore values works. + // Ensure that modifying sessionStore values works for the inner frame only. + yield modifySessionStorage2(browser, {test: "modified1"}); + TabState.flush(browser); + + ({storage} = JSON.parse(ss.getTabState(tab))); + is(storage["http://example.com"].test, "modified1", + "sessionStorage data for example.com has been serialized correctly"); + is(storage["http://mochi.test:8888"].test, OUTER_VALUE, + "sessionStorage data for mochi.test has been serialized correctly"); + + // Ensure that modifying sessionStore values works for both frames. yield modifySessionStorage(browser, {test: "modified"}); yield modifySessionStorage2(browser, {test: "modified2"}); TabState.flush(browser);