This commit is contained in:
Ryan VanderMeulen 2013-08-30 21:00:08 -04:00
Родитель b47f71f8ba 7b9c5ae03d
Коммит 852d2cf85e
20 изменённых файлов: 263 добавлений и 147 удалений

Просмотреть файл

@ -153,7 +153,7 @@ const SNIPPETS_OBJECTSTORE_NAME = "snippets";
let gInitialized = false;
let gObserver = new MutationObserver(function (mutations) {
for (let mutation of mutations) {
if (mutation.attributeName == "searchEngineURL") {
if (mutation.attributeName == "searchEngineName") {
setupSearchEngine();
if (!gInitialized) {
ensureSnippetsMapThen(loadSnippets);
@ -295,52 +295,17 @@ function ensureSnippetsMapThen(aCallback)
function onSearchSubmit(aEvent)
{
let searchTerms = document.getElementById("searchText").value;
let searchURL = document.documentElement.getAttribute("searchEngineURL");
if (searchURL && searchTerms.length > 0) {
// Send an event that a search was performed. This was originally
// added so Firefox Health Report could record that a search from
// about:home had occurred.
let engineName = document.documentElement.getAttribute("searchEngineName");
let event = new CustomEvent("AboutHomeSearchEvent", {detail: engineName});
if (engineName && searchTerms.length > 0) {
// Send an event that will perform a search and Firefox Health Report will
// record that a search from about:home has occurred.
let eventData = JSON.stringify({
engineName: engineName,
searchTerms: searchTerms
});
let event = new CustomEvent("AboutHomeSearchEvent", {detail: eventData});
document.dispatchEvent(event);
const SEARCH_TOKEN = "_searchTerms_";
let searchPostData = document.documentElement.getAttribute("searchEnginePostData");
if (searchPostData) {
// Check if a post form already exists. If so, remove it.
const POST_FORM_NAME = "searchFormPost";
let form = document.forms[POST_FORM_NAME];
if (form) {
form.parentNode.removeChild(form);
}
// Create a new post form.
form = document.body.appendChild(document.createElement("form"));
form.setAttribute("name", POST_FORM_NAME);
// Set the URL to submit the form to.
form.setAttribute("action", searchURL.replace(SEARCH_TOKEN, searchTerms));
form.setAttribute("method", "post");
// Create new <input type=hidden> elements for search param.
searchPostData = searchPostData.split("&");
for (let postVar of searchPostData) {
let [name, value] = postVar.split("=");
if (value == SEARCH_TOKEN) {
value = searchTerms;
}
let input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", name);
input.setAttribute("value", value);
form.appendChild(input);
}
// Submit the form.
form.submit();
} else {
searchURL = searchURL.replace(SEARCH_TOKEN, encodeURIComponent(searchTerms));
window.location.href = searchURL;
}
}
aEvent.preventDefault();

Просмотреть файл

@ -111,7 +111,7 @@
<command id="Browser:ToggleAddonBar" oncommand="toggleAddonBar();"/>
<command id="Social:TogglePageMark" oncommand="SocialMark.togglePageMark();" disabled="true"/>
<command id="Social:SharePage" oncommand="SocialShare.sharePage();" disabled="true"/>
<command id="Social:ToggleSidebar" oncommand="Social.toggleSidebar();"/>
<command id="Social:ToggleSidebar" oncommand="Social.toggleSidebar();" hidden="true"/>
<command id="Social:ToggleNotifications" oncommand="Social.toggleNotifications();" hidden="true"/>
<command id="Social:FocusChat" oncommand="SocialChatBar.focus();" hidden="true" disabled="true"/>
<command id="Social:Toggle" oncommand="Social.toggle();" hidden="true"/>

Просмотреть файл

@ -45,9 +45,9 @@ SocialUI = {
if (!Social.initialized) {
Social.init();
} else if (Social.enabled) {
// social was previously initialized, so it's not going to notify us of
// anything, so handle that now.
} else if (Social.providers.length > 0) {
// Social was initialized during startup in a previous window. If we have
// providers enabled initialize the UI for this window.
this.observe(null, "social:providers-changed", null);
this.observe(null, "social:provider-set", Social.provider ? Social.provider.origin : null);
}
@ -322,7 +322,10 @@ SocialUI = {
let containerParent = container.parentNode;
if (containerParent.classList.contains("social-panel") &&
containerParent instanceof Ci.nsIDOMXULPopupElement) {
// allow the link traversal to finish before closing the panel
setTimeout(() => {
containerParent.hidePopup();
}, 0);
}
},
@ -693,7 +696,7 @@ SocialShare = {
onHidden: function() {
this.shareButton.removeAttribute("open");
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,")
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,");
this.currentShare = null;
},

Просмотреть файл

@ -90,19 +90,13 @@ let AboutHomeListener = {
// Inject search engine and snippets URL.
let docElt = doc.documentElement;
// set the following attributes BEFORE searchEngineURL, which triggers to
// set the following attributes BEFORE searchEngineName, which triggers to
// show the snippets when it's set.
docElt.setAttribute("snippetsURL", aData.snippetsURL);
if (aData.showKnowYourRights)
docElt.setAttribute("showKnowYourRights", "true");
docElt.setAttribute("snippetsVersion", aData.snippetsVersion);
let engine = aData.defaultSearchEngine;
docElt.setAttribute("searchEngineName", engine.name);
docElt.setAttribute("searchEnginePostData", engine.postDataString || "");
// Again, keep the searchEngineURL as the last attribute, because the
// mutation observer in aboutHome.js is counting on that.
docElt.setAttribute("searchEngineURL", engine.searchURL);
docElt.setAttribute("searchEngineName", Services.search.defaultEngine.name);
},
onPageLoad: function() {
@ -135,7 +129,7 @@ let AboutHomeListener = {
sendAsyncMessage("AboutHome:RequestUpdate");
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
sendAsyncMessage("AboutHome:Search", { engineName: e.detail });
sendAsyncMessage("AboutHome:Search", { searchData: e.detail });
}, true, true);
},

Просмотреть файл

@ -107,7 +107,8 @@ let gTests = [
let engineName = doc.documentElement.getAttribute("searchEngineName");
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
is(e.detail, engineName, "Detail is search engine name");
let data = JSON.parse(e.detail);
is(data.engineName, engineName, "Detail is search engine name");
// We use executeSoon() to ensure that this code runs after the
// count has been updated in browser.js, since it uses the same
@ -287,7 +288,7 @@ let gTests = [
// propagated to the about:home content, we want to perform a search.
let mutationObserver = new MutationObserver(function (mutations) {
for (let mutation of mutations) {
if (mutation.attributeName == "searchEngineURL") {
if (mutation.attributeName == "searchEngineName") {
searchText.value = needle;
searchText.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
@ -445,7 +446,7 @@ function promiseBrowserAttributes(aTab)
}
// Now we just have to wait for the last attribute.
if (mutation.attributeName == "searchEngineURL") {
if (mutation.attributeName == "searchEngineName") {
info("Remove attributes observer");
observer.disconnect();
// Must be sure to continue after the page mutation observer.

Просмотреть файл

@ -133,12 +133,10 @@ var tests = {
function onTabOpen(event) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
is(panel.state, "closed", "flyout should be closed");
ok(true, "Link should open a new tab");
executeSoon(function(){
waitForCondition(function() { return panel.state == "closed" }, function() {
gBrowser.removeTab(event.target);
next();
});
}, "panel should close after tab open");
}
let panel = document.getElementById("social-flyout-panel");

Просмотреть файл

@ -4,6 +4,8 @@
// Test the top-level window UI for social.
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
// This function should "reset" Social such that the next time Social.init()
// is called (eg, when a new window is opened), it re-performs all
// initialization.
@ -12,7 +14,6 @@ function resetSocial() {
Social._provider = null;
Social.providers = [];
// *sob* - listeners keep getting added...
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
SocialService._providerListeners.clear();
}
@ -52,9 +53,10 @@ function test() {
}
let tests = {
// check when social is totally disabled at startup (ie, no providers)
// check when social is totally disabled at startup (ie, no providers enabled)
testInactiveStartup: function(cbnext) {
is(Social.providers.length, 0, "needs zero providers to start this test.");
ok(!SocialService.hasEnabledProviders, "no providers are enabled");
resetSocial();
openWindowAndWaitForInit(function(w1) {
checkSocialUI(w1);
@ -67,12 +69,13 @@ let tests = {
});
},
// Check when providers exist and social is turned on at startup.
// Check when providers are enabled and social is turned on at startup.
testEnabledStartup: function(cbnext) {
runSocialTestWithProvider(manifest, function (finishcb) {
resetSocial();
openWindowAndWaitForInit(function(w1) {
ok(Social.enabled, "social is enabled");
ok(SocialService.hasEnabledProviders, "providers are enabled");
checkSocialUI(w1);
// now init is complete, open a second window
openWindowAndWaitForInit(function(w2) {
@ -91,11 +94,13 @@ let tests = {
}, cbnext);
},
// Check when providers exist but social is turned off at startup.
// Check when providers are enabled but social is turned off at startup.
testDisabledStartup: function(cbnext) {
runSocialTestWithProvider(manifest, function (finishcb) {
setManifestPref("social.manifest.test", manifest);
SocialService.addProvider(manifest, function (provider) {
Services.prefs.setBoolPref("social.enabled", false);
resetSocial();
ok(SocialService.hasEnabledProviders, "providers are enabled");
openWindowAndWaitForInit(function(w1) {
ok(!Social.enabled, "social is disabled");
checkSocialUI(w1);
@ -109,33 +114,33 @@ let tests = {
ok(Social.enabled, "social is enabled");
checkSocialUI(w2);
checkSocialUI(w1);
finishcb();
SocialService.removeProvider(manifest.origin, function() {
Services.prefs.clearUserPref("social.manifest.test");
cbnext();
});
});
});
});
}, cbnext);
},
// Check when the last provider is removed.
// Check when the last provider is disabled.
testRemoveProvider: function(cbnext) {
runSocialTestWithProvider(manifest, function (finishcb) {
setManifestPref("social.manifest.test", manifest);
SocialService.addProvider(manifest, function (provider) {
openWindowAndWaitForInit(function(w1) {
checkSocialUI(w1);
// now init is complete, open a second window
openWindowAndWaitForInit(function(w2) {
checkSocialUI(w2);
// remove the current provider.
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
// disable the current provider.
SocialService.removeProvider(manifest.origin, function() {
ok(!Social.enabled, "social is disabled");
is(Social.providers.length, 0, "no providers");
checkSocialUI(w2);
checkSocialUI(w1);
// *sob* - runSocialTestWithProvider's cleanup fails when it can't
// remove the provider, so re-add it.
SocialService.addProvider(manifest, function() {
finishcb();
});
Services.prefs.clearUserPref("social.manifest.test");
cbnext();
});
});
});

Просмотреть файл

@ -194,6 +194,7 @@ function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
// A fairly large hammer which checks all aspects of the SocialUI for
// internal consistency.
function checkSocialUI(win) {
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
win = win || window;
let doc = win.document;
let provider = Social.provider;
@ -201,6 +202,14 @@ function checkSocialUI(win) {
let active = Social.providers.length > 0 && !win.SocialUI._chromeless &&
!PrivateBrowsingUtils.isWindowPrivate(win);
// if we have enabled providers, we should also have instances of those
// providers
if (SocialService.hasEnabledProviders) {
ok(Social.providers.length > 0, "providers are enabled");
} else {
is(Social.providers.length, 0, "providers are not enabled");
}
// some local helpers to avoid log-spew for the many checks made here.
let numGoodTests = 0, numTests = 0;
function _ok(what, msg) {
@ -246,6 +255,7 @@ function checkSocialUI(win) {
// and for good measure, check all the social commands.
isbool(!doc.getElementById("Social:Toggle").hidden, active, "Social:Toggle visible?");
isbool(!doc.getElementById("Social:ToggleSidebar").hidden, enabled, "Social:ToggleSidebar visible?");
isbool(!doc.getElementById("Social:ToggleNotifications").hidden, enabled, "Social:ToggleNotifications visible?");
isbool(!doc.getElementById("Social:FocusChat").hidden, enabled, "Social:FocusChat visible?");
isbool(doc.getElementById("Social:FocusChat").getAttribute("disabled"), enabled ? "false" : "true", "Social:FocusChat disabled?");

Просмотреть файл

@ -0,0 +1,79 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE bindings [
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
%notificationDTD;
]>
<bindings id="notificationBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="notificationbox" extends="chrome://global/content/bindings/notification.xml#notificationbox">
<content>
<xul:stack xbl:inherits="hidden=notificationshidden"
class="notificationbox-stack">
<xul:spacer/>
<children includes="notification"/>
</xul:stack>
<html:div anonid="layer1" class="notification-layer"></html:div>
<html:div anonid="layer2" class="notification-layer"></html:div>
<children/>
</content>
<implementation>
<constructor>
<![CDATA[
this.addEventListener("AlertActive", this.handleEvent, true);
this.addEventListener("AlertClose", this.handleEvent, true);
this.setAttribute("count", 0);
]]>
</constructor>
<destructor>
<![CDATA[
this.removeEventListener("AlertActive", this.handleEvent, true);
this.removeEventListener("AlertClose", this.handleEvent, true);
]]>
</destructor>
<method name="removeNotification">
<parameter name="aItem"/>
<parameter name="aSkipAnimation"/>
<body>
<![CDATA[
if (aItem == this.currentNotification)
this.removeCurrentNotification(aSkipAnimation);
else if (aItem != this._closedNotification)
this._removeNotificationElement(aItem);
// Fire notification closed event.
let event = new Event('AlertClose');
this.dispatchEvent(event);
return aItem;
]]>
</body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body>
<![CDATA[
switch (aEvent.type) {
case "AlertActive":
case "AlertClose":
this.setAttribute("count", this.allNotifications.length);
break;
}
]]>
</body>
</method>
</implementation>
</binding>
</bindings>

Просмотреть файл

@ -46,6 +46,10 @@ autoscroller {
-moz-binding: url('chrome://browser/content/bindings/popup.xml#element-popup');
}
notificationbox {
-moz-binding: url('chrome://browser/content/bindings/notification.xml#notificationbox');
}
circularprogressindicator {
-moz-binding: url('chrome://browser/content/bindings/circularprogress.xml#circular-progress-indicator');
}

Просмотреть файл

@ -28,6 +28,7 @@ chrome.jar:
content/bindings/cssthrobber.xml (content/bindings/cssthrobber.xml)
content/bindings/popup.xml (content/bindings/popup.xml)
content/bindings/circularprogress.xml (content/bindings/circularprogress.xml)
content/bindings/notification.xml (content/bindings/notification.xml)
* content/flyoutpanels/FlyoutPanelsUI.js (content/flyoutpanels/FlyoutPanelsUI.js)
* content/flyoutpanels/AboutFlyoutPanel.js (content/flyoutpanels/AboutFlyoutPanel.js)

Просмотреть файл

@ -447,8 +447,27 @@ notification {
min-height: 64px;
}
notificationbox[count="0"] .notification-layer,
notificationbox[count="1"] .notification-layer,
notificationbox[count="2"] .notification-layer[anonid="layer2"] {
visibility: collapse;
}
notificationbox[count="2"] .notification-layer[anonid="layer1"],
notificationbox[count="3"] .notification-layer[anonid="layer1"],
notificationbox[count="3"] .notification-layer[anonid="layer2"] {
visibility: visible;
}
.notification-layer {
border: @metro_border_thin@ solid @field_disabled_foreground_color@;
border-bottom: none;
height:5px
}
.notification-inner {
border-style: none;
border: @metro_border_thin@ solid @field_disabled_foreground_color@;
}
.notification-button {

Просмотреть файл

@ -25,21 +25,6 @@ const STARTPAGE_VERSION = 4;
this.AboutHomeUtils = {
get snippetsVersion() STARTPAGE_VERSION,
/**
* Returns an object containing the name and searchURL of the original default
* search engine.
*/
get defaultSearchEngine() {
let defaultEngine = Services.search.defaultEngine;
let submission = defaultEngine.getSubmission("_searchTerms_", null, "homepage");
return Object.freeze({
name: defaultEngine.name,
searchURL: submission.uri.spec,
postDataString: submission.postDataString
});
},
/*
* showKnowYourRights - Determines if the user should be shown the
* about:rights notification. The notification should *not* be shown if
@ -173,9 +158,19 @@ let AboutHome = {
break;
case "AboutHome:Search":
let data;
try {
data = JSON.parse(aMessage.data.searchData);
} catch(ex) {
Cu.reportError(ex);
break;
}
#ifdef MOZ_SERVICES_HEALTHREPORT
window.BrowserSearch.recordSearchInHealthReport(aMessage.data.engineName, "abouthome");
window.BrowserSearch.recordSearchInHealthReport(data.engineName, "abouthome");
#endif
// Trigger a search through nsISearchEngine.getSubmission()
let submission = Services.search.currentEngine.getSubmission(data.searchTerms);
window.loadURI(submission.uri.spec, null, submission.postData);
break;
}
},
@ -189,8 +184,7 @@ let AboutHome = {
showRestoreLastSession: ss.canRestoreLastSession,
snippetsURL: AboutHomeUtils.snippetsURL,
showKnowYourRights: AboutHomeUtils.showKnowYourRights,
snippetsVersion: AboutHomeUtils.snippetsVersion,
defaultSearchEngine: AboutHomeUtils.defaultSearchEngine
snippetsVersion: AboutHomeUtils.snippetsVersion
};
if (AboutHomeUtils.showKnowYourRights) {

Просмотреть файл

@ -158,8 +158,9 @@ this.Social = {
return;
}
this.initialized = true;
if (SocialService.enabled) {
// if SocialService.hasEnabledProviders, retreive the providers so the
// front-end can generate UI
if (SocialService.hasEnabledProviders) {
// Retrieve the current set of providers, and set the current provider.
SocialService.getOrderedProviderList(function (providers) {
Social._updateProviderCache(providers);

Просмотреть файл

@ -11,16 +11,24 @@
android:paddingLeft="50dp"
android:paddingRight="50dp">
<!-- Empty spacer view -->
<View android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
<ImageView android:id="@+id/home_empty_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="15dp"/>
android:gravity="top|center"
android:scaleType="center"
android:paddingBottom="10dp"/>
<TextView android:id="@+id/home_empty_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textAppearance="@style/TextAppearance.EmptyMessage"/>
android:layout_height="0dip"
android:gravity="top|center"
android:textAppearance="@style/TextAppearance.EmptyMessage"
android:layout_weight="3"/>
</LinearLayout>

Просмотреть файл

@ -7,7 +7,7 @@
interface nsIURI;
interface nsIInputStream;
[scriptable, uuid(82ec6ee8-68b5-49ef-87b7-0d5240f8a183)]
[scriptable, uuid(5799251f-5b55-4df7-a9e7-0c27812c469a)]
interface nsISearchSubmission : nsISupports
{
/**
@ -16,12 +16,6 @@ interface nsISearchSubmission : nsISupports
*/
readonly attribute nsIInputStream postData;
/**
* The POST data associated with a search submission as an
* application/x-www-form-urlencoded string. May be null.
*/
readonly attribute AString postDataString;
/**
* The URI to submit a search to.
*/

Просмотреть файл

@ -931,7 +931,6 @@ EngineURL.prototype = {
}
var postData = null;
let postDataString = null;
if (this.method == "GET") {
// GET method requests have no post data, and append the encoded
// query string to the url...
@ -939,8 +938,8 @@ EngineURL.prototype = {
url += "?";
url += dataString;
} else if (this.method == "POST") {
// For POST requests, specify the data as a MIME stream as well as a string.
postDataString = dataString;
// POST method requests must wrap the encoded text in a MIME
// stream and supply that as POSTDATA.
var stringStream = Cc["@mozilla.org/io/string-input-stream;1"].
createInstance(Ci.nsIStringInputStream);
stringStream.data = dataString;
@ -952,7 +951,7 @@ EngineURL.prototype = {
postData.setData(stringStream);
}
return new Submission(makeURI(url), postData, postDataString);
return new Submission(makeURI(url), postData);
},
_hasRelation: function SRC_EURL__hasRelation(aRel)
@ -2544,7 +2543,7 @@ Engine.prototype = {
if (!aData) {
// Return a dummy submission object with our searchForm attribute
return new Submission(makeURI(this.searchForm));
return new Submission(makeURI(this.searchForm), null);
}
LOG("getSubmission: In data: \"" + aData + "\"; Purpose: \"" + aPurpose + "\"");
@ -2581,10 +2580,9 @@ Engine.prototype = {
};
// nsISearchSubmission
function Submission(aURI, aPostData = null, aPostDataString = null) {
function Submission(aURI, aPostData = null) {
this._uri = aURI;
this._postData = aPostData;
this._postDataString = aPostDataString;
}
Submission.prototype = {
get uri() {
@ -2593,9 +2591,6 @@ Submission.prototype = {
get postData() {
return this._postData;
},
get postDataString() {
return this._postDataString;
},
QueryInterface: function SRCH_SUBM_QI(aIID) {
if (aIID.equals(Ci.nsISearchSubmission) ||
aIID.equals(Ci.nsISupports))

Просмотреть файл

@ -350,6 +350,16 @@ function schedule(callback) {
// Public API
this.SocialService = {
get hasEnabledProviders() {
// used as an optimization during startup, can be used to check if further
// initialization should be done (e.g. creating the instances of
// SocialProvider and turning on UI). ActiveProviders may have changed and
// not yet flushed so we check the active providers array
for (let p in ActiveProviders._providers) {
return true;
};
return false;
},
get enabled() {
return SocialServiceInternal.enabled;
},

Просмотреть файл

@ -318,6 +318,7 @@ if (APP_BIN_NAME == "xulrunner") {
* Nulls out the most commonly used global vars used by tests as appropriate.
*/
function cleanUp() {
logTestInfo("start - general test cleanup");
removeUpdateDirsAndFiles();
// Force the update manager to reload the update data to prevent it from
@ -348,6 +349,7 @@ function cleanUp() {
}
gTestserver = null;
logTestInfo("finish - general test cleanup");
}
/**
@ -1562,14 +1564,41 @@ function removeCallbackCopy() {
appBinCopy.remove(false);
}
catch (e) {
logTestInfo("non-fatal error removing file during cleanup (will try " +
"again). File: " + appBinCopy.path + " Exception: " + e);
logTestInfo("non-fatal error removing file after test finished (will " +
"try again). File: " + appBinCopy.path + " Exception: " + e);
do_timeout(TEST_HELPER_TIMEOUT, removeCallbackCopy);
return;
}
}
// Use a timeout to give any files that were in use additional
// time to close. Same as updater.exe without service tests.
logTestInfo("attempting removal of the updater binary");
removeUpdater();
}
/**
* Helper function for updater tests that removes the updater binary before
* ending the test so the updater binary isn't in use during test cleanup.
*/
function removeUpdater() {
if (IS_WIN) {
// Remove the copy of the application executable used for the test on
// Windows if it exists.
let updater = getUpdatesDir();
updater.append("0");
updater.append(UPDATER_BIN_FILE);
if (updater.exists()) {
try {
updater.remove(false);
}
catch (e) {
logTestInfo("non-fatal error removing file after test finished (will " +
"try again). File: " + updater.path + " Exception: " + e);
do_timeout(TEST_HELPER_TIMEOUT, removeUpdater);
return;
}
}
}
logTestInfo("calling do_test_finished");
do_test_finished();
}
@ -2113,8 +2142,10 @@ function adjustPathsOnWindows() {
let ds = Services.dirsvc.QueryInterface(AUS_Ci.nsIDirectoryService);
ds.QueryInterface(AUS_Ci.nsIProperties).undefine(NS_GRE_DIR);
ds.registerProvider(dirProvider);
do_register_cleanup(function() {
do_register_cleanup(function APOW_cleanup() {
logTestInfo("start - unregistering directory provider");
ds.unregisterProvider(dirProvider);
logTestInfo("finish - unregistering directory provider");
});
logTestInfo("finish - setup new process directory");
}

Просмотреть файл

@ -83,11 +83,13 @@ function symlinkUpdateFilesIntoBundleDirectory() {
do_check_true(source2.exists());
// Cleanup the symlinks when the test is finished.
do_register_cleanup(function() {
do_register_cleanup(function AUFIBD_cleanup() {
logTestInfo("start - unlinking symlinks");
let ret = unlink(source.path);
do_check_false(source.exists());
let ret = unlink(source2.path);
do_check_false(source2.exists());
logTestInfo("finish - unlinking symlinks");
});
// Now, make sure that getUpdatesRootDir returns the application bundle
@ -198,6 +200,7 @@ function run_test() {
}
function end_test() {
logTestInfo("start - test cleanup");
// Remove the files added by the update.
let updateTestDir = getUpdateTestDir();
try {
@ -230,6 +233,7 @@ function end_test() {
}
cleanUp();
logTestInfo("finish - test cleanup");
}
function shouldAdjustPathsOnMac() {