emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.67k stars 3.29k forks source link

The following error is reported when "UTF8ToString" is called when a page loads two WASM files using "iframe" #14957

Open githubRico opened 3 years ago

githubRico commented 3 years ago

Failed to execute 'decode' on 'TextDecoder': The provided ArrayBufferView value must not be shared.

VERSION: 2.0.26

kripken commented 3 years ago

We should be creating a copy before calling TextDecoder, so this sounds like a bug. We'll need a testcase to look into this, though.

githubRico commented 3 years ago

You can load two pages with "iframe" and then call "UTF8ToString".

This is my load code

    <div class="main_item" id="Map2D">
        <iframe src="MapTest.html" id="iframeObj1" name="aaa" onclick="aa()" width="100%" height="100%" frameborder="0" style="top: 8vh;"></iframe>
    </div>
    <div class="main_item_center" id="Map3D" style="">
        <iframe src="MapTest.html" id="iframeObj2" name="aaa" onclick="ttt()" width="100%" height="100%" frameborder="0" style="top: 8vh;"></iframe>
    </div>

One of the pages calls "UTF8ToString" and an error occurs

githubRico commented 3 years ago

image Here's the error code The "TextDecoderWrapper" function is not existence in 2.0.9

kripken commented 3 years ago

Could you construct a concrete testcase? Describing how to create one is not as useful as actually providing one, because then me or whoever looks at it will need to try to create something appropriate, but might fail because they don't see something that you do. It's better to let the debugger focus on debugging and not testcase generation.

By "concrete" I mean actual code that can be compiled and run, shared in a gist or a github repo or such.