add hw2
This commit is contained in:
23
node_modules/chromium-bidi/lib/esm/bidiMapper/modules/permissions/PermissionsProcessor.d.ts
generated
vendored
Normal file
23
node_modules/chromium-bidi/lib/esm/bidiMapper/modules/permissions/PermissionsProcessor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright 2024 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { CdpClient } from '../../../cdp/CdpClient.js';
|
||||
import { type EmptyResult, type Permissions } from '../../../protocol/protocol.js';
|
||||
export declare class PermissionsProcessor {
|
||||
#private;
|
||||
constructor(browserCdpClient: CdpClient);
|
||||
setPermissions(params: Permissions.SetPermissionParameters): Promise<EmptyResult>;
|
||||
}
|
||||
50
node_modules/chromium-bidi/lib/esm/bidiMapper/modules/permissions/PermissionsProcessor.js
generated
vendored
Normal file
50
node_modules/chromium-bidi/lib/esm/bidiMapper/modules/permissions/PermissionsProcessor.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright 2024 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { InvalidArgumentException, } from '../../../protocol/protocol.js';
|
||||
export class PermissionsProcessor {
|
||||
#browserCdpClient;
|
||||
constructor(browserCdpClient) {
|
||||
this.#browserCdpClient = browserCdpClient;
|
||||
}
|
||||
async setPermissions(params) {
|
||||
try {
|
||||
const userContextId = params['goog:userContext'] ||
|
||||
params.userContext;
|
||||
await this.#browserCdpClient.sendCommand('Browser.setPermission', {
|
||||
origin: params.origin,
|
||||
browserContextId: userContextId && userContextId !== 'default'
|
||||
? userContextId
|
||||
: undefined,
|
||||
permission: {
|
||||
name: params.descriptor.name,
|
||||
},
|
||||
setting: params.state,
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
if (err.message ===
|
||||
`Permission can't be granted to opaque origins.`) {
|
||||
// Return success if the origin is not valid (does not match any
|
||||
// existing origins).
|
||||
return {};
|
||||
}
|
||||
throw new InvalidArgumentException(err.message);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=PermissionsProcessor.js.map
|
||||
1
node_modules/chromium-bidi/lib/esm/bidiMapper/modules/permissions/PermissionsProcessor.js.map
generated
vendored
Normal file
1
node_modules/chromium-bidi/lib/esm/bidiMapper/modules/permissions/PermissionsProcessor.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PermissionsProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/permissions/PermissionsProcessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,wBAAwB,GAGzB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,OAAO,oBAAoB;IAC/B,iBAAiB,CAAY;IAE7B,YAAY,gBAA2B;QACrC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,MAA2C;QAE3C,IAAI,CAAC;YACH,MAAM,aAAa,GAChB,MAAwC,CAAC,kBAAkB,CAAC;gBAC7D,MAAM,CAAC,WAAW,CAAC;YACrB,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,uBAAuB,EAAE;gBAChE,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,gBAAgB,EACd,aAAa,IAAI,aAAa,KAAK,SAAS;oBAC1C,CAAC,CAAC,aAAa;oBACf,CAAC,CAAC,SAAS;gBACf,UAAU,EAAE;oBACV,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;iBAC7B;gBACD,OAAO,EAAE,MAAM,CAAC,KAAK;aACtB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IACG,GAAa,CAAC,OAAO;gBACtB,gDAAgD,EAChD,CAAC;gBACD,gEAAgE;gBAChE,qBAAqB;gBACrB,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,MAAM,IAAI,wBAAwB,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
||||
Reference in New Issue
Block a user