Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Unity Webview
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FrameIT
Unity Webview
Commits
8cd56ed2
Verified
Commit
8cd56ed2
authored
10 months ago
by
Björn Eßwein
Browse files
Options
Downloads
Patches
Plain Diff
fixed race condition in tab.getDocument by replacing it with an awaitable property
parent
9ea4b1c5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Runtime/ChromeDevtools/BrowserTab.cs
+17
-12
17 additions, 12 deletions
Runtime/ChromeDevtools/BrowserTab.cs
with
17 additions
and
12 deletions
Runtime/ChromeDevtools/BrowserTab.cs
+
17
−
12
View file @
8cd56ed2
...
@@ -25,7 +25,22 @@ namespace bessw.Unity.WebView.ChromeDevTools
...
@@ -25,7 +25,22 @@ namespace bessw.Unity.WebView.ChromeDevTools
public
Dictionary
<
int
,
DomNodeWrapper
>
domNodes
=
new
Dictionary
<
int
,
DomNodeWrapper
>();
public
Dictionary
<
int
,
DomNodeWrapper
>
domNodes
=
new
Dictionary
<
int
,
DomNodeWrapper
>();
private
DomNodeWrapper
document
;
private
Task
<
DomNodeWrapper
>
_document
;
public
Task
<
DomNodeWrapper
>
Document
{
get
{
if
(
_document
is
null
)
{
_document
=
DomNodeWrapper
.
getDocumentAsync
(
this
);
// unset _document on error, so it will be re-fetched on next access
_document
.
ContinueWith
(
_
=>
_document
=
null
,
TaskContinuationOptions
.
NotOnRanToCompletion
);
}
return
_document
;
}
}
private
Dictionary
<
string
,
Action
<
string
>>
runtimeBindings
=
new
();
private
Dictionary
<
string
,
Action
<
string
>>
runtimeBindings
=
new
();
public
BrowserTab
(
PageTargetInfo
pageTarget
)
public
BrowserTab
(
PageTargetInfo
pageTarget
)
...
@@ -52,7 +67,7 @@ namespace bessw.Unity.WebView.ChromeDevTools
...
@@ -52,7 +67,7 @@ namespace bessw.Unity.WebView.ChromeDevTools
{
{
// clear the domNodes dictionary
// clear the domNodes dictionary
domNodes
.
Clear
();
domNodes
.
Clear
();
document
=
null
;
_
document
=
null
;
}
}
public
IEnumerator
Update
()
public
IEnumerator
Update
()
...
@@ -227,16 +242,6 @@ namespace bessw.Unity.WebView.ChromeDevTools
...
@@ -227,16 +242,6 @@ namespace bessw.Unity.WebView.ChromeDevTools
_
=
devtools
.
SendCommandAsync
(
new
cancelDragging
());
_
=
devtools
.
SendCommandAsync
(
new
cancelDragging
());
}
}
/// <summary>
/// returns the cached document DomNodeWrapper or fetches it from the browser
/// </summary>
/// <returns></returns>
public
async
Task
<
DomNodeWrapper
>
GetDocument
()
{
if
(
document
is
not
null
)
return
document
;
else
return
await
DomNodeWrapper
.
getDocumentAsync
(
this
);
}
/// <summary>
/// <summary>
/// returns the cached node if it exists, otherwise fetches it from the browser
/// returns the cached node if it exists, otherwise fetches it from the browser
/// </summary>
/// </summary>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment