Skip to content

called Option::unwrap() on a None value (thread Script(1,1), at components/script/dom/bindings/settings_stack.rs:46) #39004

@simonwuelker

Description

@simonwuelker

To reproduce: ./mach run https://archive.org/details/gargantuaandpantagruelbookv_2508_librivox.

It seems that we run into a situation without an entry global object:

pub(crate) fn entry_global() -> DomRoot<GlobalScope> {
STACK
.with(|stack| {
stack
.borrow()
.iter()
.rev()
.find(|entry| entry.kind == StackEntryKind::Entry)
.map(|entry| DomRoot::from_ref(&*entry.global))
})
.unwrap()
}

Non-minimal reproduction:

<!doctype html>
<html lang="en">
    <body>
        <script
            src="https://archive.org/includes/build/js/details-bookreader.min.js?v=3543766e"
            type="text/javascript"
        ></script>
        <ia-reviews></ia-reviews>
Full Backtrace
donation-banner loaded {"version": "1.1.1"}
NotSupportedError: The operation is not supported. {}
NotSupportedError: The operation is not supported. {}
called `Option::unwrap()` on a `None` value (thread Script(1,1), at components/script/dom/bindings/settings_stack.rs:46)
   0: servoshell::backtrace::print
             at /home/alaska/servo/ports/servoshell/backtrace.rs:18:5
   1: servoshell::panic_hook::panic_hook
             at /home/alaska/servo/ports/servoshell/panic_hook.rs:40:17
   2: core::ops::function::Fn::call
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:79:5
   3: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/alloc/src/boxed.rs:1980:9
      std::panicking::rust_panic_with_hook
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:841:13
   4: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:699:13
   5: std::sys::backtrace::__rust_end_short_backtrace
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/sys/backtrace.rs:168:18
   6: __rustc::rust_begin_unwind
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:697:5
   7: core::panicking::panic_fmt
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/panicking.rs:75:14
   8: core::panicking::panic
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/panicking.rs:145:5
   9: core::option::unwrap_failed
             at /rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/option.rs:2072:5
  10: core::option::Option<T>::unwrap
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1005:21
      script::dom::bindings::settings_stack::entry_global
             at /home/alaska/servo/components/script/dom/bindings/settings_stack.rs:46:10
  11: script::dom::globalscope::GlobalScope::entry
             at /home/alaska/servo/components/script/dom/globalscope.rs:3067:9
  12: script::dom::location::Location::entry_settings_object
             at /home/alaska/servo/components/script/dom/location.rs:212:9
  13: script::dom::location::Location::document_if_same_origin::{{closure}}
             at /home/alaska/servo/components/script/dom/location.rs:182:22
  14: core::option::Option<T>::filter
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1545:16
  15: script::dom::location::Location::document_if_same_origin
             at /home/alaska/servo/components/script/dom/location.rs:181:61
  16: script::dom::location::Location::get_url_if_same_origin
             at /home/alaska/servo/components/script/dom/location.rs:204:41
  17: <script::dom::location::Location as script_bindings::codegen::GenericBindings::LocationBinding::Location_Binding::LocationMethods<script::dom::bindings::codegen::DomTypeHolder::DomTypeHolder>>::GetSearch
             at /home/alaska/servo/components/script/dom/location.rs:525:36
  18: script_bindings::codegen::GenericBindings::LocationBinding::Location_Binding::get_search::{{closure}}::{{closure}}
             at /home/alaska/servo/target/debug/build/script_bindings-ffde3d8970249b96/out/Bindings/LocationBinding.rs:733:53
  19: script_bindings::codegen::GenericBindings::LocationBinding::Location_Binding::get_search::{{closure}}
             at /home/alaska/servo/target/debug/build/script_bindings-ffde3d8970249b96/out/Bindings/LocationBinding.rs:730:33
  20: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:305:21
  21: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  22: std::panicking::catch_unwind::do_call
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40
  23: __rust_try
  24: std::panicking::catch_unwind
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19
      std::panic::catch_unwind
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
  25: mozjs::panic::wrap_panic
             at /home/alaska/.cargo/git/checkouts/mozjs-dd2a25693c61d87d/af903e0/mozjs/src/panic.rs:22:11
  26: script_bindings::codegen::GenericBindings::LocationBinding::Location_Binding::get_search
             at /home/alaska/servo/target/debug/build/script_bindings-ffde3d8970249b96/out/Bindings/LocationBinding.rs:730:5
  27: CallJitGetterOp
             at /home/runner/work/mozjs/mozjs/mozjs-sys/./src/jsglue.cpp:655:22
  28: script_bindings::utils::generic_call
             at /home/alaska/servo/components/script_bindings/utils.rs:405:5
  29: script_bindings::utils::generic_getter
             at /home/alaska/servo/components/script_bindings/utils.rs:438:5
  30: _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructENS_10CallReasonE
  31: _ZN2js10CallGetterEP9JSContextN2JS6HandleINS2_5ValueEEES5_NS2_13MutableHandleIS4_EE
  32: _ZL10CallGetterP9JSContextN2JS6HandleIPN2js12NativeObjectEEENS2_INS1_5ValueEEENS2_INS1_11PropertyKeyEEENS3_16PropertyInfoBaseIjEENS1_13MutableHandleIS7_EE
  33: _ZN2js17NativeGetPropertyEP9JSContextN2JS6HandleIPNS_12NativeObjectEEENS3_INS2_5ValueEEENS3_INS2_11PropertyKeyEEENS2_13MutableHandleIS7_EE
  34: script_bindings::codegen::GenericBindings::LocationBinding::Location_Binding::get::{{closure}}::{{closure}}
             at /home/alaska/servo/target/debug/build/script_bindings-ffde3d8970249b96/out/Bindings/LocationBinding.rs:1449:24
  35: script_bindings::codegen::GenericBindings::LocationBinding::Location_Binding::get::{{closure}}
             at /home/alaska/servo/target/debug/build/script_bindings-ffde3d8970249b96/out/Bindings/LocationBinding.rs:1421:33
  36: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:305:21
  37: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  38: std::panicking::catch_unwind::do_call
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:589:40
  39: __rust_try
  40: std::panicking::catch_unwind
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:552:19
      std::panic::catch_unwind
             at /home/alaska/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
  41: mozjs::panic::wrap_panic
             at /home/alaska/.cargo/git/checkouts/mozjs-dd2a25693c61d87d/af903e0/mozjs/src/panic.rs:22:11
  42: script_bindings::codegen::GenericBindings::LocationBinding::Location_Binding::get
             at /home/alaska/servo/target/debug/build/script_bindings-ffde3d8970249b96/out/Bindings/LocationBinding.rs:1421:5
  43: _ZNK22ForwardingProxyHandler3getEP9JSContextN2JS6HandleIP8JSObjectEENS3_INS2_5ValueEEENS3_INS2_11PropertyKeyEEENS2_13MutableHandleIS7_EE
             at /home/runner/work/mozjs/mozjs/mozjs-sys/./src/jsglue.cpp:501:3
  44: _ZN2js5Proxy3getEP9JSContextN2JS6HandleIP8JSObjectEENS4_INS3_5ValueEEENS4_INS3_11PropertyKeyEEENS3_13MutableHandleIS8_EE
  45: _ZN2js11GetPropertyEP9JSContextN2JS6HandleINS2_5ValueEEENS3_IPNS_12PropertyNameEEENS2_13MutableHandleIS4_EE
  46: _ZN2js9InterpretEP9JSContextRNS_8RunStateE
  47: _ZN2js9RunScriptEP9JSContextRNS_8RunStateE
  48: _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructENS_10CallReasonE
  49: _ZL17InternalConstructP9JSContextRKN2js16AnyConstructArgsENS1_10CallReasonE
  50: _ZN2js9ConstructEP9JSContextN2JS6HandleINS2_5ValueEEERKNS_16AnyConstructArgsES5_NS2_13MutableHandleIP8JSObjectEE
  51: _ZN2JS9ConstructEP9JSContextNS_6HandleINS_5ValueEEERKNS_16HandleValueArrayENS_13MutableHandleIP8JSObjectEE
  52: mozjs::rust::wrappers::Construct1
             at /home/alaska/.cargo/git/checkouts/mozjs-dd2a25693c61d87d/af903e0/mozjs/src/rust.rs:1228:51
  53: script::dom::customelementregistry::CustomElementDefinition::create_element
             at /home/alaska/servo/components/script/dom/customelementregistry.rs:737:26
  54: script::dom::create::create_html_element
             at /home/alaska/servo/components/script/dom/create.rs:174:45
  55: script::dom::create::create_element
             at /home/alaska/servo/components/script/dom/create.rs:440:22
  56: script::dom::element::Element::create
             at /home/alaska/servo/components/script/dom/element.rs:297:9
  57: script::dom::servoparser::create_element_for_token
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:1519:19
  58: <script::dom::servoparser::Sink as markup5ever::interface::tree_builder::TreeSink>::create_element
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:1275:23
  59: markup5ever::interface::tree_builder::create_element
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/markup5ever-0.35.0/interface/tree_builder.rs:88:10
  60: html5ever::tree_builder::TreeBuilder<Handle,Sink>::insert_element
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tree_builder/mod.rs:1375:20
  61: html5ever::tree_builder::TreeBuilder<Handle,Sink>::insert_element_for
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tree_builder/mod.rs:1413:14
  62: html5ever::tree_builder::rules::<impl html5ever::tree_builder::TreeBuilder<Handle,Sink>>::step
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tree_builder/rules.rs:744:30
  63: html5ever::tree_builder::TreeBuilder<Handle,Sink>::process_to_completion
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tree_builder/mod.rs:349:22
  64: <html5ever::tree_builder::TreeBuilder<Handle,Sink> as html5ever::tokenizer::interface::TokenSink>::process_token
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tree_builder/mod.rs:539:14
  65: html5ever::tokenizer::Tokenizer<Sink>::process_token
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tokenizer/mod.rs:231:23
  66: html5ever::tokenizer::Tokenizer<Sink>::emit_current_tag
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tokenizer/mod.rs:445:20
  67: html5ever::tokenizer::Tokenizer<Sink>::step
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tokenizer/mod.rs:659:20
  68: html5ever::tokenizer::Tokenizer<Sink>::run
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tokenizer/mod.rs:364:28
  69: html5ever::tokenizer::Tokenizer<Sink>::feed
             at /home/alaska/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/html5ever-0.35.0/src/tokenizer/mod.rs:218:14
  70: script::dom::servoparser::html::Tokenizer::feed
             at /home/alaska/servo/components/script/dom/servoparser/html.rs:100:26
  71: script::dom::servoparser::Tokenizer::feed::{{closure}}
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:797:30
  72: profile_traits::time::profile
             at /home/alaska/servo/components/shared/profile/time.rs:207:9
  73: script::dom::servoparser::Tokenizer::feed
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:793:47
  74: script::dom::servoparser::ServoParser::parse_sync::{{closure}}
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:625:27
  75: script::dom::servoparser::ServoParser::tokenize
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:672:32
  76: script::dom::servoparser::ServoParser::parse_sync
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:623:14
  77: script::dom::servoparser::ServoParser::resume_with_pending_parsing_blocking_script
             at /home/alaska/servo/components/script/dom/servoparser/mod.rs:372:18
  78: script::dom::document::Document::process_pending_parsing_blocking_script
             at /home/alaska/servo/components/script/dom/document.rs:2225:18
  79: script::dom::document::Document::pending_parsing_blocking_script_loaded
             at /home/alaska/servo/components/script/dom/document.rs:2209:14
  80: script::dom::htmlscriptelement::finish_fetching_a_classic_script
             at /home/alaska/servo/components/script/dom/htmlscriptelement.rs:317:22
  81: <script::dom::htmlscriptelement::ClassicContext as net_traits::FetchResponseListener>::process_response_eof
             at /home/alaska/servo/components/script/dom/htmlscriptelement.rs:467:9
  82: <net_traits::FetchResponseMsg as net_traits::Action<T>>::process
             at /home/alaska/servo/components/shared/net/lib.rs:374:30
  83: <script::network_listener::ListenerTask<A,Listener> as script::task::TaskOnce>::run_once
             at /home/alaska/servo/components/script/network_listener.rs:118:25
  84: <script::task::CancellableTask<T> as script::task::TaskOnce>::run_once
             at /home/alaska/servo/components/script/task.rs:155:24
  85: <T as script::task::TaskBox>::run_box
             at /home/alaska/servo/components/script/task.rs:106:14
  86: script::script_thread::ScriptThread::handle_msg_from_script
             at /home/alaska/servo/components/script/script_thread.rs:2010:22
  87: script::script_thread::ScriptThread::handle_msgs::{{closure}}
             at /home/alaska/servo/components/script/script_thread.rs:1506:65
  88: script::script_thread::ScriptThread::profile_event
             at /home/alaska/servo/components/script/script_thread.rs:1728:13
  89: script::script_thread::ScriptThread::handle_msgs
             at /home/alaska/servo/components/script/script_thread.rs:1497:32
  90: script::script_thread::ScriptThread::start
             at /home/alaska/servo/components/script/script_thread.rs:1059:20
  91: <script::script_thread::ScriptThread as layout_api::ScriptThreadFactory>::create::{{closure}}::{{closure}}
             at /home/alaska/servo/components/script/script_thread.rs:442:39
  92: profile_traits::mem::ProfilerChan::run_with_memory_reporting
             at /home/alaska/servo/components/shared/profile/mem.rs:146:9
  93: <script::script_thread::ScriptThread as layout_api::ScriptThreadFactory>::create::{{closure}}
             at /home/alaska/servo/components/script/script_thread.rs:440:40
  94: std::sys::backtrace::__rust_begin_short_backtrace

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions