count += needed[id];
html += '<tr>' +
'<td>' + needed[id] + ' x </td>' +
- '<td>' + YAHOO.lang.escapeHTML(item.name) + '</td>' +
+ '<td>' + item.name.htmlEncode() + '</td>' +
'<td><button onclick="removeGear(\'' + id + '\');return false">Remove</button></td>' +
'</tr>';
text += needed[id] + ' x ' + id + ' ' + item.name + "\n";
count += item.quantity;
html += '<tr>' +
'<td>' + item.quantity + ' x </td>' +
- '<td>(' + item.type + ') ' + YAHOO.lang.escapeHTML(item.name) + '</td>' +
+ '<td>(' + item.type + ') ' + item.name.htmlEncode() + '</td>' +
'<td><button onclick="removeFreeform(\'' + i + '\');return false">Remove</button></td>' +
'</tr>';
text += item.quantity + ' x (' + item.type + ') ' + item.name + "\n";
this.parent_el = YAHOO.util.Dom.get(parent_el);
this.table_data = table_data;
this.field_count = table_data.fields.length;
- if (!JSON) JSON = YAHOO.lang.JSON;
this.render = function() {
// create table
// display the product name
Dom.get('product').value = productName;
- Dom.get('product_label').innerHTML = YAHOO.lang.escapeHTML(productName);
- Dom.get('dupes_product_name').innerHTML = YAHOO.lang.escapeHTML(productName);
+ Dom.get('product_label').innerHTML = productName.htmlEncode();
+ Dom.get('dupes_product_name').innerHTML = productName.htmlEncode();
Dom.get('list_comp').href = `${BUGZILLA.config.basepath}describecomponents.cgi?` +
`product=${encodeURIComponent(productName)}`;
guided.setAdvancedLink();
{
success: function(res) {
try {
- var data = YAHOO.lang.JSON.parse(res.responseText);
+ var data = JSON.parse(res.responseText);
if (data.error)
throw(data.error.message);
if (data.result.products.length == 0)
}
}
},
- YAHOO.lang.JSON.stringify({
+ JSON.stringify({
version: "1.1",
method: "Product.get",
id: ++this._counter,
`${BUGZILLA.config.basepath}jsonrpc.cgi`,
{
success: function(res) {
- var data = YAHOO.lang.JSON.parse(res.responseText);
+ var data = JSON.parse(res.responseText);
if (data.error)
throw(data.error.message);
dupes._buildCcHTML(el, bugID, bugStatus, follow);
alert("Update failed:\n\n" + res.responseText);
}
},
- YAHOO.lang.JSON.stringify({
+ JSON.stringify({
version: "1.1",
method: "Bug.update",
id: ++this._counter,
_onSummaryKeyUp: function(e) {
// disable search button until there's a query
- dupes._elSearch.disabled = YAHOO.lang.trim(dupes._elSummary.value) == '';
+ dupes._elSearch.disabled = dupes._elSummary.value.trim() == '';
},
_doSearch: function() {
};
dupes._dataTable.getDataSource().sendRequest(
- YAHOO.lang.JSON.stringify(json_object),
+ JSON.stringify(json_object),
{
success: dupes._onDupeResults,
failure: dupes._onDupeResults,
},
getSummary: function() {
- var summary = YAHOO.lang.trim(this._elSummary.value);
+ var summary = this._elSummary.value.trim();
// work around chrome bug
if (summary == dupes._elSummary.getAttribute('placeholder')) {
return '';
YUI({
base: 'js/yui3/',
combine: false
- }).use("node", "datatable", "datatable-sort", "json-stringify", "escape",
+ }).use("node", "datatable", "datatable-sort",
"datatable-datasource", "datasource-io", "datasource-jsonschema", function(Y) {
// Common
var counter = 0;
}
};
- var stringified = Y.JSON.stringify(json_object);
+ var stringified = JSON.stringify(json_object);
Y.one('#' + type + '_loading').removeClass('bz_default_hidden');
Y.one('#' + type + '_count_refresh').addClass('bz_default_hidden');
};
var updatedFormatter = function(o) {
- return '<span title="' + Y.Escape.html(o.value) + '">' +
- Y.Escape.html(o.data.updated_fancy) + '</span>';
+ return '<span title="' + o.value.htmlEncode() + '">' +
+ o.data.updated_fancy.htmlEncode() + '</span>';
};
var requesteeFormatter = function(o) {
return o.value
- ? Y.Escape.html(o.value)
+ ? o.value.htmlEncode()
: '<i>anyone</i>';
};
'bug=' + encodeURIComponent(o.data.bug_id) +
'&attachment=' + encodeURIComponent(o.data.attach_id) +
'" target="_blank" title="Review this patch">' +
- Y.Escape.html(o.value) + '</a>';
+ o.value.htmlEncode() + '</a>';
}
else {
- return Y.Escape.html(o.value);
+ return o.value.htmlEncode();
}
};
dataSource.requestee = new Y.DataSource.IO({ source: `${BUGZILLA.config.basepath}jsonrpc.cgi` });
dataSource.requestee.on('error', function(e) {
try {
- var response = Y.JSON.parse(e.data.responseText);
+ var response = JSON.parse(e.data.responseText);
if (response.error)
e.error.message = response.error.message;
} catch(ex) {
dataSource.requester = new Y.DataSource.IO({ source: `${BUGZILLA.config.basepath}jsonrpc.cgi` });
dataSource.requester.on('error', function(e) {
try {
- var response = Y.JSON.parse(e.data.responseText);
+ var response = JSON.parse(e.data.responseText);
if (response.error)
e.error.message = response.error.message;
} catch(ex) {
patterns: { 'gallery-': {} }
}
}
- }).use("node", "datatable", "datatable-sort", "datatable-message", "json-stringify",
+ }).use("node", "datatable", "datatable-sort", "datatable-message",
"datatable-datasource", "datasource-io", "datasource-jsonschema", "cookie",
- "gallery-datatable-row-expansion-bmo", "handlebars", "escape", function(Y) {
+ "gallery-datatable-row-expansion-bmo", "handlebars", function(Y) {
var counter = 0,
bugQueryTable = null,
bugQuery = null,
bugQuery.on('error', function(e) {
try {
- var response = Y.JSON.parse(e.data.responseText);
+ var response = JSON.parse(e.data.responseText);
if (response.error)
e.error.message = response.error.message;
} catch(ex) {
};
bugQuery.sendRequest({
- request: Y.JSON.stringify(bugQueryParams),
+ request: JSON.stringify(bugQueryParams),
cfg: {
method: "POST",
headers: { 'Content-Type': 'application/json' }
};
var updatedFormatter = function(o) {
- return '<span title="' + Y.Escape.html(o.value) + '">' +
- Y.Escape.html(o.data.changeddate_fancy) + '</span>';
+ return '<span title="' + o.value.htmlEncode() + '">' +
+ o.data.changeddate_fancy.htmlEncode() + '</span>';
};
lastChangesQuery.on('error', function(e) {
try {
- var response = Y.JSON.parse(e.data.responseText);
+ var response = JSON.parse(e.data.responseText);
if (response.error)
e.error.message = response.error.message;
} catch(ex) {
};
lastChangesQuery.sendRequest({
- request: Y.JSON.stringify(lastChangesParams),
+ request: JSON.stringify(lastChangesParams),
cfg: {
method: "POST",
headers: { 'Content-Type': 'application/json' }
};
flagDS.sendRequest({
- request: Y.JSON.stringify({
+ request: JSON.stringify({
version: '1.1',
method: 'Review.flag_activity',
params: {
function fetch_flags(flag_ids) {
return new Y.Promise(function (resolve, reject) {
flagDS.sendRequest({
- request: Y.JSON.stringify({
+ request: JSON.stringify({
version: '1.1',
method: 'Review.flag_activity',
params: {
}));
bugDS.sendRequest({
- request: Y.JSON.stringify({
+ request: JSON.stringify({
version: '1.1',
method: 'Bug.get',
params: {
}));
attachmentDS.sendRequest({
- request: Y.JSON.stringify({
+ request: JSON.stringify({
version: '1.1',
method: 'Bug.attachments',
params: {
}, '0.0.1', {
requires: [
- "node", "datatype-date", "datatable", "datatable-sort", "datatable-message", "json-stringify",
+ "node", "datatype-date", "datatable", "datatable-sort", "datatable-message",
"datatable-datasource", "datasource-io", "datasource-jsonschema", "cookie",
- "gallery-datatable-row-expansion-bmo", "handlebars", "escape", "promise"
+ "gallery-datatable-row-expansion-bmo", "handlebars", "promise"
]
});
});
if (reviewInfosText == null) {
this._reviewInfos = [];
} else {
- this._reviewInfos = YAHOO.lang.JSON.parse(reviewInfosText);
+ this._reviewInfos = JSON.parse(reviewInfosText);
}
},
}
this._reviewInfos.push(reviewInfo);
- localStorage.splinterReviews = YAHOO.lang.JSON.stringify(this._reviewInfos);
+ localStorage.splinterReviews = JSON.stringify(this._reviewInfos);
},
_deleteReviewInfo : function(bug, attachment) {
var reviewIndex = this._findReview(bug, attachment);
if (reviewIndex >= 0) {
this._reviewInfos.splice(reviewIndex, 1);
- localStorage.splinterReviews = YAHOO.lang.JSON.stringify(this._reviewInfos);
+ localStorage.splinterReviews = JSON.stringify(this._reviewInfos);
}
},
filter_flag_list(Dom.get('filter').checked);
}
else {
- if (!JSON)
- JSON = YAHOO.lang.JSON;
Event.addListener('flag_name', 'change', change_flag_name, Dom.get('flag_name'));
Event.addListener('flag_desc', 'change', change_string_value, Dom.get('flag_desc'));
Event.addListener('flag_type', 'change', change_select_value, Dom.get('flag_type'));
var group = groups[j];
optionEl = document.createElement('option');
optionEl.value = group.id;
- optionEl.innerHTML = YAHOO.lang.escapeHTML(group.name);
+ optionEl.innerHTML = group.name.htmlEncode();
optionEl.selected = group.id == value.setter_group_id;
selectEl.appendChild(optionEl);
}
// utils
function change_string_value(e, o) {
- o.value = YAHOO.lang.trim(o.value);
+ o.value = o.value.trim();
tag_missing_value(o);
}
"update_token" ]
}
};
- var post_data = YAHOO.lang.JSON.stringify(json_object);
+ var post_data = JSON.stringify(json_object);
var callback = {
success: dataTable.onDataReturnInitializeTable,
(function(){
'use strict';
- var JSON = YAHOO.lang.JSON;
YAHOO.bugzilla.bugUserLastVisit = {
update: function(bug_ids) {
var bz_ctag_error = Dom.get('bz_ctag_error');
var tags_container = Dom.get('ct_' + comment_no);
tags_container.parentNode.appendChild(bz_ctag_error, tags_container);
- Dom.get('bz_ctag_error_msg').innerHTML = YAHOO.lang.escapeHTML(error);
+ Dom.get('bz_ctag_error_msg').innerHTML = error.htmlEncode();
Dom.removeClass(bz_ctag_error, 'bz_default_hidden');
},
// add new tags
var new_tags = new Array();
for (var i = 0, l = add_tags.length; i < l; i++) {
- var tag = YAHOO.lang.trim(add_tags[i]);
+ var tag = add_tags[i].trim();
// validation
if (tag == '')
continue;
{
success: function(res) {
YAHOO.bugzilla.commentTagging.decPending(comment_id);
- data = YAHOO.lang.JSON.parse(res.responseText);
+ data = JSON.parse(res.responseText);
if (data.error) {
YAHOO.bugzilla.commentTagging.handleRpcError(
comment_id, comment_no, data.error.message, noRefreshOnError);
comment_id, comment_no, res.responseText, noRefreshOnError);
}
},
- YAHOO.lang.JSON.stringify({
+ JSON.stringify({
version: "1.1",
method: 'Bug.comments',
params: {
{
success: function(res) {
YAHOO.bugzilla.commentTagging.decPending(comment_id);
- data = YAHOO.lang.JSON.parse(res.responseText);
+ data = JSON.parse(res.responseText);
if (data.error) {
YAHOO.bugzilla.commentTagging.handleRpcError(comment_id, comment_no, data.error.message);
return;
YAHOO.bugzilla.commentTagging.handleRpcError(comment_id, comment_no, res.responseText);
}
},
- YAHOO.lang.JSON.stringify({
+ JSON.stringify({
version: "1.1",
method: 'Bug.update_comment_tags',
params: {
// These are checked in the reverse order that they appear on the page,
// so that the one closest to the top of the form will be focused.
- if (attach_data.value && YAHOO.lang.trim(attach_desc.value) == '') {
+ if (attach_data.value && attach_desc.value.trim() == '') {
_errorFor(attach_desc, 'attach_desc');
focus_me = attach_desc;
}
var check_description = status_comment_required[bug_status.value];
- if (check_description && YAHOO.lang.trim(description.value) == '') {
+ if (check_description && description.value.trim() == '') {
_errorFor(description, 'description');
focus_me = description;
}
- if (YAHOO.lang.trim(short_desc.value) == '') {
+ if (short_desc.value.trim() == '') {
_errorFor(short_desc);
focus_me = short_desc;
}
YAHOO.util.Connect.asyncRequest('POST', `${BUGZILLA.config.basepath}jsonrpc.cgi`,
{
success: function(res) {
- data = YAHOO.lang.JSON.parse(res.responseText);
+ data = JSON.parse(res.responseText);
if (data.error) {
Dom.addClass('comment_preview_loading', 'bz_default_hidden');
Dom.removeClass('comment_preview_error', 'bz_default_hidden');
Dom.get('comment_preview_error').innerHTML =
- YAHOO.lang.escapeHTML(data.error.message);
+ data.error.message.htmlEncode();
} else {
document.getElementById('comment_preview_text').innerHTML = data.result.html;
Dom.addClass('comment_preview_loading', 'bz_default_hidden');
Dom.addClass('comment_preview_loading', 'bz_default_hidden');
Dom.removeClass('comment_preview_error', 'bz_default_hidden');
Dom.get('comment_preview_error').innerHTML =
- YAHOO.lang.escapeHTML(res.responseText);
+ res.responseText.htmlEncode();
}
},
- YAHOO.lang.JSON.stringify({
+ JSON.stringify({
version: "1.1",
method: 'Bug.render_comment',
params: {
});
}
-// polyfill .trim
-if (!String.prototype.trim) {
- (function() {
- // Make sure we trim BOM and NBSP
- var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
- String.prototype.trim = function() {
- return this.replace(rtrim, '');
- };
- })();
-}
-
// html encoding
if (!String.prototype.htmlEncode) {
(function() {
}
YAHOO.bugzilla.instantSearch.dataTable.getDataSource().sendRequest(
- YAHOO.lang.JSON.stringify(jsonObject),
+ JSON.stringify(jsonObject),
{
success: YAHOO.bugzilla.instantSearch.onSearchResults,
failure: YAHOO.bugzilla.instantSearch.onSearchResults,
},
getContent: function() {
- var content = YAHOO.lang.trim(this.elContent.value);
+ var content = this.elContent.value.trim();
// work around chrome bug
if (content == YAHOO.bugzilla.instantSearch.elContent.getAttribute('placeholder')) {
return '';
sortOptions: { defaultDir: YAHOO.widget.DataTable.CLASS_DESC, sortFunction:totalNumberSorter }}
];
this.parseString = function(str) {
- return YAHOO.lang.trim(str);
+ return str.trim();
};
this.parseNumber = function(str) {