⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283423 in webkit


Ignore:
Timestamp:
Oct 1, 2021, 4:48:33 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r283410. rdar://problem/83784757

Disable new incumbent-window until it is fully implemented
https://bugs.webkit.org/show_bug.cgi?id=230261
<rdar://problem/83099726>

Reviewed by Chris Dumez and Geoffrey Garen.

LayoutTests/imported/w3c:

  • web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
  • web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent-expected.txt:

Source/JavaScriptCore:

  • interpreter/CallFrame.cpp: (JSC::CallFrame::globalObjectOfClosestCodeBlock):
  • runtime/JSObject.cpp: (JSC::JSObject::getOwnPropertyDescriptor):
  • runtime/PropertySlot.h:

Source/WebCore:

This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.

  • bindings/js/JSDOMConvertCallbacks.h: (WebCore::Converter<IDLCallbackFunction<T>>::convert): (WebCore::Converter<IDLCallbackInterface<T>>::convert):
  • bindings/js/JSDOMGlobalObject.cpp: (WebCore::callerGlobalObject): (WebCore::legacyActiveGlobalObjectForAccessor):
  • bindings/js/JSDOMGlobalObject.h:
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::incumbentDOMWindow): (WebCore::legacyActiveDOMWindowForAccessor):
  • bindings/js/JSDOMWindowBase.h:
  • bindings/scripts/CodeGeneratorJS.pm: (GetJSCAttributesForAttribute): (GenerateCallWith):
  • page/Location.idl:

LayoutTests:

  • http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612.2.9.0-branch
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.2.9.0-branch/LayoutTests/ChangeLog

    r283146 r283423  
     12021-10-01  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r283410. rdar://problem/83784757
     4
     5    Disable new incumbent-window until it is fully implemented
     6    https://bugs.webkit.org/show_bug.cgi?id=230261
     7    <rdar://problem/83099726>
     8   
     9    Reviewed by Chris Dumez and Geoffrey Garen.
     10   
     11    LayoutTests/imported/w3c:
     12   
     13    * web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
     14    * web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent-expected.txt:
     15   
     16    Source/JavaScriptCore:
     17   
     18    * interpreter/CallFrame.cpp:
     19    (JSC::CallFrame::globalObjectOfClosestCodeBlock):
     20    * runtime/JSObject.cpp:
     21    (JSC::JSObject::getOwnPropertyDescriptor):
     22    * runtime/PropertySlot.h:
     23   
     24    Source/WebCore:
     25   
     26    This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.
     27   
     28    * bindings/js/JSDOMConvertCallbacks.h:
     29    (WebCore::Converter<IDLCallbackFunction<T>>::convert):
     30    (WebCore::Converter<IDLCallbackInterface<T>>::convert):
     31    * bindings/js/JSDOMGlobalObject.cpp:
     32    (WebCore::callerGlobalObject):
     33    (WebCore::legacyActiveGlobalObjectForAccessor):
     34    * bindings/js/JSDOMGlobalObject.h:
     35    * bindings/js/JSDOMWindowBase.cpp:
     36    (WebCore::incumbentDOMWindow):
     37    (WebCore::legacyActiveDOMWindowForAccessor):
     38    * bindings/js/JSDOMWindowBase.h:
     39    * bindings/scripts/CodeGeneratorJS.pm:
     40    (GetJSCAttributesForAttribute):
     41    (GenerateCallWith):
     42    * page/Location.idl:
     43   
     44    LayoutTests:
     45   
     46    * http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:
     47   
     48    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     49
     50    2021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
     51
     52            Disable new incumbent-window until it is fully implemented
     53            https://bugs.webkit.org/show_bug.cgi?id=230261
     54            <rdar://problem/83099726>
     55
     56            Reviewed by Chris Dumez and Geoffrey Garen.
     57
     58            * http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:
     59
    1602021-09-27  Alan Coon  <alancoon@apple.com>
    261
  • branches/safari-612.2.9.0-branch/LayoutTests/http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt

    r280256 r283423  
    1 document.referrer = http://127.0.0.1:8000/security/frameNavigation/context-for-location-href-gopd.html
     1document.referrer = http://127.0.0.1:8000/security/frameNavigation/resources/middle-frame-for-location.html
    22
  • branches/safari-612.2.9.0-branch/LayoutTests/imported/w3c/ChangeLog

    r283057 r283423  
     12021-10-01  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r283410. rdar://problem/83784757
     4
     5    Disable new incumbent-window until it is fully implemented
     6    https://bugs.webkit.org/show_bug.cgi?id=230261
     7    <rdar://problem/83099726>
     8   
     9    Reviewed by Chris Dumez and Geoffrey Garen.
     10   
     11    LayoutTests/imported/w3c:
     12   
     13    * web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
     14    * web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent-expected.txt:
     15   
     16    Source/JavaScriptCore:
     17   
     18    * interpreter/CallFrame.cpp:
     19    (JSC::CallFrame::globalObjectOfClosestCodeBlock):
     20    * runtime/JSObject.cpp:
     21    (JSC::JSObject::getOwnPropertyDescriptor):
     22    * runtime/PropertySlot.h:
     23   
     24    Source/WebCore:
     25   
     26    This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.
     27   
     28    * bindings/js/JSDOMConvertCallbacks.h:
     29    (WebCore::Converter<IDLCallbackFunction<T>>::convert):
     30    (WebCore::Converter<IDLCallbackInterface<T>>::convert):
     31    * bindings/js/JSDOMGlobalObject.cpp:
     32    (WebCore::callerGlobalObject):
     33    (WebCore::legacyActiveGlobalObjectForAccessor):
     34    * bindings/js/JSDOMGlobalObject.h:
     35    * bindings/js/JSDOMWindowBase.cpp:
     36    (WebCore::incumbentDOMWindow):
     37    (WebCore::legacyActiveDOMWindowForAccessor):
     38    * bindings/js/JSDOMWindowBase.h:
     39    * bindings/scripts/CodeGeneratorJS.pm:
     40    (GetJSCAttributesForAttribute):
     41    (GenerateCallWith):
     42    * page/Location.idl:
     43   
     44    LayoutTests:
     45   
     46    * http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:
     47   
     48    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     49
     50    2021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
     51
     52            Disable new incumbent-window until it is fully implemented
     53            https://bugs.webkit.org/show_bug.cgi?id=230261
     54            <rdar://problem/83099726>
     55
     56            Reviewed by Chris Dumez and Geoffrey Garen.
     57
     58            * web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
     59            * web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent-expected.txt:
     60
    1612021-09-24  Russell Epstein  <repstein@apple.com>
    262
  • branches/safari-612.2.9.0-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt

    r280256 r283423  
    22PASS The Function instance must be created in the Realm of the node document
    33FAIL The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document assert_equals: expected "/html/webappapis/scripting/events/resources/open-window.html" but got "/html/webappapis/scripting/events/open-window.html"
    4 PASS The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document
     4FAIL The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document assert_equals: expected "iframe" but got "parent frame"
    55
  • branches/safari-612.2.9.0-branch/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent-expected.txt

    r280256 r283423  
    33PASS Sanity check: this all works as expected with no promises involved
    44PASS Fulfillment handler on fulfilled promise
    5 FAIL Fulfillment handler on fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html"
     5FAIL Fulfillment handler on fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html"
    66PASS Rejection handler on rejected promise
    7 FAIL Rejection handler on rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html"
     7FAIL Rejection handler on rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html"
    88PASS Fulfillment handler on pending-then-fulfilled promise
    9 FAIL Fulfillment handler on pending-then-fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html"
     9FAIL Fulfillment handler on pending-then-fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html"
    1010PASS Rejection handler on pending-then-rejected promise
    11 FAIL Rejection handler on pending-then-rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html"
     11FAIL Rejection handler on pending-then-rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html"
    1212PASS Thenable resolution
    13 FAIL Thenable resolution, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html"
     13FAIL Thenable resolution, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html"
    1414
  • branches/safari-612.2.9.0-branch/Source/JavaScriptCore/ChangeLog

    r283148 r283423  
     12021-10-01  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r283410. rdar://problem/83784757
     4
     5    Disable new incumbent-window until it is fully implemented
     6    https://bugs.webkit.org/show_bug.cgi?id=230261
     7    <rdar://problem/83099726>
     8   
     9    Reviewed by Chris Dumez and Geoffrey Garen.
     10   
     11    LayoutTests/imported/w3c:
     12   
     13    * web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
     14    * web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent-expected.txt:
     15   
     16    Source/JavaScriptCore:
     17   
     18    * interpreter/CallFrame.cpp:
     19    (JSC::CallFrame::globalObjectOfClosestCodeBlock):
     20    * runtime/JSObject.cpp:
     21    (JSC::JSObject::getOwnPropertyDescriptor):
     22    * runtime/PropertySlot.h:
     23   
     24    Source/WebCore:
     25   
     26    This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.
     27   
     28    * bindings/js/JSDOMConvertCallbacks.h:
     29    (WebCore::Converter<IDLCallbackFunction<T>>::convert):
     30    (WebCore::Converter<IDLCallbackInterface<T>>::convert):
     31    * bindings/js/JSDOMGlobalObject.cpp:
     32    (WebCore::callerGlobalObject):
     33    (WebCore::legacyActiveGlobalObjectForAccessor):
     34    * bindings/js/JSDOMGlobalObject.h:
     35    * bindings/js/JSDOMWindowBase.cpp:
     36    (WebCore::incumbentDOMWindow):
     37    (WebCore::legacyActiveDOMWindowForAccessor):
     38    * bindings/js/JSDOMWindowBase.h:
     39    * bindings/scripts/CodeGeneratorJS.pm:
     40    (GetJSCAttributesForAttribute):
     41    (GenerateCallWith):
     42    * page/Location.idl:
     43   
     44    LayoutTests:
     45   
     46    * http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:
     47   
     48    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     49
     50    2021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
     51
     52            Disable new incumbent-window until it is fully implemented
     53            https://bugs.webkit.org/show_bug.cgi?id=230261
     54            <rdar://problem/83099726>
     55
     56            Reviewed by Chris Dumez and Geoffrey Garen.
     57
     58            * interpreter/CallFrame.cpp:
     59            (JSC::CallFrame::globalObjectOfClosestCodeBlock):
     60            * runtime/JSObject.cpp:
     61            (JSC::JSObject::getOwnPropertyDescriptor):
     62            * runtime/PropertySlot.h:
     63
    1642021-09-27  Alan Coon  <alancoon@apple.com>
    265
  • branches/safari-612.2.9.0-branch/Source/JavaScriptCore/interpreter/CallFrame.cpp

    r280256 r283423  
    248248JSGlobalObject* CallFrame::globalObjectOfClosestCodeBlock(VM& vm, CallFrame* callFrame)
    249249{
     250    // FIXME: We need to handle JSONP interpretation case in ProgramExecutable since it does not have vm.topCallFrame.
     251    // rdar://83691438
    250252    JSGlobalObject* globalObject = nullptr;
    251253    StackVisitor::visit(callFrame, vm, [&](StackVisitor& visitor) {
  • branches/safari-612.2.9.0-branch/Source/JavaScriptCore/runtime/JSObject.cpp

    r280505 r283423  
    36783678        descriptor.setAccessorDescriptor((slot.attributes() | PropertyAttribute::Accessor) & ~PropertyAttribute::CustomAccessor);
    36793679        JSGlobalObject* slotBaseGlobalObject = slot.slotBase()->globalObject(vm);
     3680        if (slot.attributes() & PropertyAttribute::DOMLegacyAccessor)
     3681            slotBaseGlobalObject = globalObject;
    36803682        if (slot.customGetter())
    36813683            descriptor.setGetter(createCustomGetterFunction(slotBaseGlobalObject, vm, propertyName, slot.customGetter(), slot.domAttribute()));
  • branches/safari-612.2.9.0-branch/Source/JavaScriptCore/runtime/PropertySlot.h

    r280256 r283423  
    4646    CustomAccessor    = 1 << 5,
    4747    CustomValue       = 1 << 6,
     48    DOMLegacyAccessor = 1 << 7, // property is a DOM legacy accessor, which holds caller's global object when it is materialized.
    4849    CustomAccessorOrValue = CustomAccessor | CustomValue,
    4950    AccessorOrCustomAccessorOrValue = Accessor | CustomAccessor | CustomValue,
  • branches/safari-612.2.9.0-branch/Source/WebCore/ChangeLog

    r283146 r283423  
     12021-10-01  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r283410. rdar://problem/83784757
     4
     5    Disable new incumbent-window until it is fully implemented
     6    https://bugs.webkit.org/show_bug.cgi?id=230261
     7    <rdar://problem/83099726>
     8   
     9    Reviewed by Chris Dumez and Geoffrey Garen.
     10   
     11    LayoutTests/imported/w3c:
     12   
     13    * web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
     14    * web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent-expected.txt:
     15   
     16    Source/JavaScriptCore:
     17   
     18    * interpreter/CallFrame.cpp:
     19    (JSC::CallFrame::globalObjectOfClosestCodeBlock):
     20    * runtime/JSObject.cpp:
     21    (JSC::JSObject::getOwnPropertyDescriptor):
     22    * runtime/PropertySlot.h:
     23   
     24    Source/WebCore:
     25   
     26    This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.
     27   
     28    * bindings/js/JSDOMConvertCallbacks.h:
     29    (WebCore::Converter<IDLCallbackFunction<T>>::convert):
     30    (WebCore::Converter<IDLCallbackInterface<T>>::convert):
     31    * bindings/js/JSDOMGlobalObject.cpp:
     32    (WebCore::callerGlobalObject):
     33    (WebCore::legacyActiveGlobalObjectForAccessor):
     34    * bindings/js/JSDOMGlobalObject.h:
     35    * bindings/js/JSDOMWindowBase.cpp:
     36    (WebCore::incumbentDOMWindow):
     37    (WebCore::legacyActiveDOMWindowForAccessor):
     38    * bindings/js/JSDOMWindowBase.h:
     39    * bindings/scripts/CodeGeneratorJS.pm:
     40    (GetJSCAttributesForAttribute):
     41    (GenerateCallWith):
     42    * page/Location.idl:
     43   
     44    LayoutTests:
     45   
     46    * http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:
     47   
     48    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     49
     50    2021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
     51
     52            Disable new incumbent-window until it is fully implemented
     53            https://bugs.webkit.org/show_bug.cgi?id=230261
     54            <rdar://problem/83099726>
     55
     56            Reviewed by Chris Dumez and Geoffrey Garen.
     57
     58            This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.
     59
     60            * bindings/js/JSDOMConvertCallbacks.h:
     61            (WebCore::Converter<IDLCallbackFunction<T>>::convert):
     62            (WebCore::Converter<IDLCallbackInterface<T>>::convert):
     63            * bindings/js/JSDOMGlobalObject.cpp:
     64            (WebCore::callerGlobalObject):
     65            (WebCore::legacyActiveGlobalObjectForAccessor):
     66            * bindings/js/JSDOMGlobalObject.h:
     67            * bindings/js/JSDOMWindowBase.cpp:
     68            (WebCore::incumbentDOMWindow):
     69            (WebCore::legacyActiveDOMWindowForAccessor):
     70            * bindings/js/JSDOMWindowBase.h:
     71            * bindings/scripts/CodeGeneratorJS.pm:
     72            (GetJSCAttributesForAttribute):
     73            (GenerateCallWith):
     74            * page/Location.idl:
     75
    1762021-09-27  Alan Coon  <alancoon@apple.com>
    277
  • branches/safari-612.2.9.0-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp

    r280627 r283423  
    6161#include <JavaScriptCore/JSInternalPromise.h>
    6262#include <JavaScriptCore/StructureInlines.h>
     63#include <JavaScriptCore/VMEntryScope.h>
    6364#include <JavaScriptCore/VMTrapsInlines.h>
    6465#include <JavaScriptCore/WasmStreamingCompiler.h>
     
    561562}
    562563
     564static JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame, bool skipFirstFrame, bool lookUpFromVMEntryScope)
     565{
     566    VM& vm = lexicalGlobalObject.vm();
     567    if (callFrame) {
     568        class GetCallerGlobalObjectFunctor {
     569        public:
     570            GetCallerGlobalObjectFunctor(bool skipFirstFrame)
     571                : m_skipFirstFrame(skipFirstFrame)
     572            { }
     573
     574            StackVisitor::Status operator()(StackVisitor& visitor) const
     575            {
     576                if (m_skipFirstFrame) {
     577                    if (!m_hasSkippedFirstFrame) {
     578                        m_hasSkippedFirstFrame = true;
     579                        return StackVisitor::Continue;
     580                    }
     581                }
     582
     583                if (auto* codeBlock = visitor->codeBlock())
     584                    m_globalObject = codeBlock->globalObject();
     585                else {
     586                    ASSERT(visitor->callee().rawPtr());
     587                    // FIXME: Callee is not an object if the caller is Web Assembly.
     588                    // Figure out what to do here. We can probably get the global object
     589                    // from the top-most Wasm Instance. https://bugs.webkit.org/show_bug.cgi?id=165721
     590                    if (visitor->callee().isCell() && visitor->callee().asCell()->isObject())
     591                        m_globalObject = jsCast<JSObject*>(visitor->callee().asCell())->globalObject();
     592                }
     593                return StackVisitor::Done;
     594            }
     595
     596            JSC::JSGlobalObject* globalObject() const { return m_globalObject; }
     597
     598        private:
     599            bool m_skipFirstFrame { false };
     600            mutable bool m_hasSkippedFirstFrame { false };
     601            mutable JSC::JSGlobalObject* m_globalObject { nullptr };
     602        };
     603
     604        GetCallerGlobalObjectFunctor iter(skipFirstFrame);
     605        callFrame->iterate(vm, iter);
     606        if (iter.globalObject())
     607            return *jsCast<JSDOMGlobalObject*>(iter.globalObject());
     608    }
     609
     610    // In the case of legacyActiveGlobalObjectForAccessor, it is possible that vm.topCallFrame is nullptr when the script is evaluated as JSONP.
     611    // Since we put JSGlobalObject to VMEntryScope, we can retrieve the right globalObject from that.
     612    // For callerGlobalObject, we do not check vm.entryScope to keep it the old behavior.
     613    if (lookUpFromVMEntryScope) {
     614        if (vm.entryScope) {
     615            if (auto* result = vm.entryScope->globalObject())
     616                return *jsCast<JSDOMGlobalObject*>(result);
     617        }
     618    }
     619
     620    // If we cannot find JSGlobalObject in caller frames, we just return the current lexicalGlobalObject.
     621    return *jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject);
     622}
     623
     624JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame)
     625{
     626    constexpr bool skipFirstFrame = true;
     627    constexpr bool lookUpFromVMEntryScope = false;
     628    return callerGlobalObject(lexicalGlobalObject, callFrame, skipFirstFrame, lookUpFromVMEntryScope);
     629}
     630
     631JSDOMGlobalObject& legacyActiveGlobalObjectForAccessor(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame)
     632{
     633    constexpr bool skipFirstFrame = false;
     634    constexpr bool lookUpFromVMEntryScope = true;
     635    return callerGlobalObject(lexicalGlobalObject, callFrame, skipFirstFrame, lookUpFromVMEntryScope);
     636}
     637
    563638} // namespace WebCore
  • branches/safari-612.2.9.0-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.h

    r280256 r283423  
    144144
    145145JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext&, DOMWrapperWorld&);
     146WEBCORE_EXPORT JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject&, JSC::CallFrame*);
     147JSDOMGlobalObject& legacyActiveGlobalObjectForAccessor(JSC::JSGlobalObject&, JSC::CallFrame*);
    146148
    147149template<class JSClass>
  • branches/safari-612.2.9.0-branch/Source/WebCore/bindings/js/JSDOMWindowBase.cpp

    r280256 r283423  
    285285DOMWindow& incumbentDOMWindow(JSGlobalObject& fallbackGlobalObject, CallFrame& callFrame)
    286286{
    287     if (auto* globalObject = CallFrame::globalObjectOfClosestCodeBlock(fallbackGlobalObject.vm(), &callFrame))
    288         return asJSDOMWindow(globalObject)->wrapped();
    289     return asJSDOMWindow(&fallbackGlobalObject)->wrapped();
     287    return asJSDOMWindow(&callerGlobalObject(fallbackGlobalObject, &callFrame))->wrapped();
    290288}
    291289
    292290DOMWindow& incumbentDOMWindow(JSGlobalObject& fallbackGlobalObject)
    293291{
    294     VM& vm = fallbackGlobalObject.vm();
    295     if (auto* globalObject = CallFrame::globalObjectOfClosestCodeBlock(vm, vm.topCallFrame))
    296         return asJSDOMWindow(globalObject)->wrapped();
    297     return asJSDOMWindow(&fallbackGlobalObject)->wrapped();
     292    return asJSDOMWindow(&callerGlobalObject(fallbackGlobalObject, fallbackGlobalObject.vm().topCallFrame))->wrapped();
    298293}
    299294
     
    307302    VM& vm = lexicalGlobalObject.vm();
    308303    return asJSDOMWindow(vm.deprecatedVMEntryGlobalObject(&lexicalGlobalObject))->wrapped();
     304}
     305
     306DOMWindow& legacyActiveDOMWindowForAccessor(JSGlobalObject& fallbackGlobalObject, CallFrame& callFrame)
     307{
     308    return asJSDOMWindow(&legacyActiveGlobalObjectForAccessor(fallbackGlobalObject, &callFrame))->wrapped();
     309}
     310
     311DOMWindow& legacyActiveDOMWindowForAccessor(JSGlobalObject& fallbackGlobalObject)
     312{
     313    return asJSDOMWindow(&legacyActiveGlobalObjectForAccessor(fallbackGlobalObject, fallbackGlobalObject.vm().topCallFrame))->wrapped();
    309314}
    310315
  • branches/safari-612.2.9.0-branch/Source/WebCore/bindings/js/JSDOMWindowBase.h

    r280256 r283423  
    127127DOMWindow& firstDOMWindow(JSC::JSGlobalObject&);
    128128
     129DOMWindow& legacyActiveDOMWindowForAccessor(JSC::JSGlobalObject&, JSC::CallFrame&);
     130DOMWindow& legacyActiveDOMWindowForAccessor(JSC::JSGlobalObject&);
     131
    129132// FIXME: This should probably be removed in favor of one of the other DOMWindow accessors. It is intended
    130133//        to provide the document specfied as the 'responsible document' in the algorithm for document.open()
  • branches/safari-612.2.9.0-branch/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r283017 r283423  
    20562056    push(@specials, "JSC::PropertyAttribute::ReadOnly") if IsReadonly($attribute);
    20572057    push(@specials, "JSC::PropertyAttribute::CustomAccessor") unless $isGlobalConstructor or IsJSBuiltin($interface, $attribute);
     2058    push(@specials, "JSC::PropertyAttribute::DOMLegacyAccessor") if $attribute->extendedAttributes->{LegacyActiveWindowForAccessor};
    20582059    push(@specials, "JSC::PropertyAttribute::DOMAttribute") if IsAcceleratedDOMAttribute($interface, $attribute);
    20592060    push(@specials, "JSC::PropertyAttribute::DOMJITAttribute") if $attribute->extendedAttributes->{DOMJIT};
     
    59855986        push(@callWithArgs, "incumbentDOMWindow(*$globalObject" . ($callFrameReference ? ", " . $callFrameReference : "") . ")");
    59865987    }
     5988    if ($codeGenerator->ExtendedAttributeContains($callWith, "LegacyActiveWindowForAccessor")) {
     5989        AddToImplIncludes("DOMWindow.h");
     5990        AddToImplIncludes("JSDOMWindowBase.h");
     5991        push(@callWithArgs, "legacyActiveDOMWindowForAccessor(*$globalObject" . ($callFrameReference ? ", " . $callFrameReference : "") . ")");
     5992    }
    59875993    if ($codeGenerator->ExtendedAttributeContains($callWith, "FirstWindow")) {
    59885994        AddToImplIncludes("DOMWindow.h");
  • branches/safari-612.2.9.0-branch/Source/WebCore/page/Location.idl

    r280826 r283423  
    4444    Exposed=Window
    4545] interface Location {
    46     [SetterCallWith=IncumbentWindow&FirstWindow, DoNotCheckSecurityOnSetter] stringifier attribute USVString href;
     46    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow, DoNotCheckSecurityOnSetter] stringifier attribute USVString href;
    4747
    4848    // FIXME: We should use IncumbentWindow once we found why https://bugs.webkit.org/show_bug.cgi?id=228943 issue occured.
     
    5252
    5353    // URI decomposition attributes
    54     [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString protocol;
    55     [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString host;
    56     [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString hostname;
    57     [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString port;
    58     [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString pathname;
    59     [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString search;
    60     [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString hash;
     54    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString protocol;
     55    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString host;
     56    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString hostname;
     57    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString port;
     58    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString pathname;
     59    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString search;
     60    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString hash;
    6161
    6262    readonly attribute USVString origin;
Note: See TracChangeset for help on using the changeset viewer.