RFR: 8255940: localStorage is null after window.close() [v6]

Jay Bhaskar duke at openjdk.java.net
Sun Feb 27 05:43:28 UTC 2022


On Sat, 5 Feb 2022 14:57:50 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> modules/javafx.web/src/main/native/Source/WebCore/page/DOMWindow.cpp line 857:
>> 
>>> 855:             return m_localStorage.get();
>>> 856:     }
>>> 857: 
>> 
>> This will change the behavior for the case where page is null or where the page is valid, but not closing. I think you should partially revert this part of the fix, restoring it as follows:
>> 
>> 
>>     if (m_localStorage)
>>         return m_localStorage.get();
>
> I still think you need to restore this block, but without the check for `isClosing`.

Kindly look code ��
ExceptionOr<Storage*> DOMWindow::localStorage()
{
if (!isCurrentlyDisplayedInFrame())
return nullptr;

RefPtr document = this->document();
if (!document)
    return nullptr;

if (!document->securityOrigin().canAccessLocalStorage(nullptr))
    return Exception { SecurityError };

// FIXME: We should consider supporting access/modification to local storage
// after calling window.close(). See <https://bugs.webkit.org/show_bug.cgi?id=135330>.
if (m_localStorage)
    return m_localStorage.get();

auto* page = document->page();
if (!page)
    return nullptr;

// Check if localstorage setting is disabled, then return nullptr
if (!page->settings().localStorageEnabled())
    return nullptr;

auto storageArea = page->storageNamespaceProvider().localStorageArea(*document);
m_localStorage = Storage::create(*this, WTFMove(storageArea));
return m_localStorage.get();

}
is it now ok?

-------------

PR: https://git.openjdk.java.net/jfx/pull/703


More information about the openjfx-dev mailing list