mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
dynamic script support
This commit is contained in:
@@ -884,19 +884,12 @@ fn timestamp() u32 {
|
|||||||
// after the document is loaded, it's ok to execute any async and defer scripts
|
// after the document is loaded, it's ok to execute any async and defer scripts
|
||||||
// immediately.
|
// immediately.
|
||||||
pub export fn scriptAddedCallback(ctx: ?*anyopaque, element: ?*parser.Element) callconv(.C) void {
|
pub export fn scriptAddedCallback(ctx: ?*anyopaque, element: ?*parser.Element) callconv(.C) void {
|
||||||
_ = ctx;
|
const self: *Page = @alignCast(@ptrCast(ctx.?));
|
||||||
_ = element;
|
if (self.delayed_navigation) {
|
||||||
// @newhttp
|
// if we're planning on navigating to another page, don't run this script
|
||||||
// const self: *Page = @alignCast(@ptrCast(ctx.?));
|
return;
|
||||||
// if (self.delayed_navigation) {
|
}
|
||||||
// // if we're planning on navigating to another page, don't run this script
|
self.script_manager.addFromElement(element.?) catch |err| {
|
||||||
// return;
|
log.warn(.browser, "dynamcic script", .{ .err = err });
|
||||||
// }
|
};
|
||||||
|
|
||||||
// var script = Script.init(element.?, self) catch |err| {
|
|
||||||
// log.warn(.browser, "script added init error", .{ .err = err });
|
|
||||||
// return;
|
|
||||||
// } orelse return;
|
|
||||||
|
|
||||||
// _ = self.evalScript(&script);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const Http = @This();
|
|||||||
|
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
client: *Client,
|
client: *Client,
|
||||||
ca_blob: ?c.curl_blob,
|
ca_blob: c.curl_blob,
|
||||||
cert_arena: ArenaAllocator,
|
cert_arena: ArenaAllocator,
|
||||||
|
|
||||||
pub fn init(allocator: Allocator, opts: Opts) !Http {
|
pub fn init(allocator: Allocator, opts: Opts) !Http {
|
||||||
@@ -79,7 +79,7 @@ pub const Connection = struct {
|
|||||||
|
|
||||||
// Is called by Handles when already partially initialized. Done like this
|
// Is called by Handles when already partially initialized. Done like this
|
||||||
// so that we have a stable pointer to error_buffer.
|
// so that we have a stable pointer to error_buffer.
|
||||||
pub fn init(ca_blob_: ?c.curl_blob, opts: Opts) !Connection {
|
pub fn init(ca_blob: c.curl_blob, opts: Opts) !Connection {
|
||||||
const easy = c.curl_easy_init() orelse return error.FailedToInitializeEasy;
|
const easy = c.curl_easy_init() orelse return error.FailedToInitializeEasy;
|
||||||
errdefer _ = c.curl_easy_cleanup(easy);
|
errdefer _ = c.curl_easy_cleanup(easy);
|
||||||
|
|
||||||
@@ -95,9 +95,7 @@ pub const Connection = struct {
|
|||||||
// tls
|
// tls
|
||||||
// try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_SSL_VERIFYHOST, @as(c_long, 0)));
|
// try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_SSL_VERIFYHOST, @as(c_long, 0)));
|
||||||
// try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_SSL_VERIFYPEER, @as(c_long, 0)));
|
// try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_SSL_VERIFYPEER, @as(c_long, 0)));
|
||||||
if (ca_blob_) |ca_blob| {
|
try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_CAINFO_BLOB, ca_blob));
|
||||||
try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_CAINFO_BLOB, ca_blob));
|
|
||||||
}
|
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
if (comptime Http.ENABLE_DEBUG) {
|
if (comptime Http.ENABLE_DEBUG) {
|
||||||
|
|||||||
Reference in New Issue
Block a user