Bug 1049979 - Fix 'functions may be declared only at top level or immediately within another function' warnings. r=gavin

This commit is contained in:
Birunthan Mohanathas 2014-08-10 11:16:32 -07:00
parent 8031546dc8
commit a534663c41
7 changed files with 14 additions and 14 deletions

View File

@ -1417,13 +1417,13 @@ BrowserGlue.prototype = {
let currentsetResource = this._rdf.GetResource("currentset");
let toolbarIsCustomized = !!this._getPersist(toolbarResource,
currentsetResource);
function getToolbarFolderCount() {
let getToolbarFolderCount = function () {
let toolbarFolder =
PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
let toolbarChildCount = toolbarFolder.childCount;
toolbarFolder.containerOpen = false;
return toolbarChildCount;
}
};
if (toolbarIsCustomized || getToolbarFolderCount() > 3) {
this._setPersist(toolbarResource, collapsedResource, "false");

View File

@ -535,7 +535,7 @@ this.PlacesUtils = {
return writer.value;
}
case this.TYPE_X_MOZ_URL: {
function gatherDataUrl(bNode) {
let gatherDataUrl = function (bNode) {
if (isLivemark(bNode)) {
return gatherLivemarkUrl(bNode) + NEWLINE + bNode.title;
}
@ -544,7 +544,7 @@ this.PlacesUtils = {
return (aOverrideURI || bNode.uri) + NEWLINE + bNode.title;
// ignore containers and separators - items without valid URIs
return "";
}
};
let [node, shouldClose] = convertNode(aNode);
let dataUrl = gatherDataUrl(node);
@ -554,15 +554,15 @@ this.PlacesUtils = {
return dataUrl;
}
case this.TYPE_HTML: {
function gatherDataHtml(bNode) {
function htmlEscape(s) {
let gatherDataHtml = function (bNode) {
let htmlEscape = function (s) {
s = s.replace(/&/g, "&");
s = s.replace(/>/g, ">");
s = s.replace(/</g, "&lt;");
s = s.replace(/"/g, "&quot;");
s = s.replace(/'/g, "&apos;");
return s;
}
};
// escape out potential HTML in the title
let escapedTitle = bNode.title ? htmlEscape(bNode.title) : "";

View File

@ -1584,7 +1584,7 @@ Engine.prototype = {
"\" for engine: \"" + this.name + "\"");
var chan = NetUtil.ioService.newChannelFromURI(uri);
function iconLoadCallback(aByteArray, aEngine) {
let iconLoadCallback = function (aByteArray, aEngine) {
// This callback may run after we've already set a preferred icon,
// so check again.
if (aEngine._hasPreferredIcon && !aIsPreferred)
@ -4738,7 +4738,7 @@ var engineMetadataService = {
if (!this._lazyWriter) {
LOG("metadata _commit: initializing lazy writer");
function writeCommit() {
let writeCommit = function () {
LOG("metadata writeCommit: start");
let data = gEncoder.encode(JSON.stringify(engineMetadataService._store));
let path = engineMetadataService._jsonFile;

View File

@ -711,7 +711,7 @@ G_Loggifier.prototype.loggify = function(obj) {
// they're encountered during execution, so declare this helper
// before using it.)
function wrap(meth, objName, methName) {
let wrap = function (meth, objName, methName) {
return function() {
// First output the call along with actual parameters

View File

@ -112,11 +112,11 @@ function TEST_G_Observer() {
var regularObserverRan = 0;
var observerServiceObserverRan = 0;
function regularObserver() {
let regularObserver = function () {
regularObserverRan++;
};
function observerServiceObserver() {
let observerServiceObserver = function () {
observerServiceObserverRan++;
};

View File

@ -244,7 +244,7 @@ function TEST_G_Preferences() {
// Used to test observing
var observeCount = 0;
function observe(prefChanged) {
let observe = function (prefChanged) {
G_Assert(z, prefChanged == testPref, "observer broken");
observeCount++;
};

View File

@ -89,7 +89,7 @@ function TEST_G_Protocol4Parser() {
var p = new G_Protocol4Parser();
function isEmpty(map) {
let isEmpty = function (map) {
for (var key in map)
return false;
return true;