mozIJSSubScriptLoader

Table of contents

  1. 1. Method overview
  2. 2. Methods
    1. 2.1. loadSubScript()
Table of contents
  1. 1. Method overview
  2. 2. Methods
    1. 2.1. loadSubScript()

This interface can be used from privileged JavaScript to load and run JavaScript code from the given URL at runtime.
1.0
15.0
Inherits from: nsISupports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)

Implemented by: @mozilla.org/moz/jssubscript-loader;1. To get this service, use:

var mozIJSSubScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
                            .getService(Components.interfaces.mozIJSSubScriptLoader);
Note: See Components.utils.import for another way to import JavaScript code.

Method overview

void loadSubScript(in wstring url, in targetObj Optional , in charset Optional );

Methods

loadSubScript()

Synchronously loads and executes the script from the specified URL. As of Gecko 8.0, scripts are loaded from the startup cache where possible.

The specified script is executed with the principal associated with the target object.

Note: This method must only be called from JavaScript!

void loadSubScript(
  in wstring url,
  in targetObj Optional
,
  in charset   Optional
, Requires Gecko 2.0

);
Parameters
url
The URL pointing to the script to load. It must be a local chrome:, resource: or file: URL (see bug 307686 and bug 418356 ).

Gecko 1.9 note
(Firefox 3)

In versions of Firefox prior to 3.0, you could use data: URLs as well, but this introduced security concerns, and is no longer permitted.

targetObj
The object to use as the scope object for the script being executed. It defaults to the global object of the caller.
charset Requires Gecko 2.0
An optional string to specify the character encoding of the file. If absent, the file is interpreted as ASCII.

Tags (7)

Edit tags

Attachments (0)

 

Attach file