Search completed in 1.28 seconds.
Manifest Files - Archive of obsolete content
rome://browser/content/. The final field is the path where the files are located. This can be either a local file path using a file URL or a JAR archive using a jar URL, which will be described in a moment. You can specify multiple packages by including another line in the manifest file. ...
... located. This can be either a local file path using a file URL or a JAR archive using a jar URL, which will be described in a moment. You can specify multiple packages by including another line in the manifest file. The browser.manifest file used by Firefox looks like this: content branding jar:browser.jar!/content/branding/
xpcnativewrappers=yes content browser jar:browser.jar!/content/browser/
xpcnativewrappers=yes overlay chrome://global/content/viewSource.xul chrome://browser/content/viewSourceOverlay.xul overlay chrome://global/content/viewPartialSource.xul chrome://browser/content/viewSourceOverlay.xul overlay chrome://browser/content/pageInfo.xul chrome://pippki/content/PageInfoOverlay.xul Two packages are listed here, 'branding' and 'browser'. Three overlays are also specified, which allow conte...
...e same archive. For the 'tests' package created above, the files are not packaged into an archive, so a direct file path is used instead. This is good for development since you don't have to package up all the files every time you change them. However, when distributing an application or extension, you will want to package them into an archive to avoid having to install lots of smaller files. The
xpcnativewrappers=yes part at the end of the manifest line is a flag that may optionally be used. In JavaScript, it is possible for a web page to override built-in functions with their own code. If the
xpcnativewrappers flag is specified, it indicates that scripts running in a privileged context don't call these overridden versions, but the original built-in versions instead. Otherwise, if an extension attempted ...
...ut the original built-in versions instead. Otherwise, if an extension attempted to call the modified versions, it would likely not work properly, or worse, create a security hole. This flag was added to prevent this problem and should always be used for newer extensions, but is left out for older extensions that might not be compatible with the change. For more information about this feature, see
XPCNativeWrapper. Themes and Locales The themes and locales, the syntax is similar as for content packages, but you also need to specify the content package you are providing a theme or locale for. For example: skin browser classic/1.0 jar:classic.jar!/skin/classic/browser/ locale browser en-US jar:en-US.jar!/locale/browser/ For these, the extra field has been added to indicate that the skin and locale applies t...
Appendix D: Loading Scripts - Archive of obsolete content
e properties defined by scripts executing on the page // available to your sandbox script, use content.wrappedJSObject // instead. let context = content; // Create the Sandbox let sandbox = Components.utils.Sandbox(context, { // Make properties of the context object available via the // script's global scope sandboxPrototype: context, // Wrap objects retrieved from the sandbox in
XPCNativeWrappers. // This is the default action. wantXrays: true }); // The script that will be executed: let script = String(); // Evaluate the script: Components.utils.evalInSandbox(script, sandbox, // The JavaScript version "1.8", // The apparent script filename: "zz-9://plural...
... 42); The following code will execute a simple script loaded from a local file in the same directory as the current script. The script will execute in the same security context as the current script and will have access to the same globals, but any new globals it creates will be accessible only to the script itself. Objects passed out of the sandbox will not be wrapped in
XPCNativeWrappers but will still be wrapped in inter-compartment proxies. const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest", "open"); function loadScript(name, context) { // Create the Sandbox let sandbox = Components.utils.Sandbox(context, { sand...
...* The script's encoding */); The following code will execute a simple script loaded from a local file in the same directory as the current script. The script will execute in the same security context as the current script and will have access to the same globals, but any new globals it creates will be accessible only to the script itself. Objects passed out of the sandbox will not be wrapped in
XPCNativeWrappers but will still be wrapped in inter-compartment proxies. function loadScript(name, context) { // Create the Sandbox let sandbox = Components.utils.Sandbox(context, { sandboxPrototype: context, wantXrays: false }); // Get the caller's filename let file = Components.caller.stack.filename; // Strip off any prefixes added by the sub-script loader // and t...
Chrome registration
component can only be loaded in the main process. Note: Extensions can't currently (bug 1131065) register components to load in the content process using the manifest file so this flag is largely useless to extension developers. component {09543782-22b1-4a0b-ba07-9134365776ee} maincomponent.js process=main component {98309951-ac89-4642-afea-7b2b6216bcef} contentcomponent.js process=content
xpcnativewrappers Chrome packages can decide whether to use the
XPCNativeWrapper security mechanism to automatically protect their code against malicious content that they might access. See Safely accessing content DOM from chrome for details. This flag is enabled by default since Firefox 1.5. Disabling it manually was possible by specifying
xpcnativewrappers=no until Firefox 4. Note: Support for this flag ha...
...iveWrapper security mechanism to automatically protect their code against malicious content that they might access. See Safely accessing content DOM from chrome for details. This flag is enabled by default since Firefox 1.5. Disabling it manually was possible by specifying
xpcnativewrappers=no until Firefox 4. Note: Support for this flag has been removed in Gecko 2.0. You can no longer disable
XPCNativeWrappers. To update your add-on to work without this flag: If your add-on depends upon XBL bindings attached to content objects (that is, it needs to be able to call functions or get and set properties created by the XBL binding), you'll need to use the object's wrappedJSObject property to obtain a wrapped object. If you need to call functions or access properties defined by the content -- for exampl...
...nt objects (that is, it needs to be able to call functions or get and set properties created by the XBL binding), you'll need to use the object's wrappedJSObject property to obtain a wrapped object. If you need to call functions or access properties defined by the content -- for example, if your add-on wants to add a button to the page that calls a JavaScript function defined by the page. The
xpcnativewrappers flag applies only to content packages; it is not recognized for locale or skin registration. Example chrome manifest content necko jar:comm.jar!/content/necko/ locale necko en-US jar:en-US.jar!/locale/necko/ content xbl-marquee jar:comm.jar!/content/xbl-marquee/ content pipnss jar:pipnss.jar!/content/pipnss/ lo...
XPCOM changes in Gecko 2.0
the Extension Manager and perform the necessary installing, uninstalling, and updating of any installed extensions. Once that's done, the extensions can then be loaded by simply reading their manifests, loading their components, and continuing the startup process, all without having to restart the browser. Electrolysis content processes can simply read the component registrations during startup.
XPCNativeWrapper changes You can't disable
XPCNativeWrappers from your manifest Specifying
xpcnativewrappers=no in your manifest (that is,
XPCNativeWrapper automation) is no longer supported. This was always intended to be a short-term workaround to allow extensions to continue to work while their authors updated their code to use
XPCNativeWrappers. If your add-on depends upon XBL bindings attached to content obj...
...If you need to be able to call functions or access properties defined by web content, you'll need to do this as well. ...
...nctions or access properties defined by web content, you'll need to do this as well. This may be the case if, for example, you've written an extension that adds a delete button to a web mail service, and the service defines a window.delete() function that you need to call. If, on the other hand, all you're doing with content is accessing DOM methods and properties, you've never needed to be using
xpcnativewrappers=no in the first place, and should simply remove it from your manifest. Miscellaneous
XPCNativeWrapper changes Using the delete operator on "expando" properties of an
XPCNativeWrapper no longer throws a security exception. XPCOMUtils.jsm changes The XPCOMUtils.jsm code module has been updated to let you specify the application IDs of the applications you wish to register your component in. XPCO...
nsIXPConnect
the computation (including exceptions) will be coerced into strings created in the sandbox. Return value The result of the evaluation as a jsval. If the caller intends to use the return value from this call, the caller is responsible for rooting the jsval before making a call to this method. Exceptions thrown Missing Exception Missing Description flagSystemFilenamePrefix() Preconfigure
XPCNativeWrapper automation so that when a scripted caller whose filename starts with filenamePrefix accesses a wrapped native that is not flagged as "system", the wrapped native will be automatically wrapped with an
XPCNativeWrapper. void flagSystemFilenamePrefix( in string aFilenamePrefix, in PRBool aWantNativeWrappers ); Parameters aFilenamePrefix The UTF-8 filename prefix to match, which should end...
... Missing Description Return value Missing Description Exceptions thrown Missing Exception Missing Description Native code only!getWrapperForObject Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Returns an
XPCNativeWrapper, XPCSafeJSObjectWrapper, or XPCCrossOriginWrapper for the given object based on the principal, scope, and filename flags that are passed in. Note: In C++, the out jsval parameter must already be a strong GC root. JSVal getWrapperForObject( in JSContextPtr aJSContext, in JSObjectPtr aObject, in JSObjectPtr aScope, in nsIPrincipal aPrincipal, in unsigned long aFilenameFlags ); Paramet...
... xpcom object implements nsIScriptObjectOwner; i.e., is an idlc style DOM object for which we can call GetScriptObject to get the JSObject it uses to represent itself into JavaScript. It *might* be possible to QueryInterface the nsIXPConnectJSObjectHolder returned by the method into an nsIXPConnectWrappedNative or an nsIXPConnectWrappedJS. This method will never wrap the JSObject involved in an
XPCNativeWrapper before returning. Returns: success: NS_OK failure: NS_ERROR_XPC_BAD_CONVERT_NATIVE NS_ERROR_XPC_CANT_GET_JSOBJECT_OF_DOM_OBJECT NS_ERROR_FAILURE. nsIXPConnectJSObjectHolder wrapNative( in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID ); Parameters aJSContext Missing Description aScope Missing Description aCOMObj Missing Description a...
wrappedJSObject
Regular XPConnect wrappers which you can encounter, for example, when using XPCOM components implemented in JS. ...
... Regular XPConnect wrappers which you can encounter, for example, when using XPCOM components implemented in JS. ...
XULRunner tips - Archive of obsolete content
ary directory Unzip the package Copy the following files: chrome/inspector.jar to the chrome directory of your XULRunner application components/inspector-cmdline.js to your components directory defaults/preferences/inspector.js to your preferences directory Open your chrome.manifest file and add these lines: content inspector jar:inspector.jar!/content/inspector/
xpcnativewrappers=no locale inspector en-US jar:inspector.jar!/locale/inspector/ skin inspector modern/1.0 jar:inspector.jar!/skin/modern/inspector/ skin inspector classic/1.0 jar:inspector.jar!/skin/classic/inspector/ overlay chrome://inspector/content/popupOverlay.xul chrome://inspector/content/viewers/dom/popupOverlay.xul overlay chrome://inspector/content/co...
nsIContentPolicy - Archive of obsolete content
setting attributes is a no-no). Query any DOM properties that depend on layout (e.g., offset* properties). Query any DOM properties that depend on style (e.g., computed style). Query any DOM properties that depend on the current state of the DOM outside the "context" node (e.g., lengths of node lists). [JavaScript implementations only] Access properties of any sort on any object without using
XPCNativeWrapper (either explicitly or implicitly). Due to various DOM0 things, this leads to item 4. If you do any of these things in your shouldLoad() implementation, expect unpredictable behavior, possibly including crashes, content not showing up, content showing up doubled, etc. If you need to do any of the things above, do them off timeout or event. Note: When multiple content policies are used (for exa...
JS-Engine FAQ - Archive of obsolete content
1.6 release 2 2005 09 19</tt>. How to compile JavaScript into Java Invoking compiler: java org.mozilla.javascript.tools.jsc.Main [options] file1.js [file2.js...] This results in a class file. Compiler options can be vied here. Non-js-engine questions Can I call functions in Mozilla extensions from web page? No, accessing anything in the web page's script may lead to security problems. See
XPCNativeWrapper. ...
Components.utils.Sandbox
"vanilla" view of the other. The protection is bidirectional: the caller sees the bonafide DOM objects without being confused by sneakily-redefined properties, and the target receives appropriate privacy from having its expandos inspected by untrusted callers. In situations where only unidirectional protection is needed, callers have the option to waive the X-ray behavior using wrappedJSObject or
XPCNativeWrapper.unwrap(). In general, when accessing same-origin content, script gets a Transparent wrapper rather than an Xray wrapper. However, sandboxes are often used when chrome wants to run script as another origin, possibly to interact with the page. In this case, same-origin Xrays are desirable, and wantXrays should be set to true. See Safely accessing content DOM from chrome for more details. Me...
Components.utils
import into the scope. isXrayWrapper() Test whether a given object is an Xray or not. unload() Unloads a JS module loaded with import(). isDeadWrapper() Determines whether this object is backed by a DeadObjectProxy. lookupMethod() Looks up a native (i.e. declared in the interface) method or property of an XPCOM object. Serves the same purpose as
XPCNativeWrapper. makeObjectPropsNormal() Ensures that all functions come from the specified object's scope, and aren't cross-compartment wrappers. May only be called from JavaScript code. nondeterministicGetWeakMapKeys() Return the keys in a weak map. This operation is non-deterministic because it is affected by the scheduling of the garbage collector and the cycle collector. This s...
Components object
(through its prototype chain at birth, for example). utils.getWeakReference Gets a weak reference for the object passed in. utils.import Loads a JavaScript module into the current script, without sharing a scope. utils.lookupMethod Looks up a native (i.e. declared in the interface) method or property of an XPCOM object. Serves the same purpose as
XPCNativeWrapper. utils.makeObjectPropsNormal Ensures that all functions come from the specified object's scope, and aren't cross-compartment wrappers. May only be called from JavaScript code. utils.methodjit Obsolete since Gecko 24.0 Provides access to the value of the methodjit property in the JavaScript environment. utils.methodjit_always Obsolete since Geck...
nsIChromeRegistry
xul For a "content" package. css For a "skin" package. dtd For a "locale" package. nsIURI convertChromeURL( in nsIURI aChromeURL ); Parameters aChromeURL The URL that is to be converted. Return value A new nsIURI object containing the loadable URI for the specified chrome URL. Violates the XPCOM interface guidelines wrappersEnabled() Returns whether
XPCNativeWrappers are enabled for the specified URI. boolean wrappersEnabled( in nsIURI aURI ); Parameters aURI The URI for which to determine if
XPCNativeWrappers are enabled. Return value true if
XPCNativeWrappers are enabled for the specified URI; otherwise false. See also Chrome Registration ...
Working with windows in chrome code
accessing elements which are descendants of your chrome document (but nevertheless in a different context). Accessing content documents Assume you have a document loaded in a <tabbrowser>, <browser>, or <iframe> element inside your document. You can use browser.contentDocument to access that document and browser.contentWindow to access the Window object of that document. You should be aware of
XPCNativeWrappers when working with untrusted content. With
XPCNativeWrappers turned on (which is the default in Firefox 1.5+), your extension can safely access the DOM of the content document, but not the content JavaScript. Bypassing
XPCNativeWrapper to work with content JavaScript directly can lead to security problems. See Interaction between privileged and non-privileged pages if you need to interact with t...
Document.documentURIObject - Web APIs
nsIURI object representing the URI of the document. This only works for privileged (UniversalXPConnect) scripts, including extension code. For web content this property doesn't have any special meaning and can be used just like any other custom property. Privileged code must be careful not to try getting or setting this property on a non-wrapped content object (e.g., on a wrappedJSObject of an
XPCNativeWrapper). See bug 324464's comments for details. Syntax var uri = document.documentURIObject; Example // Check that the URI scheme of the current tab in Firefox is 'http', // assuming this code runs in context of browser.xul let uriObj = content.document.documentURIObject; let uriPort = uriObj.port; if (uriObj.schemeIs('http')) { ... } Specifications Not part of any specification. ...