API-Version: 1.9

WebKitWebFrame

Represents a frame or iframe. Due to same origin policy it is not possible to inject scripts from a WebKitWebView into iframes with a different domain. For this purpose the frame object can be used.

new WebKitWebFrame()

Represents a frame or an iframe

Source:

Extends

Members

domain :String

The domain name of the frame which is the effective second level domain

Source:

host :String

The host name of the frame

Source:

Methods

blockSignal(id)

Blocks emission of a signal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject#connect

Inherited From:
Source:

connect(name, callback, after) → {Number}

Connect to a GObject-signal. Note that all signals are connected using the signal::- or with notify::-prefix. If connecting to a signal the signal::-prefix must be omitted. The callback function will have the same parameters as the GObject signal callback without the first parameter, however some parameters may be undefined if they cannot be converted to javascript objects. All signal handlers are executed after dwb’s default handler.

Parameters:
Name Type Argument Description
name String

The signal name.

callback GObject~connectCallback

Callback that will be called when the signal is emitted.

after Boolean <optional>

Whether to connect after the default signal handler.

Inherited From:
Source:
Returns:

The signal id of this signal

Type
Number

connectBlocked(name, callback, after) → {Number}

Connect to a gobject-signal but block the emission of the own callback during execution of the callback. Useful if the object is connected to a notify event and the the property is changed in the callback function.

Parameters:
Name Type Argument Description
name String

The signal name.

callback Function

Callback that will be called when the signal is emitted.

after Boolean <optional>

Whether to connect after the default signal handler.

Inherited From:
Source:
Returns:

The signal id of this signal

Type
Number

disconnect(id) → {Boolean}

Disconnects from a signal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject.connect

Inherited From:
Source:
Returns:

Whether a signal was found and disconnected

Type
Boolean

inject(code, arg, line, global) → {String}

Injects javascript code into a frame or webview

Parameters:
Name Type Argument Description
code String | Function

The script to inject, either a string or a function. If it is a function the body will be wrapped inside a new function.

arg Object

If the script isn’t injected into the global scope the script is wrapped inside a function. arg then is accesible via arguments in the injected script, or by the variable exports, optional

line Number <optional>

Starting line number, useful for debugging. If linenumber is greater than 0 error messages will be printed to stderr, optional.

global Boolean <optional>

true to inject it into the global scope, false to encapsulate it in a function, default false

Source:
Returns:

The return value of the script. If the script is injected globally inject always returns null. The return value is always converted to a string. To return objects call JSON.parse on the return value.

Type
String
Example
 
//!javascript
function injectable() {
   var text = exports.text;
   document.body.innerHTML = text;
}
signals.connect("documentLoaded", function(wv) {
   wv.inject(injectable, { text : "foo", number : 37 }, 3);
});

loadString(content, mimeType, encoding, baseUri, externalSources) → {Deferred}

Loads a string in a frame or a webview

Parameters:
Name Type Argument Description
content String

The string to load

mimeType String <optional>

The MIME-type, if omitted or null text/html is assumed.

encoding String <optional>

The character encoding, if omitted or null UTF-8 is assumed.

baseUri String <optional>

The base uri, if present it must either use the uri-scheme dwb-chrome: or file:, otherwise the request will be ignored.

externalSources boolean <optional>

Whether external sources, e.g. scripts, are allowed, defaults to false. If external resources are forbidden the function dwb can be called in the webcontext to execute functions in the scripting context

Since:
  • 1.3
Source:
Returns:

A deferred that will be resolved if the webview has finished loading the string and rejected if an error occured

Type
Deferred

notify(name, callback, after) → {Number}

Connects to a property change notification

Parameters:
Name Type Argument Description
name String

The property name, can also be in camelcase.

callback GObject~notifyCallback

Callback that will be called when the property changes

after Boolean <optional>

Whether to connect after the default handler.

Inherited From:
Source:
Returns:

The signal id of this signal

Type
Number

notifyBlocked(name, callback, after) → {Number}

Connects to a property change notification but with signal blocking. Must be used if the property is modified in the callback function.

Parameters:
Name Type Argument Description
name String

The property name, can also be in camelcase.

callback GObject~notifyCallback

Callback that will be called when the property changes

after Boolean <optional>

Whether to connect after the default handler.

Inherited From:
Deprecated:
  • Yes
Source:
Returns:

The signal id of this signal

Type
Number
Example
 
gui.statusLabel.notifyBlocked("label", function() {
     this.label += "foo"; 
});

unblockSignal(id)

Unblocks a signal that was blocked with GObject#blockSignal

Parameters:
Name Type Description
id Number

The signal id retrieved from GObject#connect

Inherited From:
Source: