[Pkg-mozext-commits] [tabmixplus] 12/30: State.scroll.scroll can be undefined, calling setLiteral with undefined value break Tabmix and prevent the window from closing
David Prévot
taffit at moszumanska.debian.org
Sun Jun 14 22:15:37 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit a7d6adbf4c0d961908e9a82b88d82af320576be5
Author: onemen <tabmix.onemen at gmail.com>
Date: Fri Jun 5 18:50:14 2015 +0300
State.scroll.scroll can be undefined, calling setLiteral with undefined value break Tabmix and prevent the window from closing
---
chrome/content/session/session.js | 6 +++++-
chrome/content/session/sessionStore.js | 13 +++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index ca788cd..21db479 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -1020,6 +1020,10 @@ if (container == "error") { Tabmix.log("wrapContainer error path " + path + "\n"
},
setLiteral: function SM_setLiteral(node, arc, value) {
+ if (typeof value == "undefined") {
+ this.removeAttribute(node, arc);
+ return;
+ }
if (typeof(node) == "string") node = this.RDFService.GetResource(node);
arc = this.getNC(arc);
value = this.RDFService.GetLiteral(value);
@@ -2923,7 +2927,7 @@ try{
var history = [];
var saveScroll = this.prefBranch.getBoolPref("save.scrollposition");
- var currentScroll = saveScroll && state.scroll ? state.scroll.scroll : "0,0";
+ var currentScroll = saveScroll && state.scroll ? JSON.stringify(state.scroll) : "0,0";
if (currentScroll != "0,0")
entries[index].scroll = currentScroll;
diff --git a/chrome/content/session/sessionStore.js b/chrome/content/session/sessionStore.js
index b6d660b..385a562 100644
--- a/chrome/content/session/sessionStore.js
+++ b/chrome/content/session/sessionStore.js
@@ -812,11 +812,16 @@ var TabmixConvertSession = { // jshint ignore:line
tabData.image = TabmixSessionManager.getLiteralValue(rdfNodeTab, "image", null);
let index = TabmixSessionManager.getIntValue(rdfNodeTab, "index");
tabData.index = Math.max(1, Math.min(index + 1, tabData.entries.length));
- let scroll = TabmixSessionManager.getLiteralValue(rdfNodeTab, "scroll", "0,0");
+ var scroll = TabmixSessionManager.getLiteralValue(rdfNodeTab, "scroll", "0,0");
+ if (scroll.indexOf("{") === 0) {
+ tabData.scroll = JSON.parse(scroll);
+ }
+ else {
// until version 0.4.1.5 textZoom was included in scroll data
- scroll = scroll.split(",").splice(0, 2).join(",");
- if (scroll != "0,0") {
- tabData.scroll = {scroll: scroll};
+ scroll = scroll.split(",").splice(0, 2).join(",");
+ if (scroll != "0,0") {
+ tabData.scroll = {scroll: scroll};
+ }
}
var properties = TabmixSessionManager.getLiteralValue(rdfNodeTab, "properties");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list