mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 14:30:43 +00:00
Bug 857201 - Restoring PageThumbsStorage.getFileForURL, with deprecation warning;r=ttaubert
This commit is contained in:
parent
e6fcd196f1
commit
8842213969
@ -60,6 +60,8 @@ XPCOMUtils.defineLazyGetter(this, "gUnicodeConverter", function () {
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
|
||||
"resource://gre/modules/Deprecated.jsm");
|
||||
|
||||
/**
|
||||
* Utilities for dealing with promises and Task.jsm
|
||||
@ -521,6 +523,14 @@ this.PageThumbsStorage = {
|
||||
for (let i = 0; i < aData.length; i++)
|
||||
hex += ("0" + aData.charCodeAt(i).toString(16)).slice(-2);
|
||||
return hex;
|
||||
},
|
||||
|
||||
// Deprecated, please do not use
|
||||
getFileForURL: function Storage_getFileForURL_DEPRECATED(aURL) {
|
||||
Deprecated.warning("PageThumbs.getFileForURL is deprecated. Please use PageThumbs.getFilePathForURL and OS.File",
|
||||
"https://developer.mozilla.org/docs/JavaScript_OS.File");
|
||||
// Note: Once this method has been removed, we can get rid of the dependency towards FileUtils
|
||||
return new FileUtils.File(PageThumbsStorage.getFilePathForURL(aURL));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -69,6 +69,15 @@ function runTests() {
|
||||
// Check that our existing thumbnail wasn't overwritten.
|
||||
is(getFileContents(file), "no-overwrite-plz",
|
||||
"existing thumbnail was not overwritten");
|
||||
|
||||
// Sanity check: ensure that, until it is removed, deprecated
|
||||
// function |getFileForURL| points to the same path as
|
||||
// |getFilePathForURL|.
|
||||
if ("getFileForURL" in PageThumbsStorage) {
|
||||
let file = PageThumbsStorage.getFileForURL(URL);
|
||||
is(file.path, PageThumbsStorage.getFilePathForURL(URL),
|
||||
"Deprecated getFileForURL and getFilePathForURL return the same path");
|
||||
}
|
||||
}
|
||||
|
||||
function changeLocation(aLocation, aNewDir) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user