Skip to content

Commit 8eb2376

Browse files
amaitlandcampersau
andcommitted
Apply suggestions from code review
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
1 parent 7ca5c55 commit 8eb2376

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

CefSharp/Internals/LegacyJavaScriptObjectCache.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@ public void InsertOrUpdate(int browserId, IList<JavascriptObject> javascriptObje
2626
{
2727
foreach (var obj in javascriptObjects)
2828
{
29-
if (cache.ContainsKey(obj.Name))
30-
{
31-
cache.Remove(obj.Name);
32-
}
33-
34-
cache.Add(obj.Name, obj);
29+
cache[obj.Name] = obj;
3530
}
3631
}
3732

CefSharp/Internals/PerBrowserJavaScriptObjectCache.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ public void InsertOrUpdate(int browserId, IList<JavascriptObject> javascriptObje
2929

3030
foreach (var obj in javascriptObjects)
3131
{
32-
if (dict.ContainsKey(obj.Name))
33-
{
34-
dict.Remove(obj.Name);
35-
}
36-
37-
dict.Add(obj.Name, obj);
32+
dict[obj.Name] = obj;
3833
}
3934
}
4035

0 commit comments

Comments
 (0)