EV-WebKit

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    "on_request => sub { my ($req) = @_ }"
        Intercept, rewrite, mock or block every request the browser makes.
        Routes through the in-process proxy, so it does not see
        local-address traffic and it sets a connection fingerprint -- see
        "on_request" for both caveats.

    "on_response => sub { my ($res) = @_ }"
        Observe or rewrite each response's status and headers before the
        page sees them -- stripping "Content-Security-Policy" is the usual
        reason. Same proxy, same caveats. See "on_response".

EV::WebKit::Dialog
    Passed to "on_dialog". Valid only for the duration of that call.

    "type"
        Nick string: "alert", "confirm", "prompt", or
        "before-unload-confirm".

    "message"
        The dialog's message text.

    accept($text)
        Accept the dialog. For "prompt", $text (if defined) becomes the
        entered value; for "confirm"/"before-unload-confirm", marks it
        confirmed; "alert" has nothing to set and this just acknowledges it.

    "dismiss"
        Cancel the dialog ("confirm"/"before-unload-confirm" resolve false;
        "alert"/"prompt" just close).

EV::WebKit::Policy
    Passed to "on_policy". Valid only for the duration of that call.

    "uri"
        The request URI for this decision (best-effort; may be "undef").

    "type"
        Nick string: "navigation-action", "new-window-action", or
        "response".

    "allow"
        Let the navigation/response proceed.

    "block"
        Cancel the navigation/response.

EV::WebKit::Auth
    Passed to "on_authenticate". Valid only for the duration of that call.

    "host", "port", "realm", "scheme"
        What is being asked for. "scheme" is WebKit's own nick for the
        authentication scheme ("http-basic", "http-digest", ...); "realm" is
        the server's realm string, which is what distinguishes two
        challenges from the same host.

    "for_proxy"
        True when the challenge came from a proxy rather than the origin
        server.

    "is_retry"
        True when the credentials you last supplied were rejected. WebKit
        re-asks after every rejection, so a handler that answers with the
        same pair regardless of this loops forever.

    "login($user, $password, persist => $how)"
        Answer the challenge. "persist" is 'for-session' (the default --
        remembered until this instance closes, so the same realm is not
        asked again on every request), 'permanent' (written to the platform
        credential store), or 'none'.

    "cancel"
        Refuse the challenge. This is also what happens if the handler
        returns without deciding, dies, or was never set at all.

EV::WebKit::Download
    Passed to "on_download". Unlike the dialog and policy objects, this one
    outlives the handler that received it: WebKit reports progress and
    completion later, so it stays valid until the download finishes, fails,
    or the browser closes.

    "uri"
        The URI being downloaded.

    "suggested"
        The filename the server suggested (from "Content-Disposition", else
        derived from the URI). Only known once WebKit asks for a
        destination, which is when "on_download" runs -- so it is available
        there, and "undef" before.

    "save_to($path, overwrite => $bool)"
        Choose where the download lands. Required: a download whose handler
        names no destination is cancelled, because WebKit's own default
        would write into the user's Downloads directory behind the caller's
        back. $path is a plain filesystem path (a "file://" URI is accepted
        and stripped).

    on_finish($cb)
        Register the completion callback: "$cb->($path, $err)". $path is
        where the file landed; on failure $path is "undef" and $err a
        message. Fires exactly once. Registering after the download has
        already finished still delivers, so there is no race in setting it
        late.

    "destination"
        The path chosen by "save_to", or "undef".

    "progress"
        Estimated completion, 0 to 1.

    "received"
        Bytes received so far.

    "cancel"
        Abort the download. "on_finish" then reports the cancellation.

EV::WebKit::FileChooser
    Passed to "on_file_chooser". Valid only for the duration of that call.

    select(@paths)
        Answer the chooser with these files. Croaks on a path that does not
        exist, or on several paths when the input accepts only one -- WebKit



( run in 1.529 second using v1.01-cache-2.11-cpan-007c89162af )