|
1 | 1 | /* global TrustedScriptURL, TrustedScript */ |
2 | 2 |
|
3 | 3 | import ContentFeature from '../content-feature.js' |
4 | | -import { DDGProxy, getStackTraceOrigins, getStack, matchHostname, injectGlobalStyles, createStyleElement, postDebugMessage, taintSymbol, hasTaintedMethod, taintedOrigins, getTabHostname } from '../utils.js' |
| 4 | +import { DDGProxy, getStackTraceOrigins, getStack, matchHostname, injectGlobalStyles, createStyleElement, postDebugMessage, taintSymbol, hasTaintedMethod, taintedOrigins, getTabHostname, isBeingFramed } from '../utils.js' |
5 | 5 | import { defineProperty } from '../wrapper-utils.js' |
6 | 6 | import { wrapScriptCodeOverload } from './runtime-checks/script-overload.js' |
7 | 7 | import { findClosestBreakpoint } from './runtime-checks/helpers.js' |
@@ -604,6 +604,7 @@ export default class RuntimeChecks extends ContentFeature { |
604 | 604 | ['innerHeight', 'innerWidth', 'outerHeight', 'outerWidth', 'Screen.prototype.height', 'Screen.prototype.width'].forEach(sizing => { |
605 | 605 | if (sizing in genericOverloads) { |
606 | 606 | const sizingConfig = genericOverloads[sizing] |
| 607 | + if (isBeingFramed() && !sizingConfig.applyToFrames) return |
607 | 608 | this.overloadScreenSizes(sizingConfig, breakpoints, screenSize, sizing, sizingConfig.offset || 0) |
608 | 609 | } |
609 | 610 | }) |
@@ -791,9 +792,14 @@ export default class RuntimeChecks extends ContentFeature { |
791 | 792 | receiver = globalThis.screen |
792 | 793 | break |
793 | 794 | } |
794 | | - const defaultVal = Reflect.get(scope, overrideKey, receiver) |
| 795 | + const defaultGetter = Object.getOwnPropertyDescriptor(scope, overrideKey)?.get |
| 796 | + // Should never happen |
| 797 | + if (!defaultGetter) { |
| 798 | + return |
| 799 | + } |
795 | 800 | defineProperty(scope, overrideKey, { |
796 | 801 | get () { |
| 802 | + const defaultVal = Reflect.apply(defaultGetter, receiver, []) |
797 | 803 | if (getTaintFromScope(this, arguments, config.stackCheck)) { |
798 | 804 | return returnVal |
799 | 805 | } |
|
0 commit comments