From 4b9b1d8e6845dbd7ac8d5f9514cf319449357a6b Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Sat, 17 Apr 2010 03:19:33 -0700 Subject: [PATCH] Bug 560018 - Actually remove support for { get property funname() { } }, confounded merging madness... r=luke --HG-- extra : rebase_source : b3c47f5fdd0fcb52f68876e9a4fab16143c16901 --- browser/base/content/browser-fullZoom.js | 6 +-- browser/base/content/browser.js | 4 +- .../src/nsPrivateBrowsingService.js | 8 +-- js/src/jsparse.cpp | 2 +- js/src/tests/ecma_5/Expressions/jstests.list | 1 + .../Expressions/named-accessor-function.js | 50 +++++++++++++++++++ .../contentprefs/src/nsContentPrefService.js | 42 ++++++++-------- toolkit/content/viewZoomOverlay.js | 18 +++---- 8 files changed, 91 insertions(+), 40 deletions(-) create mode 100644 js/src/tests/ecma_5/Expressions/named-accessor-function.js diff --git a/browser/base/content/browser-fullZoom.js b/browser/base/content/browser-fullZoom.js index d911785df44..d875bb5e622 100644 --- a/browser/base/content/browser-fullZoom.js +++ b/browser/base/content/browser-fullZoom.js @@ -58,7 +58,7 @@ var FullZoom = { // The global value (if any) for the setting. Lazily loaded from the service // when first requested, then updated by the pref change listener as it changes. // If there is no global value, then this should be undefined. - get globalValue FullZoom_get_globalValue() { + get globalValue() { var globalValue = this._cps.getPref(null, this.name); if (typeof globalValue != "undefined") globalValue = this._ensureValid(globalValue); @@ -71,7 +71,7 @@ var FullZoom = { // Convenience Getters // Content Pref Service - get _cps FullZoom_get__cps() { + get _cps() { delete this._cps; return this._cps = Cc["@mozilla.org/content-pref/service;1"]. getService(Ci.nsIContentPrefService); @@ -86,7 +86,7 @@ var FullZoom = { // whether we are in private browsing mode _inPrivateBrowsing: false, - get siteSpecific FullZoom_get_siteSpecific() { + get siteSpecific() { return !this._inPrivateBrowsing && this._siteSpecificPref; }, diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 47497c244ec..5bc5b0db1cf 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -7149,7 +7149,7 @@ let gPrivateBrowsingUI = { Services.obs.removeObserver(this, "private-browsing-transition-complete"); }, - get _disableUIOnToggle PBUI__disableUIOnTogle() { + get _disableUIOnToggle() { if (this._privateBrowsingService.autoStarted) return false; @@ -7351,7 +7351,7 @@ let gPrivateBrowsingUI = { !this.privateBrowsingEnabled; }, - get privateBrowsingEnabled PBUI_get_privateBrowsingEnabled() { + get privateBrowsingEnabled() { return this._privateBrowsingService.privateBrowsingEnabled; } }; diff --git a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js index de097ef4721..28271346ecc 100644 --- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js +++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js @@ -467,7 +467,7 @@ PrivateBrowsingService.prototype = { } }, - get helpInfo PBS_get_helpInfo() { + get helpInfo() { return " -private Enable private browsing mode.\n" + " -private-toggle Toggle private browsing mode.\n"; }, @@ -477,14 +477,14 @@ PrivateBrowsingService.prototype = { /** * Return the current status of private browsing. */ - get privateBrowsingEnabled PBS_get_privateBrowsingEnabled() { + get privateBrowsingEnabled() { return this._inPrivateBrowsing; }, /** * Enter or leave private browsing mode. */ - set privateBrowsingEnabled PBS_set_privateBrowsingEnabled(val) { + set privateBrowsingEnabled(val) { // Allowing observers to set the private browsing status from their // notification handlers is not desired, because it will change the // status of the service while it's in the process of another transition. @@ -546,7 +546,7 @@ PrivateBrowsingService.prototype = { /** * Whether private browsing has been started automatically. */ - get autoStarted PBS_get_autoStarted() { + get autoStarted() { return this._inPrivateBrowsing && this._autoStarted; }, diff --git a/js/src/jsparse.cpp b/js/src/jsparse.cpp index fc4e3607b14..d56ecce6d10 100644 --- a/js/src/jsparse.cpp +++ b/js/src/jsparse.cpp @@ -7993,7 +7993,7 @@ Parser::primaryExpr(TokenKind tt, JSBool afterDot) /* We have to fake a 'function' token here. */ tokenStream.mungeCurrentToken(TOK_FUNCTION, JSOP_NOP); - pn2 = functionExpr(); + pn2 = functionDef(JSFUN_LAMBDA, false); pn2 = JSParseNode::newBinaryOrAppend(TOK_COLON, op, pn3, pn2, tc); goto skip; } diff --git a/js/src/tests/ecma_5/Expressions/jstests.list b/js/src/tests/ecma_5/Expressions/jstests.list index fddd4f84775..fb475260c59 100644 --- a/js/src/tests/ecma_5/Expressions/jstests.list +++ b/js/src/tests/ecma_5/Expressions/jstests.list @@ -1,2 +1,3 @@ url-prefix ../../jsreftest.html?test=ecma_5/Expressions/ script 11.1.5-01.js +script named-accessor-function.js diff --git a/js/src/tests/ecma_5/Expressions/named-accessor-function.js b/js/src/tests/ecma_5/Expressions/named-accessor-function.js new file mode 100644 index 00000000000..c52eb6c6f9a --- /dev/null +++ b/js/src/tests/ecma_5/Expressions/named-accessor-function.js @@ -0,0 +1,50 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ +// Contributor: +// Jeff Walden + +var gTestfile = 'named-accessor-function.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = 999999; +var summary = '{ get x y() { } } is not valid getter syntax'; + +print(BUGNUMBER + ": " + summary); + +var BAD_CODE = ["({ get x y() { } })", "({ set x y(v) { } })"]; + +for (var i = 0, sz = BAD_CODE.length; i < sz; i++) +{ + var code = BAD_CODE[i]; + + var err = "no exception"; + try + { + eval(code); + } + catch (e) + { + err = e; + } + if (!(err instanceof SyntaxError)) + { + assertEq(true, false, + "bad or no exception thrown for eval(" + code + "): " + err); + } + + err = "no exception"; + try + { + new Function(code); + } + catch (e) + { + err = e; + } + if (!(err instanceof SyntaxError)) + { + assertEq(true, false, + "bad or no exception thrown for Function(" + code + "): " + err); + } +} + +reportCompare(true, true); diff --git a/toolkit/components/contentprefs/src/nsContentPrefService.js b/toolkit/components/contentprefs/src/nsContentPrefService.js index 900cc4a3b9c..6aafebdf7c7 100644 --- a/toolkit/components/contentprefs/src/nsContentPrefService.js +++ b/toolkit/components/contentprefs/src/nsContentPrefService.js @@ -69,7 +69,7 @@ ContentPrefService.prototype = { // Observer Service __observerSvc: null, - get _observerSvc ContentPrefService_get__observerSvc() { + get _observerSvc() { if (!this.__observerSvc) this.__observerSvc = Cc["@mozilla.org/observer-service;1"]. getService(Ci.nsIObserverService); @@ -78,7 +78,7 @@ ContentPrefService.prototype = { // Console Service __consoleSvc: null, - get _consoleSvc ContentPrefService_get__consoleSvc() { + get _consoleSvc() { if (!this.__consoleSvc) this.__consoleSvc = Cc["@mozilla.org/consoleservice;1"]. getService(Ci.nsIConsoleService); @@ -87,7 +87,7 @@ ContentPrefService.prototype = { // Preferences Service __prefSvc: null, - get _prefSvc ContentPrefService_get__prefSvc() { + get _prefSvc() { if (!this.__prefSvc) this.__prefSvc = Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefBranch2); @@ -399,14 +399,14 @@ ContentPrefService.prototype = { }, _grouper: null, - get grouper ContentPrefService_get_grouper() { + get grouper() { if (!this._grouper) this._grouper = Cc["@mozilla.org/content-pref/hostname-grouper;1"]. getService(Ci.nsIContentURIGrouper); return this._grouper; }, - get DBConnection ContentPrefService_get_DBConnection() { + get DBConnection() { return this._dbConnection; }, @@ -415,7 +415,7 @@ ContentPrefService.prototype = { // Data Retrieval & Modification __stmtSelectPref: null, - get _stmtSelectPref ContentPrefService_get__stmtSelectPref() { + get _stmtSelectPref() { if (!this.__stmtSelectPref) this.__stmtSelectPref = this._dbCreateStatement( "SELECT prefs.value AS value " + @@ -449,7 +449,7 @@ ContentPrefService.prototype = { }, __stmtSelectGlobalPref: null, - get _stmtSelectGlobalPref ContentPrefService_get__stmtSelectGlobalPref() { + get _stmtSelectGlobalPref() { if (!this.__stmtSelectGlobalPref) this.__stmtSelectGlobalPref = this._dbCreateStatement( "SELECT prefs.value AS value " + @@ -481,7 +481,7 @@ ContentPrefService.prototype = { }, __stmtSelectGroupID: null, - get _stmtSelectGroupID ContentPrefService_get__stmtSelectGroupID() { + get _stmtSelectGroupID() { if (!this.__stmtSelectGroupID) this.__stmtSelectGroupID = this._dbCreateStatement( "SELECT groups.id AS id " + @@ -509,7 +509,7 @@ ContentPrefService.prototype = { }, __stmtInsertGroup: null, - get _stmtInsertGroup ContentPrefService_get__stmtInsertGroup() { + get _stmtInsertGroup() { if (!this.__stmtInsertGroup) this.__stmtInsertGroup = this._dbCreateStatement( "INSERT INTO groups (name) VALUES (:name)" @@ -525,7 +525,7 @@ ContentPrefService.prototype = { }, __stmtSelectSettingID: null, - get _stmtSelectSettingID ContentPrefService_get__stmtSelectSettingID() { + get _stmtSelectSettingID() { if (!this.__stmtSelectSettingID) this.__stmtSelectSettingID = this._dbCreateStatement( "SELECT id FROM settings WHERE name = :name" @@ -551,7 +551,7 @@ ContentPrefService.prototype = { }, __stmtInsertSetting: null, - get _stmtInsertSetting ContentPrefService_get__stmtInsertSetting() { + get _stmtInsertSetting() { if (!this.__stmtInsertSetting) this.__stmtInsertSetting = this._dbCreateStatement( "INSERT INTO settings (name) VALUES (:name)" @@ -567,7 +567,7 @@ ContentPrefService.prototype = { }, __stmtSelectPrefID: null, - get _stmtSelectPrefID ContentPrefService_get__stmtSelectPrefID() { + get _stmtSelectPrefID() { if (!this.__stmtSelectPrefID) this.__stmtSelectPrefID = this._dbCreateStatement( "SELECT id FROM prefs WHERE groupID = :groupID AND settingID = :settingID" @@ -594,7 +594,7 @@ ContentPrefService.prototype = { }, __stmtSelectGlobalPrefID: null, - get _stmtSelectGlobalPrefID ContentPrefService_get__stmtSelectGlobalPrefID() { + get _stmtSelectGlobalPrefID() { if (!this.__stmtSelectGlobalPrefID) this.__stmtSelectGlobalPrefID = this._dbCreateStatement( "SELECT id FROM prefs WHERE groupID IS NULL AND settingID = :settingID" @@ -620,7 +620,7 @@ ContentPrefService.prototype = { }, __stmtInsertPref: null, - get _stmtInsertPref ContentPrefService_get__stmtInsertPref() { + get _stmtInsertPref() { if (!this.__stmtInsertPref) this.__stmtInsertPref = this._dbCreateStatement( "INSERT INTO prefs (groupID, settingID, value) " + @@ -639,7 +639,7 @@ ContentPrefService.prototype = { }, __stmtUpdatePref: null, - get _stmtUpdatePref ContentPrefService_get__stmtUpdatePref() { + get _stmtUpdatePref() { if (!this.__stmtUpdatePref) this.__stmtUpdatePref = this._dbCreateStatement( "UPDATE prefs SET value = :value WHERE id = :id" @@ -655,7 +655,7 @@ ContentPrefService.prototype = { }, __stmtDeletePref: null, - get _stmtDeletePref ContentPrefService_get__stmtDeletePref() { + get _stmtDeletePref() { if (!this.__stmtDeletePref) this.__stmtDeletePref = this._dbCreateStatement( "DELETE FROM prefs WHERE id = :id" @@ -670,7 +670,7 @@ ContentPrefService.prototype = { }, __stmtDeleteSettingIfUnused: null, - get _stmtDeleteSettingIfUnused ContentPrefService_get__stmtDeleteSettingIfUnused() { + get _stmtDeleteSettingIfUnused() { if (!this.__stmtDeleteSettingIfUnused) this.__stmtDeleteSettingIfUnused = this._dbCreateStatement( "DELETE FROM settings WHERE id = :id " + @@ -686,7 +686,7 @@ ContentPrefService.prototype = { }, __stmtDeleteGroupIfUnused: null, - get _stmtDeleteGroupIfUnused ContentPrefService_get__stmtDeleteGroupIfUnused() { + get _stmtDeleteGroupIfUnused() { if (!this.__stmtDeleteGroupIfUnused) this.__stmtDeleteGroupIfUnused = this._dbCreateStatement( "DELETE FROM groups WHERE id = :id " + @@ -702,7 +702,7 @@ ContentPrefService.prototype = { }, __stmtSelectPrefs: null, - get _stmtSelectPrefs ContentPrefService_get__stmtSelectPrefs() { + get _stmtSelectPrefs() { if (!this.__stmtSelectPrefs) this.__stmtSelectPrefs = this._dbCreateStatement( "SELECT settings.name AS name, prefs.value AS value " + @@ -734,7 +734,7 @@ ContentPrefService.prototype = { }, __stmtSelectGlobalPrefs: null, - get _stmtSelectGlobalPrefs ContentPrefService_get__stmtSelectGlobalPrefs() { + get _stmtSelectGlobalPrefs() { if (!this.__stmtSelectGlobalPrefs) this.__stmtSelectGlobalPrefs = this._dbCreateStatement( "SELECT settings.name AS name, prefs.value AS value " + @@ -763,7 +763,7 @@ ContentPrefService.prototype = { }, __stmtSelectPrefsByName: null, - get _stmtSelectPrefsByName ContentPrefService_get__stmtSelectPrefsByName() { + get _stmtSelectPrefsByName() { if (!this.__stmtSelectPrefsByName) this.__stmtSelectPrefsByName = this._dbCreateStatement( "SELECT groups.name AS groupName, prefs.value AS value " + diff --git a/toolkit/content/viewZoomOverlay.js b/toolkit/content/viewZoomOverlay.js index dca8d2ad1fb..f95c5458f8a 100644 --- a/toolkit/content/viewZoomOverlay.js +++ b/toolkit/content/viewZoomOverlay.js @@ -47,32 +47,32 @@ **/ var ZoomManager = { - get _prefBranch ZoomManager_get__prefBranch() { + get _prefBranch() { delete this._prefBranch; return this._prefBranch = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); }, - get MIN ZoomManager_get_MIN() { + get MIN() { delete this.MIN; return this.MIN = this._prefBranch.getIntPref("zoom.minPercent") / 100; }, - get MAX ZoomManager_get_MAX() { + get MAX() { delete this.MAX; return this.MAX = this._prefBranch.getIntPref("zoom.maxPercent") / 100; }, - get useFullZoom ZoomManager_get_useFullZoom() { + get useFullZoom() { return this._prefBranch.getBoolPref("browser.zoom.full"); }, - set useFullZoom ZoomManager_set_useFullZoom(aVal) { + set useFullZoom(aVal) { this._prefBranch.setBoolPref("browser.zoom.full", aVal); return aVal; }, - get zoom ZoomManager_get_zoom() { + get zoom() { return this.getZoomForBrowser(getBrowser()); }, @@ -83,7 +83,7 @@ var ZoomManager = { : markupDocumentViewer.textZoom; }, - set zoom ZoomManager_set_zoom(aVal) { + set zoom(aVal) { this.setZoomForBrowser(getBrowser(), aVal); return aVal; }, @@ -103,7 +103,7 @@ var ZoomManager = { } }, - get zoomValues ZoomManager_get_zoomValues() { + get zoomValues() { var zoomValues = this._prefBranch.getCharPref("toolkit.zoomManager.zoomValues") .split(",").map(parseFloat); zoomValues.sort(function (a, b) a - b); @@ -152,4 +152,4 @@ var ZoomManager = { } return values[i - 1]; } -} +};