mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 407821 - Discard bookmark tags exceeding maximum length of 100 characters. r=paolo
This commit is contained in:
parent
d693bf1ed2
commit
ea9fb10a76
@ -149,7 +149,9 @@
|
||||
tabscrolling="true"
|
||||
showcommentcolumn="true"
|
||||
observes="paneElementsBroadcaster"
|
||||
placeholder="&editBookmarkOverlay.tagsEmptyDesc.label;"/>
|
||||
placeholder="&editBookmarkOverlay.tagsEmptyDesc.label;"
|
||||
maxlength="1000"
|
||||
/>
|
||||
<button id="editBMPanel_tagsSelectorExpander"
|
||||
class="expander-down"
|
||||
tooltiptext="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
||||
|
@ -8,9 +8,16 @@
|
||||
interface nsIURI;
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, uuid(f816b4df-f733-4dbd-964d-8bfc92a475b2)]
|
||||
[scriptable, uuid(9759bd0e-78e2-4421-9ed1-c676e1af3513)]
|
||||
interface nsITaggingService : nsISupports
|
||||
{
|
||||
|
||||
/**
|
||||
* Defines the maximal length of a tag. Related to the bug 407821
|
||||
* (https://bugzilla.mozilla.org/show_bug.cgi?id=407821)
|
||||
*/
|
||||
const unsigned long MAX_TAG_LENGTH = 100;
|
||||
|
||||
/**
|
||||
* Tags a URL with the given set of tags. Current tags set for the URL
|
||||
* persist. Tags in aTags which are already set for the given URL are
|
||||
|
@ -115,7 +115,7 @@ TaggingService.prototype = {
|
||||
// want to change it.
|
||||
tag.__defineGetter__("name", function () this._self._tagFolders[this.id]);
|
||||
}
|
||||
else if (typeof(val) == "string" && val.length > 0) {
|
||||
else if (typeof(val) == "string" && val.length > 0 && val.length <= Ci.nsITaggingService.MAX_TAG_LENGTH) {
|
||||
// This is a tag name.
|
||||
tag.name = val;
|
||||
// We can't know the id at this point, since a previous tag could
|
||||
|
@ -156,6 +156,22 @@ function run_test() {
|
||||
} catch (ex) {
|
||||
do_check_eq(ex.name, "NS_ERROR_ILLEGAL_VALUE");
|
||||
}
|
||||
|
||||
// Tag name length should be limited to nsITaggingService.MAX_TAG_LENGTH (bug407821)
|
||||
try {
|
||||
|
||||
// generate a long tag name. i.e. looooo...oong_tag
|
||||
var n = Ci.nsITaggingService.MAX_TAG_LENGTH;
|
||||
var someOos = new Array(n).join('o');
|
||||
var longTagName = "l" + someOos + "ng_tag";
|
||||
|
||||
tagssvc.tagURI(uri1, ["short_tag", longTagName]);
|
||||
do_throw("Passing a bad tags array should throw");
|
||||
|
||||
} catch (ex) {
|
||||
do_check_eq(ex.name, "NS_ERROR_ILLEGAL_VALUE");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user