-
Notifications
You must be signed in to change notification settings - Fork 47.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DevTools: Improve browser extension iframe support (#19854)
Co-authored-by: Joel DSouza <[email protected]> Co-authored-by: Damien Maillard <[email protected]> Co-authored-by: Brian Vaughn <[email protected]>
- Loading branch information
1 parent
c691734
commit a99bf5c
Showing
30 changed files
with
149 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script> | ||
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script> | ||
const MyComponent = () => { | ||
return React.createElement("h1", null, "Parent", React.createElement(MainIframe, null, null)); | ||
}; | ||
|
||
const MainIframe = () => { | ||
return React.createElement("iframe", {src: "./main.html", sandbox:"allow-same-origin allow-scripts"}, null); | ||
} | ||
|
||
const el = () => React.createElement(MyComponent, null) | ||
|
||
ReactDOM.render(el(), document.getElementById('root')) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<iframe src="http://127.0.0.1:3000/main.html"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<iframe sandbox="allow-scripts" src="./main.html"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<iframe src="./main.html"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>React DevTools iframe test</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
</head> | ||
<body> | ||
<iframe src="iframe-in-component.html"></iframe> | ||
<iframe src="iframe-other-origin.html"></iframe> | ||
<iframe src="iframe-same-origin-sandbox.html"></iframe> | ||
<iframe src="iframe-same-origin.html"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script> | ||
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script> | ||
const MyComponent = () => { | ||
return React.createElement("h1", null, "Coucou"); | ||
}; | ||
|
||
const el = () => React.createElement(MyComponent, null) | ||
|
||
ReactDOM.render(el(), document.getElementById('root')) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env node | ||
|
||
const finalhandler = require('finalhandler'); | ||
const http = require('http'); | ||
const serveStatic = require('serve-static'); | ||
|
||
// Serve fixtures folder | ||
const serve = serveStatic(__dirname); | ||
|
||
// Create server | ||
const server = http.createServer(function onRequest(req, res) { | ||
serve(req, res, finalhandler(req, res)); | ||
}); | ||
|
||
console.log('Listening on http://localhost:3000'); | ||
|
||
// Listen | ||
server.listen(3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 14.9</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,6 @@ | |
<title>React 15.0</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 15.1</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 15.2</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 15.3</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 15.4</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 15.5</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 15.6</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/react.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.0</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.1</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.2</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.3</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.4</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.5</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/schedule.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/schedule-tracing.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.6</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/scheduler.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/scheduler-tracing.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,6 @@ | |
<title>React 16.7</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
|
||
<script type="text/javascript"> | ||
// Enable DevTools to inspect React inside of an <iframe> | ||
// This must run before React is loaded | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; | ||
</script> | ||
|
||
<script src="https://unpkg.com/[email protected]/umd/scheduler.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/scheduler-tracing.development.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.