|
4115 | 4115 | * @property {boolean} [context.top] - true if the condition applies to the top frame |
4116 | 4116 | * @property {string} [injectName] - the inject name to match against (e.g., "apple-isolated") |
4117 | 4117 | * @property {boolean} [internal] - true if the condition applies to internal builds |
| 4118 | + * @property {boolean} [preview] - true if the condition applies to preview builds |
4118 | 4119 | */ |
4119 | 4120 | /** |
4120 | 4121 | * Takes multiple conditional blocks and returns true if any apply. |
|
4142 | 4143 | minSupportedVersion: this._matchMinSupportedVersion, |
4143 | 4144 | maxSupportedVersion: this._matchMaxSupportedVersion, |
4144 | 4145 | injectName: this._matchInjectNameConditional, |
4145 | | - internal: this._matchInternalConditional |
| 4146 | + internal: this._matchInternalConditional, |
| 4147 | + preview: this._matchPreviewConditional |
4146 | 4148 | }; |
4147 | 4149 | for (const key in conditionBlock) { |
4148 | 4150 | if (!conditionChecks[key]) { |
|
4244 | 4246 | if (isInternal === void 0) return false; |
4245 | 4247 | return Boolean(conditionBlock.internal) === Boolean(isInternal); |
4246 | 4248 | } |
| 4249 | + /** |
| 4250 | + * Takes a condition block and returns true if the preview state matches the condition. |
| 4251 | + * @param {ConditionBlock} conditionBlock |
| 4252 | + * @returns {boolean} |
| 4253 | + */ |
| 4254 | + _matchPreviewConditional(conditionBlock) { |
| 4255 | + if (conditionBlock.preview === void 0) return false; |
| 4256 | + const isPreview = __privateGet(this, _args)?.platform?.preview; |
| 4257 | + if (isPreview === void 0) return false; |
| 4258 | + return Boolean(conditionBlock.preview) === Boolean(isPreview); |
| 4259 | + } |
4247 | 4260 | /** |
4248 | 4261 | * Takes a condition block and returns true if the platform version satisfies the `minSupportedFeature` |
4249 | 4262 | * @param {ConditionBlock} conditionBlock |
@@ -10565,7 +10578,7 @@ ${iframeContent} |
10565 | 10578 | } |
10566 | 10579 | startObserving() { |
10567 | 10580 | this.log.info("Starting observing", this.mutationObserver, __privateGet(this, _cachedContent)); |
10568 | | - if (this.mutationObserver && __privateGet(this, _cachedContent) && !this.isObserving) { |
| 10581 | + if (this.mutationObserver && __privateGet(this, _cachedContent) && !this.isObserving && document.body) { |
10569 | 10582 | this.isObserving = true; |
10570 | 10583 | this.mutationObserver.observe(document.body, { |
10571 | 10584 | childList: true, |
@@ -10621,7 +10634,9 @@ ${iframeContent} |
10621 | 10634 | if (this.getFeatureSettingEnabled("includeImages", "disabled")) { |
10622 | 10635 | content.images = this.getImages(); |
10623 | 10636 | } |
10624 | | - this.cachedContent = content; |
| 10637 | + if (content.content.length > 0) { |
| 10638 | + this.cachedContent = content; |
| 10639 | + } |
10625 | 10640 | return content; |
10626 | 10641 | } |
10627 | 10642 | getPageTitle() { |
|
0 commit comments