refactor: separate WEB_VIEW_ATTRIBUTES / WEB_VIEW_ERROR_MESSAGES (#36972)
This commit is contained in:
parent
a9b6041d38
commit
2f79444535
4 changed files with 72 additions and 71 deletions
|
@ -1,5 +1,5 @@
|
|||
import type * as guestViewInternalModule from '@electron/internal/renderer/web-view/guest-view-internal';
|
||||
import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants';
|
||||
import { WEB_VIEW_ATTRIBUTES } from '@electron/internal/renderer/web-view/web-view-constants';
|
||||
import { syncMethods, asyncMethods, properties } from '@electron/internal/common/web-view-methods';
|
||||
import type { WebViewAttribute, PartitionAttribute } from '@electron/internal/renderer/web-view/web-view-attributes';
|
||||
import { setupWebViewAttributes } from '@electron/internal/renderer/web-view/web-view-attributes';
|
||||
|
@ -75,7 +75,7 @@ export class WebViewImpl {
|
|||
}
|
||||
|
||||
this.beforeFirstNavigation = true;
|
||||
(this.attributes.get(WEB_VIEW_CONSTANTS.ATTRIBUTE_PARTITION) as PartitionAttribute).validPartitionId = true;
|
||||
(this.attributes.get(WEB_VIEW_ATTRIBUTES.PARTITION) as PartitionAttribute).validPartitionId = true;
|
||||
|
||||
// Since attachment swaps a local frame for a remote frame, we need our
|
||||
// internal iframe element to be local again before we can reattach.
|
||||
|
@ -145,13 +145,13 @@ export class WebViewImpl {
|
|||
|
||||
// Updates state upon loadcommit.
|
||||
onLoadCommit (props: Record<string, any>) {
|
||||
const oldValue = this.webviewNode.getAttribute(WEB_VIEW_CONSTANTS.ATTRIBUTE_SRC);
|
||||
const oldValue = this.webviewNode.getAttribute(WEB_VIEW_ATTRIBUTES.SRC);
|
||||
const newValue = props.url;
|
||||
if (props.isMainFrame && (oldValue !== newValue)) {
|
||||
// Touching the src attribute triggers a navigation. To avoid
|
||||
// triggering a page reload on every guest-initiated navigation,
|
||||
// we do not handle this mutation.
|
||||
this.attributes.get(WEB_VIEW_CONSTANTS.ATTRIBUTE_SRC)!.setValueIgnoreMutation(newValue);
|
||||
this.attributes.get(WEB_VIEW_ATTRIBUTES.SRC)!.setValueIgnoreMutation(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ export class WebViewImpl {
|
|||
}
|
||||
|
||||
onAttach (storagePartitionId: number) {
|
||||
return this.attributes.get(WEB_VIEW_CONSTANTS.ATTRIBUTE_PARTITION)!.setValue(storagePartitionId);
|
||||
return this.attributes.get(WEB_VIEW_ATTRIBUTES.PARTITION)!.setValue(storagePartitionId);
|
||||
}
|
||||
|
||||
buildParams () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue