Bug 474043 - Part 1 - Get rid of the remaining mimeTypes.rdf references. r=Paolo

MozReview-Commit-ID: 78LHYTVlEtR

--HG--
extra : rebase_source : b16b0c5d202419bd39a287d2868f09fbf6ad45e7
This commit is contained in:
Marco Bonardo 2018-03-12 22:24:07 +01:00
parent e890cbae46
commit afe040fd02
15 changed files with 12 additions and 1865 deletions

View File

@ -457,8 +457,6 @@
@RESPATH@/components/nsContentDispatchChooser.js
@RESPATH@/components/nsHandlerService-json.manifest
@RESPATH@/components/nsHandlerService-json.js
@RESPATH@/components/nsHandlerService.manifest
@RESPATH@/components/nsHandlerService.js
@RESPATH@/components/nsWebHandlerApp.manifest
@RESPATH@/components/nsWebHandlerApp.js
@RESPATH@/components/satchel.manifest

View File

@ -330,8 +330,6 @@
@BINPATH@/components/ContentPrefService2.js
@BINPATH@/components/nsHandlerService-json.manifest
@BINPATH@/components/nsHandlerService-json.js
@BINPATH@/components/nsHandlerService.manifest
@BINPATH@/components/nsHandlerService.js
@BINPATH@/components/nsWebHandlerApp.manifest
@BINPATH@/components/nsWebHandlerApp.js
@BINPATH@/components/satchel.manifest

View File

@ -395,12 +395,6 @@
"minbytes": 8192,
"maxbytes": 8192
},
"{profile}\\mimetypes.rdf": {
"mincount": 2,
"maxcount": 2,
"minbytes": 8192,
"maxbytes": 8192
},
"{profile}\\permissions.sqlite": {
"mincount": 14,
"maxcount": 14,
@ -521,4 +515,4 @@
"minbytes": 0,
"maxbytes": 16384
}
}
}

View File

@ -856,8 +856,8 @@ nsUnknownContentTypeDialog.prototype = {
// One last special case: If the input "always ask" flag was false, then we always
// update. In that case we are displaying the helper app dialog for the first
// time for this mime type and we need to store the user's action in the mimeTypes.rdf
// data source (whether that action has changed or not; if it didn't change, then we need
// time for this mime type and we need to store the user's action in the handler service
// (whether that action has changed or not; if it didn't change, then we need
// to store the "always ask" flag so the helper app dialog will or won't display
// next time, per the user's selection).
needUpdate = needUpdate || !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling;
@ -868,8 +868,8 @@ nsUnknownContentTypeDialog.prototype = {
return needUpdate && !discardUpdate;
},
// See if the user changed things, and if so, update the
// mimeTypes.rdf entry for this mime type.
// See if the user changed things, and if so, store this mime type in the
// handler service.
updateHelperAppPref: function() {
var handlerInfo = this.mLauncher.MIMEInfo;
var hs = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);

View File

@ -108,8 +108,6 @@ if CONFIG['MOZ_ENABLE_DBUS']:
EXTRA_COMPONENTS += [
'nsHandlerService-json.js',
'nsHandlerService-json.manifest',
'nsHandlerService.js',
'nsHandlerService.manifest',
'nsWebHandlerApp.js',
'nsWebHandlerApp.manifest',
]

View File

@ -14,9 +14,6 @@ ChromeUtils.defineModuleGetter(this, "JSONFile",
XPCOMUtils.defineLazyServiceGetter(this, "gExternalProtocolService",
"@mozilla.org/uriloader/external-protocol-service;1",
"nsIExternalProtocolService");
XPCOMUtils.defineLazyServiceGetter(this, "gHandlerServiceRDF",
"@mozilla.org/uriloader/handler-service-rdf;1",
"nsIHandlerService");
XPCOMUtils.defineLazyServiceGetter(this, "gMIMEService",
"@mozilla.org/mime;1",
"nsIMIMEService");
@ -56,10 +53,7 @@ HandlerService.prototype = {
this.__storeInitialized = true;
this.__store.ensureDataReady();
// We have to inject new default protocol handlers only if we haven't
// already done this when migrating data from the RDF back-end.
let alreadyInjected = this._migrateFromRDFIfNeeded();
this._injectDefaultProtocolHandlersIfNeeded(alreadyInjected);
this._injectDefaultProtocolHandlersIfNeeded();
Services.obs.notifyObservers(null, "handlersvc-store-initialized");
}
@ -73,65 +67,11 @@ HandlerService.prototype = {
};
},
/**
* Migrates data from the RDF back-end, returning true if this happened.
*/
_migrateFromRDFIfNeeded() {
try {
if (Services.prefs.getBoolPref("gecko.handlerService.migrated")) {
return false;
}
} catch (ex) {
// If the preference does not exist, we need to import.
}
try {
// Don't initialize the RDF back-end if the file does not exist, improving
// performance on first use for new profiles.
let rdfFile = FileUtils.getFile("ProfD", ["mimeTypes.rdf"]);
if (rdfFile.exists()) {
this._migrateFromRDF();
return true;
}
} catch (ex) {
Cu.reportError(ex);
} finally {
// Don't attempt to import again even if the operation failed.
Services.prefs.setBoolPref("gecko.handlerService.migrated", true);
}
return false;
},
_migrateFromRDF() {
// Initializing the RDF back-end has the side effect of triggering the
// injection of the default protocol handlers. If the version number is
// newer and this happens, then the "enumerate" call in the RDF back-end
// will re-enter the JSON back-end through the MIME service, but this is
// harmless. The injection will not be repeated in the JSON back-end, so we
// rely on the new handlers injected by the RDF back-end.
let handlerInfoEnumerator = gHandlerServiceRDF.enumerate();
while (handlerInfoEnumerator.hasMoreElements()) {
let handlerInfo = handlerInfoEnumerator.getNext()
.QueryInterface(Ci.nsIHandlerInfo);
try {
// If the import from RDF is repeated by flipping the preference, then
// handlerInfo might already include some data from the JSON back-end,
// but any duplication is removed by the "store" method.
gHandlerServiceRDF.fillHandlerInfo(handlerInfo, "");
this.store(handlerInfo);
} catch (ex) {
Cu.reportError(ex);
}
}
},
/**
* Injects new default protocol handlers if the version in the preferences is
* newer than the one in the data store. If we just imported data from the RDF
* back-end, we only need to update the version in the data store.
* newer than the one in the data store.
*/
_injectDefaultProtocolHandlersIfNeeded(alreadyInjected) {
_injectDefaultProtocolHandlersIfNeeded() {
let prefsDefaultHandlersVersion;
try {
prefsDefaultHandlersVersion = Services.prefs.getComplexValue(
@ -153,9 +93,7 @@ HandlerService.prototype = {
let defaultHandlersVersion =
this._store.data.defaultHandlersVersion[locale] || 0;
if (defaultHandlersVersion < prefsDefaultHandlersVersion) {
if (!alreadyInjected) {
this._injectDefaultProtocolHandlers();
}
this._injectDefaultProtocolHandlers();
this._store.data.defaultHandlersVersion[locale] =
prefsDefaultHandlersVersion;
}
@ -195,9 +133,9 @@ HandlerService.prototype = {
// This clause is essentially a reimplementation of
// nsIExternalProtocolHandlerService.getProtocolHandlerInfo().
// Necessary because we want to use this instance of the service,
// but nsIExternalProtocolHandlerService would call the RDF-based based version
// until we complete the conversion.
// Necessary because calling that from here would make XPConnect barf
// when getService tried to re-enter the constructor for this
// service.
let osDefaultHandlerFound = {};
let protoInfo = gExternalProtocolService.getProtocolHandlerInfoFromOS(scheme,
osDefaultHandlerFound);

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
component {32314cc8-22f7-4f7f-a645-1a45453ba6a6} nsHandlerService.js
contract @mozilla.org/uriloader/handler-service-rdf;1 {32314cc8-22f7-4f7f-a645-1a45453ba6a6} process=main

View File

@ -1,12 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*
* Loaded by "test_handlerService_json.js" and "test_handlerService_rdf.js" to
* check that the nsIHandlerService interface has the same behavior with both
* the JSON and RDF backends.
*/
HandlerServiceTestUtils.handlerService = gHandlerService;
// Set up an nsIWebHandlerApp instance that can be used in multiple tests.

View File

@ -21,14 +21,10 @@ ChromeUtils.import("resource://testing-common/TestUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "gHandlerServiceJSON",
"@mozilla.org/uriloader/handler-service;1",
"nsIHandlerService");
XPCOMUtils.defineLazyServiceGetter(this, "gHandlerServiceRDF",
"@mozilla.org/uriloader/handler-service-rdf;1",
"nsIHandlerService");
do_get_profile();
let jsonPath = OS.Path.join(OS.Constants.Path.profileDir, "handlers.json");
let rdfFile = FileUtils.getFile("ProfD", ["mimeTypes.rdf"]);
/**
* Unloads the nsIHandlerService data store, so the back-end file can be
@ -44,16 +40,6 @@ let unloadHandlerStoreJSON = async function() {
Services.obs.notifyObservers(null, "handlersvc-json-replace", null);
await promise;
};
let unloadHandlerStoreRDF = async function() {
// If this function is called before the nsIHandlerService instance has been
// initialized for the first time, the observer below will not be registered.
// We have to force initialization to prevent the function from stalling.
gHandlerServiceRDF;
let promise = TestUtils.topicObserved("handlersvc-rdf-replace-complete");
Services.obs.notifyObservers(null, "handlersvc-rdf-replace", null);
await promise;
};
/**
* Unloads the data store and deletes it.
@ -63,11 +49,6 @@ let deleteHandlerStoreJSON = async function() {
await OS.File.remove(jsonPath, { ignoreAbsent: true });
};
let deleteHandlerStoreRDF = async function() {
await unloadHandlerStoreRDF();
await OS.File.remove(rdfFile.path, { ignoreAbsent: true });
};
/**
* Unloads the data store and replaces it with the test data file.
@ -77,30 +58,10 @@ let copyTestDataToHandlerStoreJSON = async function() {
await OS.File.copy(do_get_file("handlers.json").path, jsonPath);
};
let copyTestDataToHandlerStoreRDF = async function() {
await unloadHandlerStoreRDF();
let fileName = AppConstants.platform == "android" ? "mimeTypes-android.rdf"
: "mimeTypes.rdf";
await OS.File.copy(do_get_file(fileName).path, rdfFile.path);
};
/**
* Ensures the JSON implementation doesn't migrate entries from the legacy RDF
* data source during the other tests. This is important for both back-ends,
* because the JSON implementation is the default one and is always invoked by
* the MIME service when building new nsIHandlerInfo objects.
*/
add_task(async function test_initialize() {
// We don't need to reset this preference when the tests end, because it's
// irrelevant for any other test in the tree.
Services.prefs.setBoolPref("gecko.handlerService.migrated", true);
});
/**
* Ensures the files are removed and the services unloaded when the tests end.
*/
registerCleanupFunction(async function test_terminate() {
await deleteHandlerStoreJSON();
await deleteHandlerStoreRDF();
});

View File

@ -1,100 +0,0 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Seq RDF:about="urn:mimetypes:root">
<RDF:li RDF:resource="urn:mimetype:example/type.handleinternally"/>
<RDF:li RDF:resource="urn:mimetype:example/type.savetodisk"/>
<RDF:li RDF:resource="urn:mimetype:example/type.usehelperapp"/>
<RDF:li RDF:resource="urn:mimetype:example/type.usesystemdefault"/>
<RDF:li RDF:resource="urn:mimetype:examplescheme.usehelperapp"/>
<RDF:li RDF:resource="urn:mimetype:examplescheme.usesystemdefault"/>
</RDF:Seq>
<RDF:Description RDF:about="urn:mimetype:example/type.usehelperapp"
NC:value="example/type.usehelperapp">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.usehelperapp"/>
<NC:fileExtensions>example_two</NC:fileExtensions>
<NC:fileExtensions>example_three</NC:fileExtensions>
</RDF:Description>
<RDF:Description RDF:about="urn:handler:web:http://www.example.com/?id=2&amp;url=%s"
NC:prettyName="Example Possible Handler Two"
NC:uriTemplate="http://www.example.com/?id=2&amp;url=%s" />
<RDF:Description RDF:about="urn:mimetype:handler:example/type.handleinternally"
NC:handleInternal="true"
NC:alwaysAsk="false" />
<RDF:Description RDF:about="urn:mimetype:examplescheme.usesystemdefault"
NC:value="examplescheme.usesystemdefault">
<NC:handlerProp RDF:resource="urn:mimetype:handler:examplescheme.usesystemdefault"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:externalApplication:example/type.usehelperapp"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:mimetype:externalApplication:example/type.savetodisk"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:mimetype:example/type.usesystemdefault"
NC:value="example/type.usesystemdefault">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.usesystemdefault"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:examplescheme.usehelperapp"
NC:value="examplescheme.usehelperapp">
<NC:handlerProp RDF:resource="urn:mimetype:handler:examplescheme.usehelperapp"/>
</RDF:Description>
<RDF:Description RDF:about="urn:handler:web:http://www.example.com/?url=%s"
NC:prettyName="Example Possible Handler"
NC:uriTemplate="http://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:mimetype:example/type.savetodisk"
NC:value="example/type.savetodisk">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.savetodisk"/>
<NC:fileExtensions>example_two</NC:fileExtensions>
<NC:fileExtensions>example_three</NC:fileExtensions>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:handler:examplescheme.usehelperapp"
NC:alwaysAsk="true">
<NC:externalApplication RDF:resource="urn:mimetype:externalApplication:examplescheme.usehelperapp"/>
<NC:possibleApplication RDF:resource="urn:handler:web:https://www.example.com/?url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=1&amp;url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=2&amp;url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:example/type.handleinternally"
NC:value="example/type.handleinternally"
NC:fileExtensions="example_one">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.handleinternally"/>
</RDF:Description>
<RDF:Description RDF:about="urn:handler:web:http://www.example.com/?id=1&amp;url=%s"
NC:prettyName="Example Possible Handler One"
NC:uriTemplate="http://www.example.com/?id=1&amp;url=%s" />
<RDF:Description RDF:about="urn:handler:web:https://www.example.com/?url=%s"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:mimetype:handler:examplescheme.usesystemdefault"
NC:useSystemDefault="true"
NC:alwaysAsk="false">
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:handler:example/type.usesystemdefault"
NC:useSystemDefault="true"
NC:alwaysAsk="false">
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:root"
NC:en-US_defaultHandlersVersion="999" />
<RDF:Description RDF:about="urn:mimetype:handler:example/type.usehelperapp"
NC:alwaysAsk="true">
<NC:externalApplication RDF:resource="urn:mimetype:externalApplication:example/type.usehelperapp"/>
<NC:possibleApplication RDF:resource="urn:handler:web:https://www.example.com/?url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=1&amp;url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=2&amp;url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:externalApplication:examplescheme.usehelperapp"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:mimetypes">
<NC:MIME-types RDF:resource="urn:mimetypes:root"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:handler:example/type.savetodisk"
NC:saveToDisk="true"
NC:alwaysAsk="true">
<NC:externalApplication RDF:resource="urn:mimetype:externalApplication:example/type.savetodisk"/>
<NC:possibleApplication RDF:resource="urn:handler:web:https://www.example.com/?url=%s"/>
</RDF:Description>
</RDF:RDF>

View File

@ -1,105 +0,0 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description RDF:about="urn:mimetype:externalApplication:example/type.usehelperapp"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:scheme:examplescheme.usesystemdefault"
NC:value="examplescheme.usesystemdefault">
<NC:handlerProp RDF:resource="urn:scheme:handler:examplescheme.usesystemdefault"/>
</RDF:Description>
<RDF:Description RDF:about="urn:scheme:handler:examplescheme.usehelperapp"
NC:alwaysAsk="true">
<NC:externalApplication RDF:resource="urn:scheme:externalApplication:examplescheme.usehelperapp"/>
<NC:possibleApplication RDF:resource="urn:handler:web:https://www.example.com/?url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=1&amp;url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=2&amp;url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:handler:web:http://www.example.com/?url=%s"
NC:prettyName="Example Possible Handler"
NC:uriTemplate="http://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:scheme:handler:examplescheme.usesystemdefault"
NC:useSystemDefault="true"
NC:alwaysAsk="false">
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:example/type.savetodisk"
NC:value="example/type.savetodisk">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.savetodisk"/>
<NC:fileExtensions>example_two</NC:fileExtensions>
<NC:fileExtensions>example_three</NC:fileExtensions>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:example/type.usesystemdefault"
NC:value="example/type.usesystemdefault">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.usesystemdefault"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:handler:example/type.savetodisk"
NC:saveToDisk="true"
NC:alwaysAsk="true">
<NC:externalApplication RDF:resource="urn:mimetype:externalApplication:example/type.savetodisk"/>
<NC:possibleApplication RDF:resource="urn:handler:web:https://www.example.com/?url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:handler:web:http://www.example.com/?id=1&amp;url=%s"
NC:prettyName="Example Possible Handler One"
NC:uriTemplate="http://www.example.com/?id=1&amp;url=%s" />
<RDF:Description RDF:about="urn:mimetype:example/type.handleinternally"
NC:value="example/type.handleinternally"
NC:fileExtensions="example_one">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.handleinternally"/>
</RDF:Description>
<RDF:Description RDF:about="urn:root"
NC:en-US_defaultHandlersVersion="999" />
<RDF:Description RDF:about="urn:mimetype:handler:example/type.usesystemdefault"
NC:useSystemDefault="true"
NC:alwaysAsk="false">
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:scheme:externalApplication:examplescheme.usehelperapp"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Seq RDF:about="urn:mimetypes:root">
<RDF:li RDF:resource="urn:mimetype:example/type.handleinternally"/>
<RDF:li RDF:resource="urn:mimetype:example/type.savetodisk"/>
<RDF:li RDF:resource="urn:mimetype:example/type.usehelperapp"/>
<RDF:li RDF:resource="urn:mimetype:example/type.usesystemdefault"/>
</RDF:Seq>
<RDF:Description RDF:about="urn:mimetype:handler:example/type.usehelperapp"
NC:alwaysAsk="true">
<NC:externalApplication RDF:resource="urn:mimetype:externalApplication:example/type.usehelperapp"/>
<NC:possibleApplication RDF:resource="urn:handler:web:https://www.example.com/?url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=1&amp;url=%s"/>
<NC:possibleApplication RDF:resource="urn:handler:web:http://www.example.com/?id=2&amp;url=%s"/>
</RDF:Description>
<RDF:Description RDF:about="urn:scheme:examplescheme.usehelperapp"
NC:value="examplescheme.usehelperapp">
<NC:handlerProp RDF:resource="urn:scheme:handler:examplescheme.usehelperapp"/>
</RDF:Description>
<RDF:Seq RDF:about="urn:schemes:root">
<RDF:li RDF:resource="urn:scheme:examplescheme.usehelperapp"/>
<RDF:li RDF:resource="urn:scheme:examplescheme.usesystemdefault"/>
</RDF:Seq>
<RDF:Description RDF:about="urn:handler:web:https://www.example.com/?url=%s"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:mimetype:externalApplication:example/type.savetodisk"
NC:prettyName="Example Default Handler"
NC:uriTemplate="https://www.example.com/?url=%s" />
<RDF:Description RDF:about="urn:mimetypes">
<NC:MIME-types RDF:resource="urn:mimetypes:root"/>
</RDF:Description>
<RDF:Description RDF:about="urn:handler:web:http://www.example.com/?id=2&amp;url=%s"
NC:prettyName="Example Possible Handler Two"
NC:uriTemplate="http://www.example.com/?id=2&amp;url=%s" />
<RDF:Description RDF:about="urn:schemes">
<NC:Protocol-Schemes RDF:resource="urn:schemes:root"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:handler:example/type.handleinternally"
NC:handleInternal="true"
NC:alwaysAsk="false" />
<RDF:Description RDF:about="urn:mimetype:example/type.usehelperapp"
NC:value="example/type.usehelperapp">
<NC:handlerProp RDF:resource="urn:mimetype:handler:example/type.usehelperapp"/>
<NC:fileExtensions>example_two</NC:fileExtensions>
<NC:fileExtensions>example_three</NC:fileExtensions>
</RDF:Description>
</RDF:RDF>

View File

@ -70,73 +70,6 @@ add_task(async function test_race_async_init() {
await unloadHandlerStore();
});
/**
* Tests the migration from an existing RDF data source.
*/
add_task(async function test_migration_rdf_present() {
// Perform the most common migration, with the JSON file missing.
await deleteHandlerStore();
await copyTestDataToHandlerStoreRDF();
Services.prefs.setBoolPref("gecko.handlerService.migrated", false);
await assertAllHandlerInfosMatchTestData();
Assert.ok(Services.prefs.getBoolPref("gecko.handlerService.migrated"));
// Repeat the migration with the JSON file present.
await unloadHandlerStore();
await unloadHandlerStoreRDF();
Services.prefs.setBoolPref("gecko.handlerService.migrated", false);
await assertAllHandlerInfosMatchTestData();
Assert.ok(Services.prefs.getBoolPref("gecko.handlerService.migrated"));
});
/**
* Tests that new entries are preserved if migration is triggered manually.
*/
add_task(async function test_migration_rdf_present_keeps_new_data() {
await deleteHandlerStore();
let handlerInfo = getKnownHandlerInfo("example/new");
gHandlerService.store(handlerInfo);
// Perform the migration with the JSON file present.
await unloadHandlerStore();
await copyTestDataToHandlerStoreRDF();
Services.prefs.setBoolPref("gecko.handlerService.migrated", false);
let actualHandlerInfo = HandlerServiceTestUtils.getHandlerInfo("example/new");
HandlerServiceTestUtils.assertHandlerInfoMatches(actualHandlerInfo, {
type: "example/new",
preferredAction: Ci.nsIHandlerInfo.saveToDisk,
alwaysAskBeforeHandling: false,
});
Assert.ok(Services.prefs.getBoolPref("gecko.handlerService.migrated"));
});
/**
* Tests the injection of default protocol handlers when the RDF does not exist.
*/
add_task(async function test_migration_rdf_absent() {
if (!Services.prefs.getPrefType("gecko.handlerService.defaultHandlersVersion")) {
info("This platform or locale does not have default handlers.");
return;
}
// Perform the most common migration, with the JSON file missing.
await deleteHandlerStore();
await deleteHandlerStoreRDF();
Services.prefs.setBoolPref("gecko.handlerService.migrated", false);
await assertAllHandlerInfosMatchDefaultHandlers();
Assert.ok(Services.prefs.getBoolPref("gecko.handlerService.migrated"));
// Repeat the migration with the JSON file present.
await unloadHandlerStore();
await unloadHandlerStoreRDF();
Services.prefs.setBoolPref("gecko.handlerService.migrated", false);
await assertAllHandlerInfosMatchDefaultHandlers();
Assert.ok(Services.prefs.getBoolPref("gecko.handlerService.migrated"));
});
/**
* Test saving and reloading an instance of nsIGIOMimeApp.
*/

View File

@ -1,14 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*
* Tests the nsIHandlerService interface using the RDF backend.
*/
let gHandlerService = gHandlerServiceRDF;
let unloadHandlerStore = unloadHandlerStoreRDF;
let deleteHandlerStore = deleteHandlerStoreRDF;
let copyTestDataToHandlerStore = copyTestDataToHandlerStoreRDF;
var scriptFile = do_get_file("common_test_handlerService.js");
Services.scriptloader.loadSubScript(NetUtil.newURI(scriptFile).spec);

View File

@ -13,8 +13,6 @@ support-files = mailcap
fail-if = os == "android"
[test_handlerService_json.js]
support-files = handlers.json
[test_handlerService_rdf.js]
support-files = mimeTypes.rdf mimeTypes-android.rdf
[test_punycodeURIs.js]
# Bug 676997: test consistently fails on Android
fail-if = os == "android"