Changes in 25.5 for extension authors and web developers

Talk about code development, features, specific bugzilla bugs, enhancements, patches, and other highly technical 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 referenced Bugzilla bugs, mercurial, 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. Most "bug reports" do not belong in this board and should initially be posted in Community Support or other relevant support boards.

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
Pale Moon guru
Pale Moon guru
Posts: 29658
Joined: 2011-08-28, 17:27
Location: Tranås, SE

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()

    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]);
    The JavaScript Object of the calling JavaScript code module's global scope. You should simply pass this.
    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.

    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

    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.
"Son, in life you do not fight battles because you expect to win, you fight them merely because they need to be fought." -- Snagglepuss