File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ const GM_cookie = (
27
27
details : GMTypes . CookieDetails ,
28
28
done : ( cookie : GMTypes . Cookie [ ] | any , error : any | undefined ) => void
29
29
) => {
30
- // 如果url和域名都没有 ,自动填充当前url
31
- if ( ! details . url && ! details . domain ) {
30
+ // 如果没有url ,自动填充当前url
31
+ if ( ! details . url ) {
32
32
details . url = window . location . href ;
33
33
}
34
34
a . sendMessage ( "GM_cookie" , [ action , details ] )
Original file line number Diff line number Diff line change @@ -164,8 +164,8 @@ export default class GMApi {
164
164
return true ;
165
165
}
166
166
const detail = < GMTypes . CookieDetails > request . params [ 1 ] ;
167
- if ( ! detail . url && ! detail . domain ) {
168
- throw new Error ( "there must be one of url or domain " ) ;
167
+ if ( ! detail . url ) {
168
+ throw new Error ( "there must be one of url" ) ;
169
169
}
170
170
let url : URL = < URL > { } ;
171
171
if ( detail . url ) {
@@ -211,8 +211,8 @@ export default class GMApi {
211
211
if ( detail . domain ) {
212
212
detail . domain = detail . domain . trim ( ) ;
213
213
}
214
- if ( ! detail . url && ! detail . domain ) {
215
- throw new Error ( "there must be one of url or domain " ) ;
214
+ if ( ! detail . url ) {
215
+ throw new Error ( "there must be one of url" ) ;
216
216
}
217
217
if ( typeof detail . partitionKey !== "object" || detail . partitionKey == null ) {
218
218
detail . partitionKey = { } ;
@@ -258,8 +258,8 @@ export default class GMApi {
258
258
break ;
259
259
}
260
260
case "set" : {
261
- if ( ! detail . url || ! detail . name ) {
262
- throw new Error ( "set operation must have name and value" ) ;
261
+ if ( ! detail . url || ! detail . name || ! detail . value ) {
262
+ throw new Error ( "set operation must have url, name and value" ) ;
263
263
}
264
264
await chrome . cookies . set ( {
265
265
url : detail . url ,
You can’t perform that action at this time.
0 commit comments