зеркало из https://github.com/Azure/ms-rest-js.git
Merge pull request #475 from Zlatkovsky/master
Wrap trusted-types policy creation in a try/catch
This commit is contained in:
Коммит
af47b4a387
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## 2.6.4 - (2022-11-15)
|
||||
|
||||
- Wrap Trusted Types policy-creation in a try/catch.
|
||||
|
||||
## 2.6.2 - (2022-07-28)
|
||||
|
||||
- Address Trusted Types compliance issue.
|
||||
|
|
|
@ -7,7 +7,7 @@ export const Constants = {
|
|||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
msRestVersion: "2.6.3",
|
||||
msRestVersion: "2.6.4",
|
||||
|
||||
/**
|
||||
* Specifies HTTP.
|
||||
|
|
|
@ -10,10 +10,14 @@ const parser = new DOMParser();
|
|||
// according to the spec. There are no HTML/XSS security concerns on the usage of
|
||||
// parseFromString() here.
|
||||
let ttPolicy: Pick<TrustedTypePolicy, "createHTML"> | undefined;
|
||||
if (typeof self.trustedTypes !== "undefined") {
|
||||
ttPolicy = self.trustedTypes.createPolicy("@azure/ms-rest-js#xml.browser", {
|
||||
createHTML: (s) => s,
|
||||
});
|
||||
try {
|
||||
if (typeof self.trustedTypes !== "undefined") {
|
||||
ttPolicy = self.trustedTypes.createPolicy("@azure/ms-rest-js#xml.browser", {
|
||||
createHTML: (s) => s,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Could not create trusted types policy "@azure/ms-rest-js#xml.browser"');
|
||||
}
|
||||
|
||||
export function parseXML(str: string): Promise<any> {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"email": "azsdkteam@microsoft.com",
|
||||
"url": "https://github.com/Azure/ms-rest-js"
|
||||
},
|
||||
"version": "2.6.3",
|
||||
"version": "2.6.4",
|
||||
"description": "Isomorphic client Runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
|
||||
"tags": [
|
||||
"isomorphic",
|
||||
|
|
Загрузка…
Ссылка в новой задаче