зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1086527
- Make sure PluralForm.get can be called from strict mode. r=Mossop
This commit is contained in:
Родитель
392ff86c25
Коммит
eea1f5cc9b
|
@ -135,7 +135,7 @@ this.PluralForm = {
|
|||
// Check for array out of bounds or empty strings
|
||||
if ((ret == undefined) || (ret == "")) {
|
||||
// Report the caller to help figure out who is causing badness
|
||||
let caller = PluralForm.get.caller ? PluralForm.get.caller.name : "top";
|
||||
let caller = Components.stack.caller ? Components.stack.caller.name : "top";
|
||||
|
||||
// Display a message in the error console
|
||||
log(["Index #", index, " of '", aWords, "' for value ", aNum,
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/* 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/. */
|
||||
|
||||
/**
|
||||
* This unit test makes sure that PluralForm.get can be called from strict mode
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
delete PluralForm.numForms;
|
||||
delete PluralForm.get;
|
||||
[PluralForm.get, PluralForm.numForms] = PluralForm.makeGetter(9);
|
||||
|
||||
function run_test() {
|
||||
"use strict";
|
||||
|
||||
do_check_eq(3, PluralForm.numForms());
|
||||
do_check_eq("one", PluralForm.get(5, 'one;many'));
|
||||
}
|
|
@ -13,6 +13,7 @@ skip-if = toolkit == "windows" || toolkit == "cocoa"
|
|||
[test_collation_mac_icu.js]
|
||||
run-if = toolkit == "cocoa"
|
||||
|
||||
[test_bug1086527.js]
|
||||
[test_pluralForm.js]
|
||||
[test_pluralForm_english.js]
|
||||
[test_pluralForm_makeGetter.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче