mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 650676 - browser_autocompletesearch.js throws getting ProfD, then times out, on Android [r=vingtetun]
This commit is contained in:
parent
9bebd0df6f
commit
6e28b1dcf1
@ -48,10 +48,29 @@ function saveMockCache() {
|
||||
info("mock path: " + mockCachePath);
|
||||
let mockCacheURI = getResolvedURI(mockCachePath);
|
||||
info("mock URI: " + mockCacheURI.spec);
|
||||
let mockCacheFile = getChromeDir(mockCacheURI);
|
||||
info("mock file: " + mockCacheFile.path);
|
||||
mockCacheFile.append("mock_autocomplete.json");
|
||||
mockCacheFile.copyToFollowingLinks(gProfileDir, "autocomplete.json");
|
||||
if (mockCacheURI instanceof Ci.nsIJARURI) {
|
||||
// Android tests are stored in a JAR file, so we need to extract the mock_autocomplete.json file
|
||||
info("jar file: " + mockCacheURI.JARFile.spec);
|
||||
let zReader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(Ci.nsIZipReader);
|
||||
let fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].getService(Ci.nsIFileProtocolHandler);
|
||||
let fileName = fileHandler.getFileFromURLSpec(mockCacheURI.JARFile.spec);
|
||||
zReader.open(fileName);
|
||||
|
||||
let extract = mockCacheURI.JARFile.spec.split("!")[1];
|
||||
extract = extract.substring(1, extract.lastIndexOf("/") + 1);
|
||||
extract += "mock_autocomplete.json";
|
||||
info("extract path: " + extract);
|
||||
let target = gProfileDir.clone();
|
||||
target.append("autocomplete.json");
|
||||
info("target path: " + target.path);
|
||||
zReader.extract(extract, target);
|
||||
} else {
|
||||
// Tests are run from a folder, so we can just copy the mock_autocomplete.json file
|
||||
let mockCacheFile = getChromeDir(mockCacheURI);
|
||||
info("mock file: " + mockCacheFile.path);
|
||||
mockCacheFile.append("mock_autocomplete.json");
|
||||
mockCacheFile.copyToFollowingLinks(gProfileDir, "autocomplete.json");
|
||||
}
|
||||
|
||||
// Listen for when the mock cache has been loaded
|
||||
Services.obs.addObserver(function (aSubject, aTopic, aData) {
|
||||
|
Loading…
Reference in New Issue
Block a user