Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fc-pregmod
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
pregmodfan
fc-pregmod
Commits
b3e847b4
Commit
b3e847b4
authored
4 years ago
by
lowercasedonkey
Browse files
Options
Downloads
Patches
Plain Diff
autofix
parent
cd9e886e
No related branches found
No related tags found
1 merge request
!7472
Fixes for nursery, tweaks.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/004-base/000-proxies.js
+10
-10
10 additions, 10 deletions
src/004-base/000-proxies.js
with
10 additions
and
10 deletions
src/004-base/000-proxies.js
+
10
−
10
View file @
b3e847b4
(
function
()
{
(
function
()
{
const
readOnlySymbol
=
Symbol
(
"
readonly proxy
"
);
const
readOnlySymbol
=
Symbol
(
"
readonly proxy
"
);
globalThis
.
createReadonlyProxy
=
function
(
target
)
{
globalThis
.
createReadonlyProxy
=
function
(
target
)
{
if
(
target
==
null
)
return
target
;
//intentionally ==
if
(
target
==
null
)
{
return
target
;
}
//
intentionally ==
if
(
target
[
readOnlySymbol
])
{
return
target
;
}
if
(
target
[
readOnlySymbol
])
{
return
target
;
}
if
(
_
.
isArray
(
target
))
{
if
(
_
.
isArray
(
target
))
{
return
new
Proxy
(
target
,
{
return
new
Proxy
(
target
,
{
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
const
val
=
o
[
prop
];
const
val
=
o
[
prop
];
if
(
typeof
val
===
'
function
'
)
{
if
(
typeof
val
===
'
function
'
)
{
if
([
'
push
'
,
'
unshift
'
,
'
pop
'
].
includes
(
prop
))
{
if
([
'
push
'
,
'
unshift
'
,
'
pop
'
].
includes
(
prop
))
{
return
function
()
{
return
function
()
{
throw
Error
(
"
Cannot modify a readonly array
"
);
throw
Error
(
"
Cannot modify a readonly array
"
);
}
}
;
}
}
return
val
.
bind
(
target
);
return
val
.
bind
(
target
);
}
}
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
};
};
const
cheaterSymbol
=
Symbol
(
"
cheating proxy
"
);
const
cheaterSymbol
=
Symbol
(
"
cheating proxy
"
);
globalThis
.
createCheatProxy
=
function
(
target
)
{
globalThis
.
createCheatProxy
=
function
(
target
)
{
if
(
target
==
null
)
return
target
;
//intentionally ==
if
(
target
==
null
)
{
return
target
;
}
//
intentionally ==
if
(
target
[
cheaterSymbol
])
{
return
target
;
}
if
(
target
[
cheaterSymbol
])
{
return
target
;
}
if
(
_
.
isArray
(
target
))
{
if
(
_
.
isArray
(
target
))
{
return
new
Proxy
(
target
,
{
return
new
Proxy
(
target
,
{
...
@@ -53,12 +53,12 @@
...
@@ -53,12 +53,12 @@
const
val
=
o
[
prop
];
const
val
=
o
[
prop
];
if
(
typeof
val
===
'
function
'
)
{
if
(
typeof
val
===
'
function
'
)
{
if
([
'
push
'
,
'
unshift
'
,
'
pop
'
].
includes
(
prop
))
{
if
([
'
push
'
,
'
unshift
'
,
'
pop
'
].
includes
(
prop
))
{
return
function
(
el
)
{
return
function
(
el
)
{
const
retval
=
Array
.
prototype
[
prop
].
apply
(
o
,
arguments
);
const
retval
=
Array
.
prototype
[
prop
].
apply
(
o
,
arguments
);
//Make sure we set cheater after calling the function
//
Make sure we set cheater after calling the function
State
.
variables
.
cheater
=
1
;
//Can't use `V` because it probably points to a proxy.
State
.
variables
.
cheater
=
1
;
//
Can't use `V` because it probably points to a proxy.
return
retval
;
return
retval
;
}
}
;
}
}
return
val
.
bind
(
target
);
return
val
.
bind
(
target
);
}
}
...
@@ -66,12 +66,12 @@
...
@@ -66,12 +66,12 @@
},
},
set
:
function
(
o
,
prop
,
value
)
{
set
:
function
(
o
,
prop
,
value
)
{
o
[
prop
]
=
value
;
o
[
prop
]
=
value
;
State
.
variables
.
cheater
=
1
;
//Can't use `V` because it probably points to a proxy.
State
.
variables
.
cheater
=
1
;
//
Can't use `V` because it probably points to a proxy.
return
true
;
return
true
;
},
},
deleteProperty
:
function
(
o
,
prop
)
{
deleteProperty
:
function
(
o
,
prop
)
{
delete
o
[
prop
];
delete
o
[
prop
];
State
.
variables
.
cheater
=
1
;
//Can't use `V` because it probably points to a proxy.
State
.
variables
.
cheater
=
1
;
//
Can't use `V` because it probably points to a proxy.
return
true
;
return
true
;
}
}
});
});
...
...
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