Skip to content

Version 0.2.44 TypeError: Body has already been consumed #1547

@ivanceras

Description

@ivanceras

Describe the Bug

version 0.2.42 - works
version 0.2.43 - works
version 0.2.44 - error

I don't know which specific part of this code that triggers the error.
This is the test code.

#[wasm_bindgen_test]
fn click_event() {
    console_error_panic_hook::set_once();

    let document = web_sys::window().unwrap().document().unwrap();
    let body = document.body().unwrap();

    let clicked = Rc::new(Cell::new(false));
    let clicked_clone = Rc::clone(&clicked);

    let elem_id = "click-on-div";
    let vdiv: Node<()> = div([id(elem_id),
                              onclick(move |_| {
                                  console::log_1(&"clicked event called".into());
                                  clicked_clone.set(true);
                              })],
                             []);

    let _dom_updater =
        DomUpdater::new_append_to_mount(&simple_program(), vdiv, &body);

    let click_event = web_sys::MouseEvent::new("click").unwrap();

    let div = document.get_element_by_id(&elem_id).unwrap();

    (EventTarget::from(div)).dispatch_event(&click_event)
                            .unwrap();

    assert_eq!(*clicked, Cell::new(true));
}

The code can be found in here

Steps to Reproduce

Locking the exact version in Cargo.toml, then retest for each version changes
wasm-bindgen = "=0.2.42"
wasm-bindgen = "=0.2.43"
wasm-bindgen = "=0.2.44"

If applicable, add a link to a test case (as a zip file or link to a repository we can clone).

Expected Behavior

It should not break the previous version with minor patch

Actual Behavior

It breaks in minor patch 0.2.44

Additional Context

Here is the log I got from geckodriver:

driver status: signal: 9                          
driver stdout:
    1558331864734	mozrunner::runner	INFO	Running command: "/usr/bin/firefox" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.jLF5CTSDCtSQ"
    1558331865061	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Invalid extension permission: mozillaAddons
    1558331865061	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Invalid extension permission: resource://pdf.js/
    1558331865061	[email protected]	WARN	Loading extension '[email protected]': Reading manifest: Invalid extension permission: about:reader*
    1558331866293	Marionette	INFO	Listening on port 43087
    1558331886636	Marionette	INFO	Stopped listening on port 43087

driver stderr:
    *** You are running in headless mode.
    JavaScript error: http://127.0.0.1:41115/wasm-bindgen-test, line 1962: TypeError: Body has already been consumed.
    [Parent 25535, Gecko_IOThread] WARNING: pipe error (63): Connection reset by peer: file /build/firefox-OLGGCZ/firefox-66.0.5+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 357
    [Parent 25535, Gecko_IOThread] WARNING: pipe error (65): Connection reset by peer: file /build/firefox-OLGGCZ/firefox-66.0.5+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 357

error: some tests failed                          
error: test failed, to rerun pass '--test create_element_tests'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions