зеркало из https://github.com/mozilla/pjs.git
b=391557. p=johnmarsh. r=mfinkle, dietrich. a=mconnor. change Annotation.get to return null instead of throwing exceptions (whitespace cleanup too)
This commit is contained in:
Родитель
d559b5836e
Коммит
59858c85ee
|
@ -801,7 +801,9 @@ Annotations.prototype = {
|
|||
},
|
||||
|
||||
get : function(aName) {
|
||||
return Utilities.annotations.getItemAnnotation(this._id, aName);
|
||||
if (this.has(aName))
|
||||
return Utilities.annotations.getItemAnnotation(this._id, aName);
|
||||
return null;
|
||||
},
|
||||
|
||||
set : function(aName, aValue, aExpiration) {
|
||||
|
|
|
@ -85,6 +85,7 @@ function test() {
|
|||
testBookmark.annotations.remove("testing/bookmark");
|
||||
ok(!testBookmark.annotations.has("testing/bookmark"), "Checking existence of removed annotation");
|
||||
is(gLastBookmarkAction, "testing/bookmark", "Check event handler for removing annotation");
|
||||
is(testBookmark.annotations.get("testing/bookmark"), null, "Check existence of a missing annotation");
|
||||
|
||||
// quick annotation type tests
|
||||
testBookmark.annotations.set("testing/bookmark/string", "annotate-this", 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче