MicrosoftEdge / MicrosoftEdge/WebView2Samples
Question: Object.freeze(Object) usage within sample
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1k
- Forks
- 521
- Avg merge
- 13m
- Merged PRs (30d)
- 1
Description
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 https://github.com/MicrosoftEdge/WebView2Feedback/issues/2035).
Is there a specific reason this sample recommends freezing the Object prototype?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with GettingStartedGuides/Win32_GettingStarted/HelloWebView.cpp around line 159 and review the linked WebView2Feedback issue 2035. Reproduce the sample with a site using an Object polyfill, then determine the rationale for freezing Object; done should be a documented explanation or a clearly justified sample change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, javascript
- Domain
- desktop, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100