Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
calro
Search
Yosuke Kurami
November 19, 2018
700
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
calro
roppongi.js #7向け
Yosuke Kurami
November 19, 2018
More Decks by Yosuke Kurami
See All by Yosuke Kurami
GraphQL の onError と Nullability のこれから
quramy
0
190
TypeScript LSP の今までとこれから
quramy
1
2.3k
フロントエンドテストの育て方
quramy
12
3.9k
App Router 悲喜交々
quramy
8
780
上手に付き合うコンポーネントテスト
quramy
6
2.4k
Patched fetch did not work
quramy
6
820
GraphQL あるいは React における自律的なデータ取得について
quramy
18
6k
Next.js App Router
quramy
15
4k
Fragment Composition of GraphQL
quramy
17
5k
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Ruling the World: When Life Gets Gamed
codingconduct
0
420
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Skip the Path - Find Your Career Trail
mkilby
1
260
Balancing Empowerment & Direction
lara
6
1.3k
Documentation Writing (for coders)
carmenintech
77
5.6k
Claude Code のすすめ
schroneko
67
230k
Into the Great Unknown - MozCon
thekraken
41
2.8k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
610
For a Future-Friendly Web
brad_frost
184
10k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
750
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Transcript
Carloͷ Roppongi.js #7
About me
Carloͱ • https://github.com/GoogleChromeLabs/ carlo • Googleᐌ͘ ʮheadful Node app frameworkʯ
None
Node.js + Chromium • CarloChromiumΛը໘ඳըΤϯδϯͱͯ͠ ಈ࡞͢ΔNode.js ΞϓϦέʔγϣϯϑϨʔϜ ϫʔΫ • Node.jsɺChromiumͱʹV8͕ಈ࡞͢Δͨ
ΊɺJavaScriptͷΈͰσεΫτοϓΞϓϦ͕࡞ ΕΔ
͍ํ
Demo https://github.com/Quramy/carlo-git-graph
ElectronNW.jsͱͷҧ͍
ϥϯλΠϜϑΝΠϧαΠζ • Electron / NW.jsChromiumͷϨϯμϥϓϩ ηε͔ΒNode.jsΞΫηεͰ͖ΔΑ͏ʹ͠ ͨɺಠࣗͷϥϯλΠϜΛඞཁͱ͢Δ • ͍͕ͭ͜૬ॏ͍ͨ
(ࢀߟ) ElectronͷϑΝΠϧαΠζ https://github.com/electron/electron/releases/tag/v3.0.8
ElectronNw.jsͷ • Electron / NW.jsͰ࡞ͨ͠ΞϓϦέʔγϣϯ Λ͢Δ߹ɺಠࣗϥϯλΠϜࣗମ bundleͯ͢͠Δͷ͕Ұൠతɻ (Ϣʔβʔී௨ɺElectron NW.jsΛࣄલʹ Πϯετʔϧͯ͠ͳ͍)
• ඞવతʹͷαΠζ͕ڊେԽ͢Δ
CarloͰ࡞ͬͨΞϓϦͷ • CarloϢʔβʔ͕Πϯετʔϧ͍ͯ͠Δ ChromeΛͦͷ··ར༻͢Δ • Node.jsΛطʹΠϯετʔϧ͍ͯ͠ΔϢʔβʔ ͢ΔͷͰ͋ΕɺNPMͰे
CarloͰ࡞ͬͨΞϓϦͷ • Node.js͚ͩΛόϯυϧͯ͢͠Δ߹ɺ https://github.com/zeit/pkg Λར༻͢ΔͱΑ ͍Β͍͠
nodeIntegration • ElectronͰσϑΥϧτͰ nodeIntegrationͱ ͍͏ػೳ͕onʹ͞Ε͍ͯΔ • ͜ΕɺϨϯμϥϓϩηε(ཁ͢Δʹը໘)͔ ΒɺNode.jsͷAPIΛ৮ΕΔɺͱ͍͏ػೳ
nodeIntegration • ը໘͔ΒNode.jsʹ৮ΕΔͱ͍͏͜ͱ ͱ͔͕ී௨ʹಈ͍ͯ͠·͏ • ΞϓϦέʔγϣϯʹXSSͷ੬ऑੑΛຒΊࠐΜͩ ͱ͖ͷඃ͕௨ৗͷWebΞϓϦͷൺ͡Όͳ͍ require('child_process').execSync('ls')
nodeIntegration • CarloͰɺࣗͰબͨ͠Node.jsͷؔͷ Έ͕ɺ໌ࣔతʹChromiumଆެ։͞ΕΔํࣜ • XSS͕͋ͬͨͱ͜ΖͰɺElectron΄Ͳͷඃʹ ͳΒͳ͍ͣ
CarloͱPuppeteer
CarloͱPuppeteer • CarloPuppeteerͰChromiumΛNode.js͔Βૢ࡞ͯ͠ ͍Δ • Puppeteerͱ • ͜ΕGoogleͷϥΠϒϥϦ • ChromiumΛࣗಈԽ͢ΔతͰ࡞ΒΕ͍ͯΔ
• Chrome Devtool ProtocolͷΫϥΠΞϯτ
CarloͱPuppeteer • NPMͷpuppeteerύοέʔδɺChromiumͷϥ ϯλΠϜΛpost installͰϩʔΧϧʹΠϯετʔϧ ͯ͘͠Δ • ૢ࡞෦ͷΈΛΓग़ͨ͠puppeteer-coreͱ͍ ͏ύοέʔδ͋Δɻ͍ͭ͜ϩʔΧϧΠϯετʔ ϧΛߦΘͳ͍ɻ
Carlo͕͍ͬͯΔͷͬͪ͜
CarloͱPuppeteer • ࣮ࡍͷͱ͜Ζɺݱঢ়ͷCalroPuppeteerͷബ ͍ϥούʔͰ͔͠ͳ͍ • CarloͷAPIʹఆٛ͞Ε͍ͯΔ exposeFunction ͳͲPuppeteerͷಉ໊ؔʹҕৡ͍ͯ͠Δͩ ͚
Node.js <=> Chromimum /PEFKTͷؔΛ $ISPNJVNଆ͔Βݺͼग़͠Մೳʹ͢Δ
·ͱΊ • CarloPuppeteerΛར༻ͨ͠σεΫτοϓΞϓϦΤ ϯδϯ • PuppeteerͷAPIͬͯΕͲ͏ͱͰͳΔ • Electron / NW.jsΑΓࣗ༝͍͕ϑΝΠϧαΠ
ζͳͲͷ໘Ͱ༗ར • CLIʹͪΐͬͱͨ͠ը໘Λ͍ͨͤͨͱ͖ʹศར͔
Thank you!