Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/app.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const std = @import("std");
const Allocator = std.mem.Allocator;

const js = @import("runtime/js.zig");
const Loop = @import("runtime/loop.zig").Loop;
const HttpClient = @import("http/client.zig").Client;
const Telemetry = @import("telemetry/telemetry.zig").Telemetry;
Expand Down
11 changes: 0 additions & 11 deletions src/browser/browser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,16 @@ const URL = @import("../url.zig").URL;

const http = @import("../http/client.zig");
const storage = @import("storage/storage.zig");
const Loop = @import("../runtime/loop.zig").Loop;
const SessionState = @import("env.zig").SessionState;
const HttpClient = @import("../http/client.zig").Client;
const Notification = @import("../notification.zig").Notification;

const polyfill = @import("polyfill/polyfill.zig");

const log = std.log.scoped(.browser);

pub const user_agent = "Lightpanda/1.0";

// Browser is an instance of the browser.
// You can create multiple browser instances.
// A browser contains only one session.
// TODO allow multiple sessions per browser.
pub const Browser = struct {
env: *Env,
app: *App,
Expand Down Expand Up @@ -839,12 +834,6 @@ const FlatRenderer = struct {
}
};

const NoopContext = struct {
pub fn onInspectorResponse(_: *anyopaque, _: u32, _: []const u8) void {}
pub fn onInspectorEvent(_: *anyopaque, _: []const u8) void {}
pub fn notify(_: *anyopaque, _: *const Notification) !void {}
};

fn timestamp() u32 {
const ts = std.posix.clock_gettime(std.posix.CLOCK.MONOTONIC) catch unreachable;
return @intCast(ts.sec);
Expand Down
3 changes: 0 additions & 3 deletions src/browser/dom/attribute.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const parser = @import("../netsurf.zig");

const Node = @import("node.zig").Node;
const DOMException = @import("exceptions.zig").DOMException;

// WEB IDL https://dom.spec.whatwg.org/#attr
pub const Attr = struct {
Expand Down
2 changes: 0 additions & 2 deletions src/browser/dom/cdata_section.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const parser = @import("../netsurf.zig");

const Text = @import("text.zig").Text;
Expand Down
1 change: 0 additions & 1 deletion src/browser/dom/comment.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const std = @import("std");

const parser = @import("../netsurf.zig");

Expand Down
2 changes: 0 additions & 2 deletions src/browser/dom/document.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ const css = @import("css.zig");
const Element = @import("element.zig").Element;
const ElementUnion = @import("element.zig").Union;

const DocumentType = @import("document_type.zig").DocumentType;
const DocumentFragment = @import("document_fragment.zig").DocumentFragment;
const DOMImplementation = @import("implementation.zig").DOMImplementation;

// WEB IDL https://dom.spec.whatwg.org/#document
Expand Down
2 changes: 0 additions & 2 deletions src/browser/dom/element.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ const NodeList = @import("nodelist.zig").NodeList;
const HTMLElem = @import("../html/elements.zig");
pub const Union = @import("../html/elements.zig").Union;

const DOMException = @import("exceptions.zig").DOMException;

// WEB IDL https://dom.spec.whatwg.org/#element
pub const Element = struct {
pub const Self = parser.Element;
Expand Down
2 changes: 0 additions & 2 deletions src/browser/dom/event_target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const Env = @import("../env.zig").Env;
const parser = @import("../netsurf.zig");
const SessionState = @import("../env.zig").SessionState;
Expand Down
6 changes: 0 additions & 6 deletions src/browser/dom/html_collection.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ const Allocator = std.mem.Allocator;

const parser = @import("../netsurf.zig");

const utils = @import("utils.z");
const Element = @import("element.zig").Element;
const Union = @import("element.zig").Union;

const JsThis = @import("../env.zig").JsThis;

const Walker = @import("walker.zig").Walker;
const WalkerDepthFirst = @import("walker.zig").WalkerDepthFirst;
const WalkerChildren = @import("walker.zig").WalkerChildren;
const WalkerNone = @import("walker.zig").WalkerNone;

const Matcher = union(enum) {
matchByName: MatchByName,
Expand Down
6 changes: 0 additions & 6 deletions src/browser/dom/implementation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const parser = @import("../netsurf.zig");
const SessionState = @import("../env.zig").SessionState;

const Document = @import("document.zig").Document;
const DocumentType = @import("document_type.zig").DocumentType;
const DOMException = @import("exceptions.zig").DOMException;

// WEB IDL https://dom.spec.whatwg.org/#domimplementation
Expand Down
1 change: 0 additions & 1 deletion src/browser/dom/nodelist.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const parser = @import("../netsurf.zig");

const JsThis = @import("../env.zig").JsThis;
const Callback = @import("../env.zig").Callback;
const SessionState = @import("../env.zig").SessionState;

const NodeUnion = @import("node.zig").Union;
const Node = @import("node.zig").Node;
Expand Down
2 changes: 0 additions & 2 deletions src/browser/dom/text.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const parser = @import("../netsurf.zig");
const SessionState = @import("../env.zig").SessionState;

Expand Down
1 change: 0 additions & 1 deletion src/browser/dom/token_list.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const iterator = @import("../iterator/iterator.zig");

const Callback = @import("../env.zig").Callback;
const JsObject = @import("../env.zig").JsObject;
const SessionState = @import("../env.zig").SessionState;
const DOMException = @import("exceptions.zig").DOMException;

const log = std.log.scoped(.token_list);
Expand Down
2 changes: 0 additions & 2 deletions src/browser/dom/walker.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const parser = @import("../netsurf.zig");

pub const Walker = union(enum) {
Expand Down
1 change: 0 additions & 1 deletion src/browser/dump.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");
const File = std.fs.File;

const parser = @import("netsurf.zig");
const Walker = @import("dom/walker.zig").WalkerChildren;
Expand Down
2 changes: 0 additions & 2 deletions src/browser/events/custom_event.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const parser = @import("../netsurf.zig");
const Event = @import("event.zig").Event;
const JsObject = @import("../env.zig").JsObject;
Expand Down
2 changes: 0 additions & 2 deletions src/browser/html/document.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ const std = @import("std");
const parser = @import("../netsurf.zig");
const SessionState = @import("../env.zig").SessionState;

const Node = @import("../dom/node.zig").Node;
const Document = @import("../dom/document.zig").Document;
const NodeList = @import("../dom/nodelist.zig").NodeList;
const HTMLElem = @import("elements.zig");
const Location = @import("location.zig").Location;

const collection = @import("../dom/html_collection.zig");
Expand Down
2 changes: 0 additions & 2 deletions src/browser/html/history.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

const std = @import("std");

const builtin = @import("builtin");

// https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-history-interface
pub const History = struct {
const ScrollRestorationMode = enum {
Expand Down
4 changes: 0 additions & 4 deletions src/browser/html/location.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const SessionState = @import("../env.zig").SessionState;

const builtin = @import("builtin");

const URL = @import("../url/url.zig").URL;

// https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-location-interface
Expand Down
2 changes: 0 additions & 2 deletions src/browser/iterator/iterator.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const std = @import("std");

pub const Interfaces = .{
U32Iterator,
};
Expand Down
1 change: 0 additions & 1 deletion src/browser/mimalloc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
// We replace the libdom default usage of allocations with mimalloc heap
// allocation to be able to free all memory used at once, like an arena usage.

const std = @import("std");
const c = @cImport({
@cInclude("mimalloc.h");
});
Expand Down
1 change: 0 additions & 1 deletion src/browser/polyfill/fetch.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const std = @import("std");
// fetch.js code comes from
// https://github.com/JakeChampion/fetch/blob/main/fetch.js
//
Expand Down
2 changes: 0 additions & 2 deletions src/browser/xhr/progress_event.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

const parser = @import("../netsurf.zig");
const Event = @import("../events/event.zig").Event;

Expand Down
1 change: 0 additions & 1 deletion src/browser/xmlserializer/xmlserializer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const SessionState = @import("../env.zig").SessionState;

const dump = @import("../dump.zig");
const parser = @import("../netsurf.zig");
const DOMError = parser.DOMError;

pub const Interfaces = .{
XMLSerializer,
Expand Down
1 change: 0 additions & 1 deletion src/cdp/domains/emulation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");
const Runtime = @import("runtime.zig");

pub fn processMessage(cmd: anytype) !void {
const action = std.meta.stringToEnum(enum {
Expand Down
1 change: 0 additions & 1 deletion src/cdp/domains/page.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");
const runtime = @import("runtime.zig");
const URL = @import("../../url.zig").URL;
const Notification = @import("../../notification.zig").Notification;

Expand Down
1 change: 0 additions & 1 deletion src/cdp/testing.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const ArenaAllocator = std.heap.ArenaAllocator;
const Testing = @This();

const main = @import("cdp.zig");
const URL = @import("../url.zig").URL;
const App = @import("../app.zig").App;
const parser = @import("../browser/netsurf.zig");

Expand Down
10 changes: 0 additions & 10 deletions src/id.zig
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,6 @@ pub fn uuidv4(hex: []u8) void {
}
}

const hex_to_nibble = [_]u8{0xff} ** 48 ++ [_]u8{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff,
} ++ [_]u8{0xff} ** 152;

const testing = std.testing;
test "id: Incrementing.next" {
var id = Incrementing(u16, "IDX"){};
Expand Down
2 changes: 0 additions & 2 deletions src/runtime/test_primitive_types.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

const std = @import("std");

// TODO: use functions instead of "fake" struct once we handle function API generation
const Primitives = struct {
pub fn constructor() Primitives {
Expand Down
6 changes: 0 additions & 6 deletions src/server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const Completion = IO.Completion;
const AcceptError = IO.AcceptError;
const RecvError = IO.RecvError;
const SendError = IO.SendError;
const CloseError = IO.CloseError;
const CancelError = IO.CancelOneError;
const TimeoutError = IO.TimeoutError;
const Loop = @import("runtime/loop.zig").Loop;

Expand Down Expand Up @@ -947,10 +945,6 @@ const OpCode = enum(u8) {
pong = 128 | 10,
};

const CloseCode = enum {
timeout,
};

fn fillWebsocketHeader(buf: std.ArrayListUnmanaged(u8)) []const u8 {
// can't use buf[0..10] here, because the header length
// is variable. If it's just 2 bytes, for example, we need the
Expand Down
2 changes: 1 addition & 1 deletion src/telemetry/lightpanda.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub const LightPanda = struct {

const List = std.DoublyLinkedList(LightPandaEvent);

pub fn init(app: *App) !LightPanda {
pub fn init(app: *App) LightPanda {
const allocator = app.allocator;
return .{
.cond = .{},
Expand Down
9 changes: 4 additions & 5 deletions src/telemetry/telemetry.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const builtin = @import("builtin");
const Allocator = std.mem.Allocator;

const App = @import("../app.zig").App;
const Loop = @import("jsruntime").Loop;
const Notification = @import("../notification.zig").Notification;

const uuidv4 = @import("../id.zig").uuidv4;
Expand Down Expand Up @@ -39,7 +38,7 @@ fn TelemetryT(comptime P: type) type {
return .{
.disabled = disabled,
.run_mode = run_mode,
.provider = try P.init(app),
.provider = P.init(app),
.iid = if (disabled) null else getOrCreateId(app.app_dir_path),
};
}
Expand Down Expand Up @@ -135,7 +134,7 @@ pub const Event = union(enum) {
};

const NoopProvider = struct {
fn init(_: *App) !NoopProvider {
fn init(_: *App) NoopProvider {
return .{};
}
fn deinit(_: NoopProvider) void {}
Expand All @@ -151,7 +150,7 @@ test "telemetry: disabled by environment" {
defer _ = unsetenv(@constCast("LIGHTPANDA_DISABLE_TELEMETRY"));

const FailingProvider = struct {
fn init(_: *App) !@This() {
fn init(_: *App) @This() {
return .{};
}
fn deinit(_: @This()) void {}
Expand Down Expand Up @@ -207,7 +206,7 @@ const MockProvider = struct {
allocator: Allocator,
events: std.ArrayListUnmanaged(Event),

fn init(app: *App) !@This() {
fn init(app: *App) @This() {
return .{
.iid = null,
.run_mode = null,
Expand Down
Loading