moderate annoyance - browser.xml is causing javascript warnings in the browser console

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.
thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

moderate annoyance - browser.xml is causing javascript warnings in the browser console

Unread post by thosrtanner » 2018-10-20, 08:33

This bit:

Code: Select all

      <method name="getTabBrowser">
        <body>
          <![CDATA[
            var tabBrowser = this.parentNode;
            while (tabBrowser && tabBrowser.localName != "tabbrowser")
              tabBrowser = tabBrowser.parentNode;
            return tabBrowser;
          ]]>
        </body>
      </method>
produces this message in the browser console:
ReferenceError: reference to undefined property "localName"[Learn More]
Admittedly there are worse offenders (like pretty much every version of jquery, including the one on this forum page) but every little helps
Last edited by thosrtanner on 2018-10-20, 08:34, edited 1 time in total.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: moderate annoyance - browser.xml is causing javascript warnings in the browser console

Unread post by Moonchild » 2018-10-20, 17:03

Where exactly is this browser.xml located that you're referring to?
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

thosrtanner
Lunatic
Lunatic
Posts: 395
Joined: 2014-05-10, 18:19
Location: UK

Re: moderate annoyance - browser.xml is causing javascript warnings in the browser console

Unread post by thosrtanner » 2018-10-20, 17:55

"omni.ja!/chrome/toolkit/content/global/bindings/browser.xml" (with apologies for any typos in retyping that from the title bar of the popup window)


User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: moderate annoyance - browser.xml is causing javascript warnings in the browser console

Unread post by Moonchild » 2018-10-20, 21:51

Right.

Not exactly sure why that code tries to access and walk the DOM tree directly to get the tabBrowser, that's a little hacky.

We probably want something like:

Code: Select all

      <method name="getTabBrowser">
        <body>
          <![CDATA[
            if (this.ownerGlobal.gBrowser &&
                this.ownerGlobal.gBrowser.getTabForBrowser &&
                this.ownerGlobal.gBrowser.getTabForBrowser(this)) {
              return this.ownerGlobal.gBrowser;
            }
            return null;
          ]]>
        </body>
      </method>
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: moderate annoyance - browser.xml is causing javascript warnings in the browser console

Unread post by Moonchild » 2018-10-20, 22:07

Focusing on just the reference errors though, the following should fix those:
https://github.com/MoonchildProductions ... bce0a901fb
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked