|
2 | 2 | /* eslint-disable @typescript-eslint/adjacent-overload-signatures */
|
3 | 3 | import { CSSType, ContainerView, EventData, File, Property, Trace, booleanConverter, knownFolders, path } from '@nativescript/core';
|
4 | 4 | import { isEnabledProperty } from '@nativescript/core/ui/core/view';
|
5 |
| -import { metadataViewPort, promisePolyfill, webViewBridge } from './nativescript-webview-bridge-loader'; |
| 5 | +import { metadataViewPort, webViewBridge } from './nativescript-webview-bridge-loader'; |
6 | 6 |
|
7 | 7 | export interface ViewPortProperties {
|
8 | 8 | width?: number | 'device-width';
|
@@ -987,7 +987,7 @@ export abstract class WebViewExtBase extends ContainerView {
|
987 | 987 | const scriptCode = this.generateLoadJavaScriptFileScriptCode(resourceName, filepath);
|
988 | 988 | promiseScriptCodes.push(scriptCode);
|
989 | 989 | if (Trace.isEnabled()) {
|
990 |
| - Trace.write(`WebViewExt.loadJavaScriptFiles() - > Loading javascript file: "${filepath}"`, 'NOTA', Trace.messageType.info); |
| 990 | + Trace.write(`WebViewExt.loadJavaScriptFiles() - > Loading javascript file: "${filepath}" "${scriptCode}"`, 'NOTA', Trace.messageType.info); |
991 | 991 | }
|
992 | 992 | }
|
993 | 993 |
|
@@ -1119,77 +1119,77 @@ export abstract class WebViewExtBase extends ContainerView {
|
1119 | 1119 | /**
|
1120 | 1120 | * Ensure fetch-api is available.
|
1121 | 1121 | */
|
1122 |
| - protected async ensureFetchSupport(): Promise<void> { |
1123 |
| - if (WebViewExtBase.isFetchSupported) { |
1124 |
| - return Promise.resolve(); |
1125 |
| - } |
| 1122 | + // protected async ensureFetchSupport(): Promise<void> { |
| 1123 | + // if (WebViewExtBase.isFetchSupported) { |
| 1124 | + // return Promise.resolve(); |
| 1125 | + // } |
1126 | 1126 |
|
1127 |
| - if (typeof WebViewExtBase.isFetchSupported === 'undefined') { |
1128 |
| - if (Trace.isEnabled()) { |
1129 |
| - Trace.write('WebViewExtBase.ensureFetchSupport() - need to check for fetch support.', 'NOTA', Trace.messageType.info); |
1130 |
| - } |
| 1127 | + // if (typeof WebViewExtBase.isFetchSupported === 'undefined') { |
| 1128 | + // if (Trace.isEnabled()) { |
| 1129 | + // Trace.write('WebViewExtBase.ensureFetchSupport() - need to check for fetch support.', 'NOTA', Trace.messageType.info); |
| 1130 | + // } |
1131 | 1131 |
|
1132 |
| - WebViewExtBase.isFetchSupported = await this.executeJavaScript<boolean>("typeof fetch !== 'undefined'"); |
1133 |
| - } |
| 1132 | + // WebViewExtBase.isFetchSupported = await this.executeJavaScript<boolean>("typeof fetch !== 'undefined'"); |
| 1133 | + // } |
1134 | 1134 |
|
1135 |
| - if (WebViewExtBase.isFetchSupported) { |
1136 |
| - if (Trace.isEnabled()) { |
1137 |
| - Trace.write('WebViewExtBase.ensureFetchSupport() - fetch is supported - polyfill not needed.', 'NOTA', Trace.messageType.info); |
1138 |
| - } |
| 1135 | + // if (WebViewExtBase.isFetchSupported) { |
| 1136 | + // if (Trace.isEnabled()) { |
| 1137 | + // Trace.write('WebViewExtBase.ensureFetchSupport() - fetch is supported - polyfill not needed.', 'NOTA', Trace.messageType.info); |
| 1138 | + // } |
1139 | 1139 |
|
1140 |
| - return; |
1141 |
| - } |
| 1140 | + // return; |
| 1141 | + // } |
1142 | 1142 |
|
1143 |
| - if (Trace.isEnabled()) { |
1144 |
| - Trace.write('WebViewExtBase.ensureFetchSupport() - fetch is not supported - polyfill needed.', 'NOTA', Trace.messageType.info); |
1145 |
| - } |
| 1143 | + // if (Trace.isEnabled()) { |
| 1144 | + // Trace.write('WebViewExtBase.ensureFetchSupport() - fetch is not supported - polyfill needed.', 'NOTA', Trace.messageType.info); |
| 1145 | + // } |
1146 | 1146 |
|
1147 |
| - // return await this.loadFetchPolyfill(); |
1148 |
| - } |
| 1147 | + // return this.loadFetchPolyfill(); |
| 1148 | + // } |
1149 | 1149 |
|
1150 | 1150 | // protected async loadFetchPolyfill() {
|
1151 |
| - // await this.executeJavaScript<void>(fetchPolyfill, false); |
| 1151 | + // // await this.executeJavaScript<void>(fetchPolyfill, false); |
1152 | 1152 | // }
|
1153 | 1153 |
|
1154 | 1154 | /**
|
1155 | 1155 | * Older Android WebView don't support promises.
|
1156 | 1156 | * Inject the promise-polyfill if needed.
|
1157 | 1157 | */
|
1158 |
| - protected async ensurePromiseSupport() { |
1159 |
| - if (WebViewExtBase.isPromiseSupported) { |
1160 |
| - return; |
1161 |
| - } |
| 1158 | + // protected async ensurePromiseSupport() { |
| 1159 | + // if (WebViewExtBase.isPromiseSupported) { |
| 1160 | + // return; |
| 1161 | + // } |
1162 | 1162 |
|
1163 |
| - if (typeof WebViewExtBase.isPromiseSupported === 'undefined') { |
1164 |
| - if (Trace.isEnabled()) { |
1165 |
| - Trace.write('WebViewExtBase.ensurePromiseSupport() - need to check for promise support.', 'NOTA', Trace.messageType.info); |
1166 |
| - } |
| 1163 | + // if (typeof WebViewExtBase.isPromiseSupported === 'undefined') { |
| 1164 | + // if (Trace.isEnabled()) { |
| 1165 | + // Trace.write('WebViewExtBase.ensurePromiseSupport() - need to check for promise support.', 'NOTA', Trace.messageType.info); |
| 1166 | + // } |
1167 | 1167 |
|
1168 |
| - WebViewExtBase.isPromiseSupported = await this.executeJavaScript<boolean>("typeof Promise !== 'undefined'"); |
1169 |
| - } |
| 1168 | + // WebViewExtBase.isPromiseSupported = await this.executeJavaScript<boolean>("typeof Promise !== 'undefined'"); |
| 1169 | + // } |
1170 | 1170 |
|
1171 |
| - if (WebViewExtBase.isPromiseSupported) { |
1172 |
| - if (Trace.isEnabled()) { |
1173 |
| - Trace.write('WebViewExtBase.ensurePromiseSupport() - promise is supported - polyfill not needed.', 'NOTA', Trace.messageType.info); |
1174 |
| - } |
| 1171 | + // if (WebViewExtBase.isPromiseSupported) { |
| 1172 | + // if (Trace.isEnabled()) { |
| 1173 | + // Trace.write('WebViewExtBase.ensurePromiseSupport() - promise is supported - polyfill not needed.', 'NOTA', Trace.messageType.info); |
| 1174 | + // } |
1175 | 1175 |
|
1176 |
| - return; |
1177 |
| - } |
| 1176 | + // return; |
| 1177 | + // } |
1178 | 1178 |
|
1179 |
| - if (Trace.isEnabled()) { |
1180 |
| - Trace.write('WebViewExtBase.ensurePromiseSupport() - promise is not supported - polyfill needed.', 'NOTA', Trace.messageType.info); |
1181 |
| - } |
1182 |
| - await this.loadPromisePolyfill(); |
1183 |
| - } |
| 1179 | + // if (Trace.isEnabled()) { |
| 1180 | + // Trace.write('WebViewExtBase.ensurePromiseSupport() - promise is not supported - polyfill needed.', 'NOTA', Trace.messageType.info); |
| 1181 | + // } |
| 1182 | + // await this.loadPromisePolyfill(); |
| 1183 | + // } |
1184 | 1184 |
|
1185 |
| - protected async loadPromisePolyfill() { |
1186 |
| - await this.executeJavaScript<void>(promisePolyfill, false); |
1187 |
| - } |
| 1185 | + // protected async loadPromisePolyfill() { |
| 1186 | + // await this.executeJavaScript<void>(promisePolyfill, false); |
| 1187 | + // } |
1188 | 1188 |
|
1189 |
| - protected async ensurePolyfills() { |
1190 |
| - await this.ensurePromiseSupport(); |
1191 |
| - // await this.ensureFetchSupport(); |
1192 |
| - } |
| 1189 | + // protected async ensurePolyfills() { |
| 1190 | + // await this.ensurePromiseSupport(); |
| 1191 | + // await this.ensureFetchSupport(); |
| 1192 | + // } |
1193 | 1193 |
|
1194 | 1194 | /**
|
1195 | 1195 | * Execute JavaScript inside the webview.
|
@@ -1372,9 +1372,9 @@ export abstract class WebViewExtBase extends ContainerView {
|
1372 | 1372 | if (this.injectBridge) {
|
1373 | 1373 | await this.executeJavaScript(webViewBridge, false);
|
1374 | 1374 | }
|
1375 |
| - if (this.injectPolyfills) { |
1376 |
| - await this.ensurePolyfills(); |
1377 |
| - } |
| 1375 | + // if (this.injectPolyfills) { |
| 1376 | + // await this.ensurePolyfills(); |
| 1377 | + // } |
1378 | 1378 | await this.injectViewPortMeta();
|
1379 | 1379 | }
|
1380 | 1380 |
|
|
0 commit comments