Fix browser console errors

This commit is contained in:
wuggy 2026-09-19 04:21:19 -07:00
commit f20132edb0
3 changed files with 19 additions and 7 deletions

View file

@ -1731,14 +1731,14 @@ var BookmarkingUI = {
if (this._itemIds.length > 0) { if (this._itemIds.length > 0) {
this.broadcaster.setAttribute("starred", "true"); this.broadcaster.setAttribute("starred", "true");
this.broadcaster.setAttribute("buttontooltiptext", this._starredTooltip); this.broadcaster.setAttribute("buttontooltiptext", this._starredTooltip);
if (this.button.getAttribute("overflowedItem") == "true") { if (this.button && this.button.getAttribute("overflowedItem") == "true") {
this.button.setAttribute("label", this._starButtonOverflowedStarredLabel); this.button.setAttribute("label", this._starButtonOverflowedStarredLabel);
} }
} }
else { else {
this.broadcaster.removeAttribute("starred"); this.broadcaster.removeAttribute("starred");
this.broadcaster.setAttribute("buttontooltiptext", this._unstarredTooltip); this.broadcaster.setAttribute("buttontooltiptext", this._unstarredTooltip);
if (this.button.getAttribute("overflowedItem") == "true") { if (this.button && this.button.getAttribute("overflowedItem") == "true") {
this.button.setAttribute("label", this._starButtonOverflowedLabel); this.button.setAttribute("label", this._starButtonOverflowedLabel);
} }
} }

View file

@ -133,8 +133,12 @@ var AboutHomeListener = {
onUpdate: function(aData) { onUpdate: function(aData) {
let doc = content.document; let doc = content.document;
if (aData.showRestoreLastSession && !PrivateBrowsingUtils.isContentWindowPrivate(content)) if (aData.showRestoreLastSession && !PrivateBrowsingUtils.isContentWindowPrivate(content)) {
doc.getElementById("launcher").setAttribute("session", "true"); let launcher = doc.getElementById("launcher");
if (launcher) {
launcher.setAttribute("session", "true");
}
}
// Inject search engine URL. // Inject search engine URL.
let docElt = doc.documentElement; let docElt = doc.documentElement;

View file

@ -106,9 +106,17 @@ InternalUserscriptsService.prototype = {
// The codec shim is deliberately limited to YouTube. Use the browser's // The codec shim is deliberately limited to YouTube. Use the browser's
// decoder probe rather than guessing from the user's graphics settings. // decoder probe rather than guessing from the user's graphics settings.
if (documentURI && let documentHost = null;
documentURI.host && try {
/(^|\.)youtube(?:-nocookie)?\.com$/i.test(documentURI.host)) { // nsIURI.host is not implemented by hostless URI schemes (about:, data:,
// moz-extension:, and others), so reading it can throw.
if (documentURI) {
documentHost = documentURI.host;
}
} catch (e) {}
if (documentHost &&
/(^|\.)youtube(?:-nocookie)?\.com$/i.test(documentHost)) {
let settings = { let settings = {
hideUnaccelerated: Services.prefs.getBoolPref( hideUnaccelerated: Services.prefs.getBoolPref(
"browser.video.youtube.hide-unaccelerated", true), "browser.video.youtube.hide-unaccelerated", true),