Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.2.44 TypeError: Body has already been consumed #1547

Closed
ivanceras opened this issue May 20, 2019 · 1 comment
Closed

Version 0.2.44 TypeError: Body has already been consumed #1547

ivanceras opened this issue May 20, 2019 · 1 comment
Labels

Comments

@ivanceras
Copy link

ivanceras commented May 20, 2019

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	addons.webextension.screenshots@mozilla.org	WARN	Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
    1558331865061	addons.webextension.screenshots@mozilla.org	WARN	Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
    1558331865061	addons.webextension.screenshots@mozilla.org	WARN	Loading extension 'screenshots@mozilla.org': 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'
@ivanceras ivanceras added the bug label May 20, 2019
@alexcrichton
Copy link
Contributor

Thanks for the report! After some testing I believe this is the same issue as #1544, so since that is merged I'm going to close this. (I think I've also confirmed that this works locally)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants