diff --git a/cspell.json b/cspell.json
index 210251b5..48cf3a8e 100644
--- a/cspell.json
+++ b/cspell.json
@@ -95,6 +95,7 @@
"onclick",
"onmouseenter",
"onmouseout",
+ "OOPIF",
"opencontainers",
"osversion",
"progresser",
diff --git a/element_test.go b/element_test.go
index 506bbd95..ee80598b 100644
--- a/element_test.go
+++ b/element_test.go
@@ -7,6 +7,7 @@ import (
"fmt"
"image/color"
"image/png"
+ "net"
"os"
"path/filepath"
"testing"
@@ -16,6 +17,7 @@ import (
"github.com/go-rod/rod/lib/cdp"
"github.com/go-rod/rod/lib/devices"
"github.com/go-rod/rod/lib/input"
+ "github.com/go-rod/rod/lib/launcher"
"github.com/go-rod/rod/lib/proto"
"github.com/go-rod/rod/lib/utils"
"github.com/ysmood/gson"
@@ -263,6 +265,37 @@ func TestIframes(t *testing.T) {
g.True(frame02.MustHas("[a=ok]"))
}
+func TestIframeCrossDomains(t *testing.T) {
+ g := setup(t)
+
+ r1 := g.Serve()
+ r2 := g.Serve()
+
+ // Same domain name with different ports won't trigger OOPIF (out-of-process iframes)
+ // To check the page OOPIF status, you can use chrome://process-internals tab in the browser.
+ host1 := net.JoinHostPort("localhost", r1.HostURL.Port())
+ host2 := net.JoinHostPort("127.0.0.1", r2.HostURL.Port())
+
+ u1 := fmt.Sprintf("http://%s/iframe", host1)
+ u2 := fmt.Sprintf("http://%s/page", host2)
+
+ r1.Route("/iframe", ".html", `
+
a
+ `)
+
+ r2.Route("/page", ".html", `
+
+ `)
+
+ u := launcher.New().HeadlessNew(true).MustLaunch()
+ browser := rod.New().ControlURL(u).NoDefaultDevice().MustConnect()
+ defer browser.MustClose()
+
+ page := browser.MustPage(u2)
+
+ g.Eq(page.MustElement("iframe").MustFrame().MustElement("#a").MustText(), "a")
+}
+
func TestContains(t *testing.T) {
g := setup(t)
diff --git a/lib/launcher/launcher.go b/lib/launcher/launcher.go
index b3e63055..92436c84 100644
--- a/lib/launcher/launcher.go
+++ b/lib/launcher/launcher.go
@@ -88,6 +88,7 @@ func New() *Launcher {
"disable-prompt-on-repost": nil,
"disable-renderer-backgrounding": nil,
"disable-sync": nil,
+ "disable-site-isolation-trials": nil,
"enable-automation": nil,
"enable-features": {"NetworkService", "NetworkServiceInProcess"},
"force-color-profile": {"srgb"},
diff --git a/lib/launcher/launcher_test.go b/lib/launcher/launcher_test.go
index 2f870ec3..9414b5dc 100644
--- a/lib/launcher/launcher_test.go
+++ b/lib/launcher/launcher_test.go
@@ -121,8 +121,8 @@ func TestLaunchUserMode(t *testing.T) {
Revision(launcher.RevisionDefault).
Logger(io.Discard).
Leakless(false).Leakless(true).
- Headless(false).Headless(true).RemoteDebuggingPort(port).
HeadlessNew(true).HeadlessNew(false).
+ Headless(false).Headless(true).RemoteDebuggingPort(port).
NoSandbox(true).NoSandbox(false).
Devtools(true).Devtools(false).
StartURL("about:blank").