web-extensions-rs / web-extensions

Rust wrappers for WebExtensions API
https://crates.io/crates/web-extensions
MIT License
32 stars 7 forks source link

add `omnibox` API #12

Open flier opened 1 year ago

flier commented 1 year ago

I have submited two PR #11 and web-extensions-rs/web-extensions-sys#45 for the Omnibox.

It seems the omnibox API is just working, but the tabs API always failed. Are there any example to show how to use those API?

Thanks

wasm-bindgen: imported JS function that was not marked as `catch` threw an error: Cannot read properties of undefined (reading 'then')

Stack:
TypeError: Cannot read properties of undefined (reading 'then')
    at chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search.js:473:36
    at logError (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search.js:220:18)
    at imports.wbg.__wbg_then_cedad20fbbd9418a (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search.js:472:67)
    at js_sys::Promise::then2::h42da66864818ff77 (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search_bg.wasm:wasm-function[873]:0x5fc35)
    at <wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::h9cbeab58abc53f8b (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search_bg.wasm:wasm-function[75]:0x1b34f)
    at web_extensions_sys::tabs::Tabs::query::{{closure}}::hf222e502d3efe2ab (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search_bg.wasm:wasm-function[141]:0x2d1b4)
    at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h28e0ddd67de33149 (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search_bg.wasm:wasm-function[414]:0x496dc)
    at web_extensions::tabs::query::{{closure}}::h1dc67b0f441a35dd (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search_bg.wasm:wasm-function[83]:0x1de93)
    at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hd52ad50bb92c433b (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search_bg.wasm:wasm-function[239]:0x39ef7)
    at new_tab_search::start::{{closure}}::{{closure}}::h7a38e22394eef2ff (chrome-extension://pklmmfgppalepbhoomaoijkjmfnpjmcl/pkg/new_tab_search_bg.wasm:wasm-function[45]:0xaa3c)
logError @ new_tab_search.js:229
imports.wbg.__wbg_then_cedad20fbbd9418a @ new_tab_search.js:472
$js_sys::Promise::then2::h42da66864818ff77 @ new_tab_search_bg.wasm:0x5fc35
$<wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::h9cbeab58abc53f8b @ new_tab_search_bg.wasm:0x1b34f
$web_extensions_sys::tabs::Tabs::query::{{closure}}::hf222e502d3efe2ab @ new_tab_search_bg.wasm:0x2d1b4
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h28e0ddd67de33149 @ new_tab_search_bg.wasm:0x496dc
$web_extensions::tabs::query::{{closure}}::h1dc67b0f441a35dd @ new_tab_search_bg.wasm:0x1de93
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hd52ad50bb92c433b @ new_tab_search_bg.wasm:0x39ef7
$new_tab_search::start::{{closure}}::{{closure}}::h7a38e22394eef2ff @ new_tab_search_bg.wasm:0xaa3c
$<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h3b361e36f2ef7fbe @ new_tab_search_bg.wasm:0x53710
$wasm_bindgen_futures::task::singlethread::Task::run::h8267b0208580ea75 @ new_tab_search_bg.wasm:0x32569
$wasm_bindgen_futures::queue::QueueState::run_all::he37dbfe101599b17 @ new_tab_search_bg.wasm:0x2ef65
$wasm_bindgen_futures::queue::Queue::new::{{closure}}::h07bd828b7aeca5ec @ new_tab_search_bg.wasm:0x5fa3e
$<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h5c784a4fc520c53b @ new_tab_search_bg.wasm:0x54d73
__wbg_adapter_31 @ new_tab_search.js:262
real @ new_tab_search.js:203
Promise.then(异步)
(匿名) @ new_tab_search.js:469
logError @ new_tab_search.js:220
imports.wbg.__wbg_then_11f7a54d67b4bfad @ new_tab_search.js:468
$js_sys::Promise::then::h5d304f8dfceba102 @ new_tab_search_bg.wasm:0x6483e
$wasm_bindgen_futures::queue::Queue::schedule_task::haa0a166b0d2a623c @ new_tab_search_bg.wasm:0x406e4
$wasm_bindgen_futures::task::singlethread::Task::spawn::{{closure}}::h6549f7a765ee1aba @ new_tab_search_bg.wasm:0x6c933
$std::thread::local::LocalKey<T>::try_with::h02e364395813c1f7 @ new_tab_search_bg.wasm:0x4348e
$std::thread::local::LocalKey<T>::with::hcb856129b11b7ec8 @ new_tab_search_bg.wasm:0x59a75
$wasm_bindgen_futures::task::singlethread::Task::spawn::h2a60a621dffc0f66 @ new_tab_search_bg.wasm:0x2d0a8
$wasm_bindgen_futures::spawn_local::h42cfa1d4ede1df26 @ new_tab_search_bg.wasm:0x639da
$new_tab_search::start::{{closure}}::he602402a40d2747b @ new_tab_search_bg.wasm:0x2f4df
$web_extensions::omnibox::OnInputEntered::add_listener::{{closure}}::h968c7b4e2e7f6335 @ new_tab_search_bg.wasm:0x4198f
$<dyn core::ops::function::FnMut<(A,B)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::hf97bfef6da6bd296 @ new_tab_search_bg.wasm:0x3c4a7
__wbg_adapter_28 @ new_tab_search.js:256
real @ new_tab_search.js:203
new_tab_search.js:473 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'then')
    at new_tab_search.js:473:36
    at logError (new_tab_search.js:220:18)
    at imports.wbg.__wbg_then_cedad20fbbd9418a (new_tab_search.js:472:67)
    at js_sys::Promise::then2::h42da66864818ff77 (new_tab_search_bg.wasm:0x5fc35)
    at <wasm_bindgen_futures::JsFuture as core::convert::From<js_sys::Promise>>::from::h9cbeab58abc53f8b (new_tab_search_bg.wasm:0x1b34f)
    at web_extensions_sys::tabs::Tabs::query::{{closure}}::hf222e502d3efe2ab (new_tab_search_bg.wasm:0x2d1b4)
    at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h28e0ddd67de33149 (new_tab_search_bg.wasm:0x496dc)
    at web_extensions::tabs::query::{{closure}}::h1dc67b0f441a35dd (new_tab_search_bg.wasm:0x1de93)
    at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hd52ad50bb92c433b (new_tab_search_bg.wasm:0x39ef7)
    at new_tab_search::start::{{closure}}::{{closure}}::h7a38e22394eef2ff (new_tab_search_bg.wasm:0xaa3c)
flosse commented 1 year ago

I'll have a look at it soon. What browser/version do you use?

flier commented 1 year ago

I'll have a look at it soon. What browser/version do you use?

Chrome 108.0.5359.94 (x86_64)

Thanks