Closed Bug 1772710 Opened 2 years ago Closed 2 years ago

Impossible to create ReadableStream in a content script

Categories

(Core :: DOM: Streams, defect)

Firefox 100
defect

Tracking

()

RESOLVED DUPLICATE of bug 1757836

People

(Reporter: firefboxer, Unassigned)

Details

Attachments

(1 file)

588 bytes, application/x-7z-compressed
Details
Attached file rs-error-demo.7z

Steps to reproduce:

I created ReadableStream in a content script

try {
    const readableStream = new ReadableStream({
        async start(controller) {
            controller.enqueue(new Uint8Array([116, 101, 120, 116]));
            controller.close();
        }
    });
    new Response(readableStream).text().then(console.log);
} catch (e) {
    console.error(e);
}

Actual results:

Error: Permission denied to access property "autoAllocateChunkSize"

Expected results:

The console should log "text".

The Bugbug bot thinks this bug should belong to the 'Core::JavaScript Engine' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → JavaScript Engine
Product: Firefox → Core

To reproduce the bug install the extension from the attached archive, then open a console on any site.

It works fine in Firefox 91.10.0esr.

But, it does not work in Firefox 100.0.2.

In Firefox 100 it throws the error:

Error: Permission denied to access property "autoAllocateChunkSize"
Component: JavaScript Engine → DOM: Streams
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE

I am not sure if this is just supposed to be an example, but a better way to implement this would be:

new Blob(new Uint8Array([116, 101, 120, 116])).text().then(console.log)

It's just an example.

I really need ReadableStream to stream data from the background script to the content script which will work with a ReadableStream object in stream way.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: