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

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

Open
jaredperreault-okta opened this issue Feb 24, 2023 · 2 comments
Open

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

jaredperreault-okta opened this issue Feb 24, 2023 · 2 comments

Comments

@jaredperreault-okta
Copy link

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?

@champnic
Copy link
Member

This code is just an example of injecting script, not a recommendation. I've opened a bug on our side to consider making the example more clear and less intrusive. Thanks!

@tmackay-cenet
Copy link

This very line seems to have made it into production for the MS Remote Help client (confirmed by debugger). We're having trouble with polyfills, too.

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

No branches or pull requests

3 participants