Attempt to migrate the old showPreviousViewOnLoad
/disablePageMode
preferences to the new viewOnLoad
preference
This patch ignores the recently added `disableOpenActionDestination` preference, since the latest PDF.js version found on the "Chrome Web Store" doesn't include it.
This commit is contained in:
parent
6806248030
commit
4d4c98d1eb
@ -81,6 +81,9 @@ limitations under the License.
|
|||||||
'disableTextLayer',
|
'disableTextLayer',
|
||||||
'enhanceTextSelection',
|
'enhanceTextSelection',
|
||||||
'textLayerMode',
|
'textLayerMode',
|
||||||
|
'showPreviousViewOnLoad',
|
||||||
|
'disablePageMode',
|
||||||
|
'viewOnLoad',
|
||||||
], function(items) {
|
], function(items) {
|
||||||
// Migration code for https://github.com/mozilla/pdf.js/pull/7635.
|
// Migration code for https://github.com/mozilla/pdf.js/pull/7635.
|
||||||
if (typeof items.enableHandToolOnLoad === 'boolean') {
|
if (typeof items.enableHandToolOnLoad === 'boolean') {
|
||||||
@ -113,6 +116,20 @@ limitations under the License.
|
|||||||
storageSync.remove(['disableTextLayer', 'enhanceTextSelection']);
|
storageSync.remove(['disableTextLayer', 'enhanceTextSelection']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Migration code for https://github.com/mozilla/pdf.js/pull/10502.
|
||||||
|
if (typeof items.showPreviousViewOnLoad === 'boolean') {
|
||||||
|
if (!items.showPreviousViewOnLoad) {
|
||||||
|
storageSync.set({
|
||||||
|
viewOnLoad: 1,
|
||||||
|
}, function() {
|
||||||
|
if (!chrome.runtime.lastError) {
|
||||||
|
storageSync.remove(['showPreviousViewOnLoad', 'disablePageMode']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
storageSync.remove(['showPreviousViewOnLoad', 'disablePageMode']);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -341,6 +341,8 @@ class ChromePreferences extends BasePreferences {
|
|||||||
enableHandToolOnLoad: false,
|
enableHandToolOnLoad: false,
|
||||||
disableTextLayer: false,
|
disableTextLayer: false,
|
||||||
enhanceTextSelection: false,
|
enhanceTextSelection: false,
|
||||||
|
showPreviousViewOnLoad: true,
|
||||||
|
disablePageMode: false,
|
||||||
}, this.defaults);
|
}, this.defaults);
|
||||||
|
|
||||||
chrome.storage.managed.get(defaultManagedPrefs, function(items) {
|
chrome.storage.managed.get(defaultManagedPrefs, function(items) {
|
||||||
@ -370,6 +372,13 @@ class ChromePreferences extends BasePreferences {
|
|||||||
delete items.disableTextLayer;
|
delete items.disableTextLayer;
|
||||||
delete items.enhanceTextSelection;
|
delete items.enhanceTextSelection;
|
||||||
|
|
||||||
|
// Migration code for https://github.com/mozilla/pdf.js/pull/10502.
|
||||||
|
if (!items.showPreviousViewOnLoad && !items.viewOnLoad) {
|
||||||
|
items.viewOnLoad = 1;
|
||||||
|
}
|
||||||
|
delete items.showPreviousViewOnLoad;
|
||||||
|
delete items.disablePageMode;
|
||||||
|
|
||||||
getPreferences(items);
|
getPreferences(items);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user