Skip to content

Question: Object.freeze(Object) usage within sample #173

Open
@jaredperreault-okta

Description

@jaredperreault-okta

The "most basic" sample Win32_GettingStarted includes this line

// <Scripting>
// Step 5 - Scripting
// Schedule an async task to add initialization script that freezes the Object object
webview->AddScriptToExecuteOnDocumentCreated(L"Object.freeze(Object);", nullptr);

This line of javascript freezes the Object prototype, making it immutable. This causes any website which includes polyfills that extend the Object prototype to throw an error (and presumably not render anything). Polyfills are common place in web development. (More details MicrosoftEdge/WebView2Feedback#2035).

Is there a specific reason this sample recommends freezing the Object prototype?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions