mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibWeb+Browser: Add Debug menu action for toggling Same-Origin Policy
Sometimes it's useful to turn off the SOP for testing purposes. Let's make that easy by having a Debug menu item for it. :^)
This commit is contained in:
parent
c181494b19
commit
19de6bb1cc
5 changed files with 29 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <LibWeb/HTML/BrowsingContextContainer.h>
|
||||
#include <LibWeb/Origin.h>
|
||||
#include <LibWeb/Page/BrowsingContext.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -43,6 +44,10 @@ Origin BrowsingContextContainer::content_origin() const
|
|||
|
||||
bool BrowsingContextContainer::may_access_from_origin(const Origin& origin) const
|
||||
{
|
||||
if (auto* page = document().page()) {
|
||||
if (!page->is_same_origin_policy_enabled())
|
||||
return true;
|
||||
}
|
||||
return origin.is_same(content_origin());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue