mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-15 15:58:57 +00:00
ErrorEvent error as undefined
This commit is contained in:
@@ -218,7 +218,7 @@ pub fn addFromElement(self: *ScriptManager, script_element: *Element.Html.Script
|
|||||||
.url = remote_url orelse page.url,
|
.url = remote_url orelse page.url,
|
||||||
.mode = blk: {
|
.mode = blk: {
|
||||||
if (source == .@"inline") {
|
if (source == .@"inline") {
|
||||||
break :blk .normal;
|
break :blk if (kind == .module) .@"defer" else .normal;
|
||||||
}
|
}
|
||||||
if (element.getAttributeSafe("async") != null) {
|
if (element.getAttributeSafe("async") != null) {
|
||||||
break :blk .async;
|
break :blk .async;
|
||||||
|
|||||||
35
src/browser/tests/element/html/script/order.html
Normal file
35
src/browser/tests/element/html/script/order.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../../../testing.js"></script>
|
||||||
|
|
||||||
|
<script defer id="remote_defer" src="order_defer.js"></script>
|
||||||
|
<script defer id="remote_async" src="order_async.js"></script>
|
||||||
|
|
||||||
|
<script type=module id="inline_module">
|
||||||
|
// inline module is always deferred.
|
||||||
|
list += 'g';
|
||||||
|
testing.expectEqual('abcdefg', list);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var list = '';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="remote" src="order.js"></script>
|
||||||
|
|
||||||
|
<script async id="inline_async">
|
||||||
|
// inline script ignore async
|
||||||
|
list += 'b';
|
||||||
|
testing.expectEqual('ab', list);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script defer id="inline_defer">
|
||||||
|
// inline script ignore defer
|
||||||
|
list += 'c';
|
||||||
|
testing.expectEqual('abc', list);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="default">
|
||||||
|
// simple inline script
|
||||||
|
list += 'd';
|
||||||
|
testing.expectEqual('abcd', list);
|
||||||
|
</script>
|
||||||
2
src/browser/tests/element/html/script/order.js
Normal file
2
src/browser/tests/element/html/script/order.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
list += 'a';
|
||||||
|
testing.expectEqual('a', list);
|
||||||
2
src/browser/tests/element/html/script/order_async.js
Normal file
2
src/browser/tests/element/html/script/order_async.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
list += 'f';
|
||||||
|
testing.expectEqual('abcdef', list);
|
||||||
2
src/browser/tests/element/html/script/order_defer.js
Normal file
2
src/browser/tests/element/html/script/order_defer.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
list += 'e';
|
||||||
|
testing.expectEqual('abcde', list);
|
||||||
@@ -103,7 +103,7 @@ pub const JsApi = struct {
|
|||||||
pub const filename = bridge.accessor(ErrorEvent.getFilename, null, .{});
|
pub const filename = bridge.accessor(ErrorEvent.getFilename, null, .{});
|
||||||
pub const lineno = bridge.accessor(ErrorEvent.getLineNumber, null, .{});
|
pub const lineno = bridge.accessor(ErrorEvent.getLineNumber, null, .{});
|
||||||
pub const colno = bridge.accessor(ErrorEvent.getColumnNumber, null, .{});
|
pub const colno = bridge.accessor(ErrorEvent.getColumnNumber, null, .{});
|
||||||
pub const @"error" = bridge.accessor(ErrorEvent.getError, null, .{});
|
pub const @"error" = bridge.accessor(ErrorEvent.getError, null, .{ .null_as_undefined = true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const testing = @import("../../../testing.zig");
|
const testing = @import("../../../testing.zig");
|
||||||
|
|||||||
Reference in New Issue
Block a user