Clear History Box - Opens Incorrectly

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
fatboy
Astronaut
Astronaut
Posts: 558
Joined: 2017-12-19, 08:03
Location: Canada

Clear History Box - Opens Incorrectly

Unread post by fatboy » 2020-04-06, 09:37

Good Day,

I have reported this same error with Basilisk, but encountered it today on Palemoon 28.9.0.2 for Linux (PCLINUXOS). I have attached some screenshots and error console output:
Palemoon_Clear_History_ERror.png
Palemoon_Clear_History_Error_Console.png
Palemoon_Clear_History_Error_Console_Messages.png

Code: Select all

    menu.appendChild(popup.cloneNode(true));
  }
}
function stitch_context_menu2() {
  // the same menu appears both under Tools and via the toolbar button:
  var menu = document.getElementById("https-always-menu2");
  if (!menu.firstChild) {
    var popup = document.getElementById("https-always-context");
    menu.appendChild(popup.cloneNode(true));
  }
}

function show_applicable_list(menupopup) {
  var browser = httpsAlways.toolbarButton.selectedBrowser();
  if (!browser) {
    HTTPSAlways.log(WARN, "No browser for applicable list");
    return;
  }

  var alist = HTTPSAlways.getExpando(browser,"applicable_rules");
  var weird=false;

  if (!alist) {
    // This case occurs for error pages and similar.  We need a dummy alist
    // because populate_menu lives in there.  Would be good to refactor this
    // away.
    alist = new HTTPSAlways.ApplicableList(HTTPSAlways.log, browser.currentURI);
    weird = true;
  }
  alist.populate_menu(document, menupopup, weird);
}

function toggle_rule(rule_id) {
  // toggle the rule state
  HTTPSAlways.https_rules.rulesetsByID[rule_id].toggle();
  reload_window();
}

function reload_window() {
  var browser = httpsAlways.toolbarButton.selectedBrowser();
  if (browser) {
    browser.reload();
  }
}

function toggleEnabledState(){
  HTTPSAlways.toggleEnabledState();
  reload_window();
  toggleEnabledUI();
}

function toggleEnabledUI() {
  // Add/remove menu items depending on whether HTTPS-E is enabled
  var items = document.querySelectorAll(".hide-on-disable");
  var enabled = HTTPSAlways.prefs.getBoolPref("globalEnabled");
  for (let i = 0; i < items.length; i++) {
    items[i].hidden = !enabled;
  }

  httpsAlways.toolbarButton.updateIconState();
}

function open_in_tab(url) {
  let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
  browserWindow.gBrowser.addTab(url, {
          triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
        });
}

function httpse_chrome_opener(url, prefs) {
  HTTPSAlways.chrome_opener(url, prefs);
}

// hook event for showing hint
HTTPSAlways.log(DBUG, 'Adding listener for toolbarButton init.');
window.addEventListener("load", httpsAlways.toolbarButton.init, false);

function migratePreferences(gBrowser) {
  gBrowser.removeEventListener("DOMContentLoaded", migratePreferences, true);
  let prefs_version = HTTPSAlways.prefs.getIntPref("prefs_version");

  // first migration loses saved prefs
  if(prefs_version == 0) {
    try {
      // upgrades will have old rules as preferences, such as the EFF rule
      let upgrade = false;
      let childList = HTTPSAlways.prefs.getChildList("", {});
      for(let i=0; i<childList.length; i++) {
        if(childList[i] == 'EFF') {
          upgrade = true;
          break;
        }
      }

      if(upgrade) {
        let nBox = gBrowser.getNotificationBox();
        let strings = document.getElementById('HttpsAlwaysStrings');
        let msg = strings.getString('https-always.migration.notification0');
        nBox.appendNotification(
          msg, 
          'https-always-migration0', 
          'chrome://https-always/skin/icon-active-24.png', 
          nBox.PRIORITY_WARNING_MEDIUM
        );
      }
    } catch(e) {
      HTTPSAlways.log(WARN, "Migration from prefs_version 0 error: "+e);
    }

    HTTPSAlways.prefs.setIntPref("prefs_version", prefs_version+1);
  }
}
You do not have the required permissions to view the files attached to this post.
Systemd Free - MX Linux, Antix Linux & Artix Linux

User avatar
adesh
Board Warrior
Board Warrior
Posts: 1277
Joined: 2017-06-06, 07:38

Re: Clear History Box - Opens Incorrectly

Unread post by adesh » 2020-04-06, 10:11

From the error screenshot it seems the problem is with HTTPS Always extension. If you click on the error, you will be taken to the exact code location where the error occurs. Then you can fix it.