Repository: flutter
Issue: [Web][Url_launcher]: Several links on a page throws rendering error.
Labels: c: regression,platform-web,p: url_launcher,package,c: rendering,a: error message,has reproducible steps,P2,found in release: 3.10,found in release: 3.11,team-web,triaged-web

Hi,

I was testing the fix to https://github.com/flutter/flutter/issues/87686 and I notice that if I scroll up and down or drag the scrollbar fast I get a setState error. I also notice the platformError warning.

![image](https://user-images.githubusercontent.com/81489824/129939757-0d6bf0d1-a99b-403c-8ad8-c8997be57114.png)


<details>
  <summary>Error detail #2</summary>

html_dart2js.dart:40035 Flutter was unable to create enough overlay surfaces. This is usually caused by too many platform views being displayed at once. You may experience incorrect rendering.
warn @ html_dart2js.dart:40035
getSurface @ surface_factory.dart:73
[_ensureOverlayInitialized] @ embedded_views.dart:467
prerollCompositeEmbeddedView @ embedded_views.dart:85
preroll @ layer.dart:583
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:493
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:237
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:493
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:114
preroll @ layer_tree.dart:32
(anonymous) @ layer_tree.dart:96
timeAction @ profiler.dart:37
raster @ layer_tree.dart:95
draw @ rasterizer.dart:33
render @ platform_dispatcher.dart:577
render @ window.dart:93
compositeFrame @ view.dart:229
drawFrame @ binding.dart:457
drawFrame @ binding.dart:883
[_handlePersistentFrameCallback] @ binding.dart:319
[_invokeFrameCallback] @ binding.dart:1143
handleDrawFrame @ binding.dart:1080
[_handleDrawFrame] @ binding.dart:996
invoke @ platform_dispatcher.dart:1003
invokeOnDrawFrame @ platform_dispatcher.dart:157
(anonymous) @ engine.dart:440
requestAnimationFrame (async)
[_requestAnimationFrame] @ html_dart2js.dart:32156
[dartx.requestAnimationFrame] @ html_dart2js.dart:32142
(anonymous) @ engine.dart:410
scheduleFrame @ platform_dispatcher.dart:536
scheduleFrame @ window.dart:90
scheduleFrame @ binding.dart:791
(anonymous) @ binding.dart:992
[_invokeFrameCallback] @ binding.dart:1143
handleDrawFrame @ binding.dart:1088
(anonymous) @ binding.dart:863
internalCallback @ isolate_helper.dart:48
setTimeout (async)
_isolate_helper.TimerImpl.new @ isolate_helper.dart:55
_createTimer @ async_patch.dart:186
createTimer @ zone.dart:1711
new @ timer.dart:45
run @ timer.dart:81
scheduleWarmUpFrame @ binding.dart:861
(anonymous) @ binding.dart:1037
runApp @ binding.dart:1037
main$ @ main.dart:7
main @ web_entrypoint.dart:19
(anonymous) @ async_patch.dart:45
runUnary @ zone.dart:1687
handleValue @ future_impl.dart:160
handleValueCallback @ future_impl.dart:767
_propagateToListeners @ future_impl.dart:796
[_completeWithValue] @ future_impl.dart:602
(anonymous) @ future.dart:401
runUnary @ zone.dart:1687
handleValue @ future_impl.dart:160
handleValueCallback @ future_impl.dart:767
_propagateToListeners @ future_impl.dart:796
[_completeWithValue] @ future_impl.dart:602
(anonymous) @ future_impl.dart:640
_microtaskLoop @ schedule_microtask.dart:40
_startMicrotaskLoop @ schedule_microtask.dart:49
(anonymous) @ async_patch.dart:166
Promise.then (async)
_scheduleImmediateWithPromise @ async_patch.dart:164
_scheduleImmediate @ async_patch.dart:136
_scheduleAsyncCallback @ schedule_microtask.dart:69
_rootScheduleMicrotask @ zone.dart:1495
scheduleMicrotask @ zone.dart:1707
[_asyncCompleteWithValue] @ future_impl.dart:639
[_asyncComplete] @ future_impl.dart:634
complete @ future_impl.dart:46
(anonymous) @ js_util.dart:229
Promise.then (async)
promiseToFuture @ js_util.dart:241
[dartx.arrayBuffer] @ html_dart2js.dart:1682
[_getArrayBuffer] @ fonts.dart:176
runUnary @ zone.dart:1687
handleValue @ future_impl.dart:160
handleValueCallback @ future_impl.dart:767
_propagateToListeners @ future_impl.dart:796
[_completeWithValue] @ future_impl.dart:602
(anonymous) @ future_impl.dart:640
_microtaskLoop @ schedule_microtask.dart:40
_startMicrotaskLoop @ schedule_microtask.dart:49
(anonymous) @ async_patch.dart:166
Promise.then (async)
_scheduleImmediateWithPromise @ async_patch.dart:164
_scheduleImmediate @ async_patch.dart:136
_scheduleAsyncCallback @ schedule_microtask.dart:69
_rootScheduleMicrotask @ zone.dart:1495
scheduleMicrotask @ zone.dart:1707
[_asyncCompleteWithValue] @ future_impl.dart:639
[_asyncComplete] @ future_impl.dart:634
complete @ future_impl.dart:46
(anonymous) @ js_util.dart:229
Promise.then (async)
promiseToFuture @ js_util.dart:241
[dartx.fetch] @ html_dart2js.dart:32915
httpFetch @ util.dart:559
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
httpFetch @ util.dart:558
_registerFont @ fonts.dart:148
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
[_registerFont] @ fonts.dart:145
registerFonts @ fonts.dart:127
(anonymous) @ async_patch.dart:45
runUnary @ zone.dart:1687
handleValue @ future_impl.dart:160
handleValueCallback @ future_impl.dart:767
_propagateToListeners @ future_impl.dart:796
[_completeWithValue] @ future_impl.dart:602
(anonymous) @ future_impl.dart:640
_microtaskLoop @ schedule_microtask.dart:40
_startMicrotaskLoop @ schedule_microtask.dart:49
(anonymous) @ async_patch.dart:166
Promise.then (async)
_scheduleImmediateWithPromise @ async_patch.dart:164
_scheduleImmediate @ async_patch.dart:136
_scheduleAsyncCallback @ schedule_microtask.dart:69
_rootScheduleMicrotask @ zone.dart:1495
scheduleMicrotask @ zone.dart:1707
[_asyncCompleteWithValue] @ future_impl.dart:639
[_asyncComplete] @ future_impl.dart:634
complete @ future_impl.dart:46
(anonymous) @ html_dart2js.dart:18195
_checkAndCall @ operations.dart:334
dcall @ operations.dart:339
(anonymous) @ html_dart2js.dart:37307
load (async)
[_addEventListener] @ html_dart2js.dart:15822
[dartx.addEventListener] @ html_dart2js.dart:15810
[_tryResume] @ html_dart2js.dart:37361
_EventStreamSubscription.new @ html_dart2js.dart:37308
listen @ html_dart2js.dart:37208
request @ html_dart2js.dart:18182
load @ assets.dart:58
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
load @ assets.dart:54
registerFonts @ fonts.dart:95
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
registerFonts @ fonts.dart:91
webOnlySetAssetManager @ initialization.dart:68
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
webOnlySetAssetManager @ initialization.dart:49
_initializePlatform @ initialization.dart:33
(anonymous) @ async_patch.dart:45
runUnary @ zone.dart:1687
handleValue @ future_impl.dart:160
handleValueCallback @ future_impl.dart:767
_propagateToListeners @ future_impl.dart:796
[_completeWithValue] @ future_impl.dart:602
(anonymous) @ future_impl.dart:640
_microtaskLoop @ schedule_microtask.dart:40
_startMicrotaskLoop @ schedule_microtask.dart:49
(anonymous) @ async_patch.dart:166
Promise.then (async)
_scheduleImmediateWithPromise @ async_patch.dart:164
_scheduleImmediate @ async_patch.dart:136
_scheduleAsyncCallback @ schedule_microtask.dart:69
_rootScheduleMicrotask @ zone.dart:1495
scheduleMicrotask @ zone.dart:1707
[_asyncCompleteWithValue] @ future_impl.dart:639
[_asyncComplete] @ future_impl.dart:634
complete @ future_impl.dart:46
(anonymous) @ initialization.dart:115
_checkAndCall @ operations.dart:334
dcall @ operations.dart:339
ret @ js_patch.dart:412
Promise.then (async)
(anonymous) @ initialization.dart:112
runUnary @ zone.dart:1687
handleValue @ future_impl.dart:160
handleValueCallback @ future_impl.dart:767
_propagateToListeners @ future_impl.dart:796
[_completeWithValue] @ future_impl.dart:602
(anonymous) @ future_impl.dart:640
_microtaskLoop @ schedule_microtask.dart:40
_startMicrotaskLoop @ schedule_microtask.dart:49
(anonymous) @ async_patch.dart:166
Promise.then (async)
_scheduleImmediateWithPromise @ async_patch.dart:164
_scheduleImmediate @ async_patch.dart:136
_scheduleAsyncCallback @ schedule_microtask.dart:69
_rootScheduleMicrotask @ zone.dart:1495
scheduleMicrotask @ zone.dart:1707
[_asyncCompleteWithValue] @ future_impl.dart:639
[_asyncComplete] @ future_impl.dart:634
_Future.immediate @ future_impl.dart:283
value @ future.dart:256
(anonymous) @ internal.dart:142
run @ zone.dart:1681
get nullFuture @ internal.dart:142
desc.get @ operations.dart:835
cancel @ html_dart2js.dart:37318
(anonymous) @ initialization.dart:144
_checkAndCall @ operations.dart:334
dcall @ operations.dart:339
(anonymous) @ html_dart2js.dart:37307
load (async)
[_addEventListener] @ html_dart2js.dart:15822
[dartx.addEventListener] @ html_dart2js.dart:15810
[_tryResume] @ html_dart2js.dart:37361
_EventStreamSubscription.new @ html_dart2js.dart:37308
listen @ html_dart2js.dart:37208
_startDownloadingCanvasKit @ initialization.dart:143
initializeCanvasKit @ initialization.dart:105
_initializePlatform @ initialization.dart:29
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
_initializePlatform @ initialization.dart:21
webOnlyInitializePlatform @ initialization.dart:11
main @ web_entrypoint.dart:15
runBody @ async_patch.dart:84
_async @ async_patch.dart:123
main$ @ web_entrypoint.dart:13
(anonymous) @ main_module.bootstrap.js:19
window.$dartRunMain @ main_module.bootstrap.js:18
(anonymous) @ VM265:1
runMain @ client.js:8452
(anonymous) @ client.js:24130
(anonymous) @ client.js:4461
call$2 @ client.js:11511
_asyncStartSync @ client.js:4425
$call$body$main__closure @ client.js:24142
call$1 @ client.js:24069
_rootRunUnary @ client.js:4823
runUnary$2$2 @ client.js:12879
runUnaryGuarded$1$2 @ client.js:12826
_sendData$1 @ client.js:12416
_add$1 @ client.js:12362
_add$1 @ client.js:12695
_handleData$2 @ client.js:12756
_handleData$1 @ client.js:12721
eval @ VM257:3
_rootRunUnary @ client.js:4823
runUnary$2$2 @ client.js:12879
runUnaryGuarded$1$2 @ client.js:12826
_sendData$1 @ client.js:12416
_add$1 @ client.js:12362
_sendData$1 @ client.js:12201
add$1 @ client.js:12082
eval @ VM252:3
_rootRunUnary @ client.js:4823
runUnary$2$2 @ client.js:12879
runUnaryGuarded$1$2 @ client.js:12826
_sendData$1 @ client.js:12416
_add$1 @ client.js:12362
_sendData$1 @ client.js:12201
add$1 @ client.js:12082
add$1 @ client.js:23581
call$1 @ client.js:23874
call$1 @ client.js:18042
_rootRunUnary @ client.js:4829
runUnary$2$2 @ client.js:12879
runUnaryGuarded$1$2 @ client.js:12826
call$1 @ client.js:13016
invokeClosure @ client.js:1524
(anonymous) @ client.js:1543
Show 75 more frames
canvaskit.js:180 WARNING: Too many active WebGL contexts. Oldest context will be lost.
a.wf.a.getContext @ canvaskit.js:180
ha @ canvaskit.js:180
a.GetWebGLContext @ canvaskit.js:15
[_createNewCanvas] @ surface.dart:296
createOrUpdateSurfaces @ surface.dart:175
[_ensureOverlayInitialized] @ embedded_views.dart:471
prerollCompositeEmbeddedView @ embedded_views.dart:85
preroll @ layer.dart:583
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:493
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:237
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:493
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:356
prerollChildren @ layer.dart:125
preroll @ layer.dart:114
preroll @ layer_tree.dart:32
(anonymous) @ layer_tree.dart:96
timeAction @ profiler.dart:37
raster @ layer_tree.dart:95
draw @ rasterizer.dart:33
render @ platform_dispatcher.dart:577
render @ window.dart:93
compositeFrame @ view.dart:229
drawFrame @ binding.dart:457
drawFrame @ binding.dart:883
[_handlePersistentFrameCallback] @ binding.dart:319
[_invokeFrameCallback] @ binding.dart:1143
handleDrawFrame @ binding.dart:1080
[_handleDrawFrame] @ binding.dart:996
invoke @ platform_dispatcher.dart:1003
invokeOnDrawFrame @ platform_dispatcher.dart:157
(anonymous) @ engine.dart:440
requestAnimationFrame (async)
[_requestAnimationFrame] @ html_dart2js.dart:32156
[dartx.requestAnimationFrame] @ html_dart2js.dart:32142
(anonymous) @ engine.dart:410
scheduleFrame @ platform_dispatcher.dart:536
scheduleFrame @ window.dart:90
scheduleFrame @ binding.dart:791
ensureVisualUpdate @ binding.dart:746
requestVisualUpdate @ object.dart:836
markNeedsPaint @ object.dart:2237
replaceRootLayer @ object.dart:2315
set configuration @ view.dart:94
handleMetricsChanged @ binding.dart:192
handleMetricsChanged @ binding.dart:559
invoke @ platform_dispatcher.dart:1003
invokeOnMetricsChanged @ platform_dispatcher.dart:103
[_metricsDidChange] @ dom_renderer.dart:481
_checkAndCall @ operations.dart:334
dcall @ operations.dart:339
(anonymous) @ html_dart2js.dart:37307
Show 19 more frames
80WebGL: INVALID_OPERATION: bindTexture: object does not belong to this context
</details>

<details>
  <summary>Error detail #1</summary>

Error: setState() called after dispose(): _PlatformViewLinkState#9bc98(lifecycle state: defunct, not mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree
(e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState()
from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another
solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in
the tree.
This error might indicate a memory leak if setState() is being called because another object is retaining a reference to
this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to
this object during dispose().
    at Object.throw_ [as throw] (http://localhost:49648/dart_sdk.js:5087:11)
    at http://localhost:49648/packages/flutter/src/widgets/widget_inspector.dart.lib.js:10730:23
    at platform_view$._PlatformViewLinkState.new.setState
    (http://localhost:49648/packages/flutter/src/widgets/widget_inspector.dart.lib.js:10736:28)
    at platform_view$._PlatformViewLinkState.new.[_onPlatformViewCreated]
    (http://localhost:49648/packages/flutter/src/widgets/platform_view.dart.lib.js:993:12)
    at http://localhost:49648/packages/url_launcher_web/src/link.dart.lib.js:257:12
    at _RootZone.runUnary (http://localhost:49648/dart_sdk.js:38527:59)
    at _FutureListener.then.handleValue (http://localhost:49648/dart_sdk.js:33727:29)
    at handleValueCallback (http://localhost:49648/dart_sdk.js:34279:49)
    at Function._propagateToListeners (http://localhost:49648/dart_sdk.js:34317:17)
    at _Future.new.[_completeWithValue] (http://localhost:49648/dart_sdk.js:34165:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:49648/dart_sdk.js:34186:35)
    at Object._microtaskLoop (http://localhost:49648/dart_sdk.js:38794:13)
    at _startMicrotaskLoop (http://localhost:49648/dart_sdk.js:38800:13)
    at http://localhost:49648/dart_sdk.js:34533:9
</details>

<details>
  <summary>Flutter doctor</summary>

[√] Flutter (Channel master, 2.5.0-7.0.pre.110, on Microsoft Windows [Version 10.0.17763.2114], locale en-IE)
    • Flutter version 2.5.0-7.0.pre.110 at C:\Code\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3572a7e8b7 (21 hours ago), 2021-08-17 11:52:05 -0700
    • Engine revision 7dc8eba6ae
    • Dart version 2.15.0 (build 2.15.0-15.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Omega\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • CHROME_EXECUTABLE = C:\Code\FlutterTesting\ChromeCORS.bat

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)

[√] VS Code (version 1.59.0)
    • VS Code at C:\Users\Omega\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.25.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 91.0.864.70

• No issues found!
</details>