mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 484579 - nsIMIMEService.getTypeFromExtension may fail unexpectedly on Windows when "Content Type" is empty in the registry; fix for test; r=sdwilsh sr=bzbarsky
This commit is contained in:
parent
47a635a1f1
commit
a02317b4ad
@ -41,10 +41,17 @@
|
||||
* "Content Type" is empty in the registry.
|
||||
*/
|
||||
function run_test() {
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
// --- Preliminary platform check ---
|
||||
|
||||
// If this test is not running on the Windows platform, stop now, before
|
||||
// calling XPCOMUtils.generateQI during the MockWindowsRegKey declaration.
|
||||
if (!("@mozilla.org/windows-registry-key;1" in Components.classes))
|
||||
return;
|
||||
|
||||
// --- Modified nsIWindowsRegKey implementation ---
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
/**
|
||||
* Constructs a new mock registry key by wrapping the provided object.
|
||||
*
|
||||
@ -192,19 +199,8 @@ function run_test() {
|
||||
);
|
||||
}
|
||||
|
||||
// --- Test support functions ---
|
||||
|
||||
/**
|
||||
* Returns true if the application is executing on Windows.
|
||||
*/
|
||||
function isOnWindows() {
|
||||
return ("@mozilla.org/windows-registry-key;1" in Components.classes);
|
||||
}
|
||||
|
||||
// --- Test procedure ---
|
||||
|
||||
// This test is Windows-specific
|
||||
if(isOnWindows()) {
|
||||
// Activate the override of the ".txt" file association data in the registry
|
||||
registerMockWindowsRegKeyFactory();
|
||||
try {
|
||||
@ -220,5 +216,4 @@ function run_test() {
|
||||
// Ensure we restore the original factory when the test is finished
|
||||
unregisterMockWindowsRegKeyFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user