Ask me anything!

Have a question you always wanted to ask Moonchild but never did? Now's your chance!
From 2026-03-08 to 2026-03-15 I'll be open to any question by the community, after which I'll provide answers.

Go here to participate: https://forum.palemoon.org/viewtopic.php?f=66&t=33222

Changes in 25.5 for extension authors and web developers

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
Moonchild
Project founder
Project founder
Posts: 38938
Joined: 2011-08-28, 17:27
Location: Sweden

Changes in 25.5 for extension authors and web developers

Post by Moonchild » 2015-06-09, 10:57

Pale Moon 25.5 includes a few changes that are important for extension authors and web developers:
  • Pale Moon 25.5 offers loading of javascript modules into a specific scope with importRelative()

    importRelative()
    Imports a JavaScript code module given the calling JavaScript code module's global object (you should specify this) and a path relative to that module. This lets modules bundled in a package load one another without having to hard-code full paths.

    Code: Select all

    void importRelative(that,path[,scope]);
    Parameters
    that
    The JavaScript Object of the calling JavaScript code module's global scope. You should simply pass this.
    path
    The relative path of the JavaScript code module to import.
    scope (optional, new in 25.5)
    An optional object to import into; if omitted, the object passed in for the that parameter is used.

    Remarks
    This lets an extension bundle its own JavaScript code modules within itself and have them load one another. For example, if an extension named "MyExtension" bundles foo.jsm and bar.jsm, and foo.jsm needs to load bar.jsm, it can do so like this:

    Code: Select all

    Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
    XPCOMUtils.importRelative(this, "bar.jsm");
    In other words: importRelative will only work from other code modules (such as JSM files). It will NOT work from overlay scripts or bootstrap.js or etc.
     
  • Pale Moon 25.5 removes access from web pages to the following internal classes and interfaces from the global window object:

    BoxObject, Contact, Contactmanager, Counter, CryptoDialogs, CSSUnknownRule, DataErrorEvent, DocumentTouch, DocumentXBL, ElementCSSInlineStyle, EventListener, FontFace, FontFaceList, GeoGeolocation, GeoPosition, GeoPositionCallback, GeoPositionCoords, GeoPositionErrorCallback, GetUserMediaErrorCallback, GetUserMediaSuccessCallback, GlobalObjectConstructor, GlobalPropertyInitializer, HTMLByteRanges, ImageDocument, JSWindow, LinkStyle, MediaQueryListListener, MozAlarmsManager, MozBrowserFrame, MozWakeLockListener, NSEditableElement, NSEvent, NSXPathExpression, Parser, ParserJS, PermissionSettings, Pkcs11, PushManager, RequestService, Serializer, StorageIndexedDB, StorageManager, ToString, TreeColumn, TreeColumns, TreeContentView, TreeSelection, WindowCollection, WindowInternal, WindowPerformance, XULContainerElement, XULContainerItemElement, XULDescriptionElement, XULImageElement, XULLabelElement, XULMenuListElement, XULMultiSelectControlElement, XULRelatedElement, XULSelectControlElement, XULSelectControlItemElement, XULTemplateBuilder, XULTextBoxElement, XULTreeBuilder, and XULTreeElement.

    Please note that this only applies to web page content - extensions and scripts running in the chrome context will still have access to these.
"There is no point in arguing with an idiot, because then you're both idiots." - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite