Commit 4bd60bd3 authored by magjed's avatar magjed Committed by Commit bot

Revert of Serve mojo WebUI resources from the same origin as the WebUI itself....

Revert of Serve mojo WebUI resources from the same origin as the WebUI itself. (patchset #2 id:20001 of https://codereview.chromium.org/1457623004/ )

Reason for revert:
Causing test failures in the Cast Linux bot, content_browsertests, tests WebUIMojoTest.EndToEndPing and WebUIMojoTest.ConnectToApplication.
https://build.chromium.org/p/chromium.linux/builders/Cast%20Linux/builds/13153/steps/content_browsertests
Stack trace:
[ RUN      ] WebUIMojoTest.ConnectToApplication
[8517:8517:1124/000407:287044551:FATAL:web_ui_mojo_browsertest.cc(71)] Check failed: base::ReadFileToString(path, &contents, std::string::npos). web_ui_mojo_shell_test.html
#0 0x000000b4fa0e base::debug::StackTrace::StackTrace()
#1 0x000000b5bbeb logging::LogMessage::~LogMessage()
#2 0x0000006d96a7 content::(anonymous namespace)::GetResource()
#3 0x000002f21749 content::WebUIDataSourceImpl::StartDataRequest()
#4 0x000002f1fb9f content::URLDataManagerBackend::CallStartRequest()
#5 0x000002f20588 _ZN4base8internal12InvokeHelperILb0EvNS0_15RunnableAdapterIPFv13scoped_refptrIN7content17URLDataSourceImplEERKSsiiiEEENS0_8TypeListIJPS5_S8_RKiSF_SF_EEEE8MakeItSoESB_SD_S8_SF_SF_SF_
#6 0x000000ba8a3d base::debug::TaskAnnotator::RunTask()
#7 0x000000b6091b base::MessageLoop::RunTask()
#8 0x000000b60c29 base::MessageLoop::DeferOrRunPendingTask()
#9 0x000000b60dfd base::MessageLoop::DoWork()
#10 0x000000b48e89 base::MessagePumpLibevent::Run()
#11 0x000000b6e600 base::RunLoop::Run()
#12 0x0000009b669c content::RunThisRunLoop()
#13 0x00000095d853 content::NavigateToURL()
#14 0x0000006d9f68 content::(anonymous namespace)::WebUIMojoTest_ConnectToApplication_Test::RunTestOnMainThread()
#15 0x00000095d2c5 content::ContentBrowserTest::RunTestOnMainThreadLoop()
#16 0x0000009a7a9a content::BrowserTestBase::ProxyRunTestOnMainThreadLoop()
#17 0x00000099f86e content::ShellBrowserMainParts::PreMainMessageLoopRun()
#18 0x000002d9b015 content::BrowserMainLoop::PreMainMessageLoopRun()
#19 0x000002ee8397 content::StartupTaskRunner::RunAllTasksNow()
#20 0x000002d991ea content::BrowserMainLoop::CreateStartupTasks()
#21 0x000002d9dc96 content::BrowserMainRunnerImpl::Initialize()
#22 0x00000097e635 ShellBrowserMain()
#23 0x000000978af2 content::ShellMainDelegate::RunProcess()
#24 0x000002d73ea2 content::RunNamedProcessTypeMain()
#25 0x000002d74731 content::ContentMainRunnerImpl::Run()
#26 0x000002d73610 content::ContentMain()
#27 0x0000009a75ea content::BrowserTestBase::SetUp()
#28 0x00000095d1b3 content::ContentBrowserTest::SetUp()
#29 0x000000ac41b8 testing::Test::Run()
#30 0x000000ac517a testing::TestInfo::Run()
#31 0x000000ac5613 testing::TestCase::Run()
#32 0x000000acc9d9 testing::internal::UnitTestImpl::RunAllTests()
#33 0x000000acc67e testing::UnitTest::Run()
#34 0x0000009c9dc1 base::TestSuite::Run()
#35 0x0000009603d6 content::ContentTestLauncherDelegate::RunTestSuite()
#36 0x0000009b2806 content::LaunchTests()
#37 0x000000960383 main
#38 0x7f964b45cec5 __libc_start_main
#39 0x000000459519 <unknown>

Original issue's description:
> Serve mojo WebUI resources from the same origin as the WebUI itself.
>
> Currently, mojo resources are served from chrome://mojo and each mojo
> WebUI controller replaces the WebUIDataSource for that origin with one
> containing the resource it needs on construction. If a WebUI page's
> controller (or an equivalent one) was not the last one to be
> constructed, any requests for mojo bindings for its mojo interfaces
> will fail. This change fixes this problem by serving the mojo resources
> from the same origin as the WebUI itself.
>
> BUG=557540
>
> Committed: https://crrev.com/7e10653acb8254226f9b3ca5e0233c298c2ffbc3
> Cr-Commit-Position: refs/heads/master@{#361275}

TBR=sky@chromium.org,jam@chromium.org,tsepez@chromium.org,sammc@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=557540

Review URL: https://codereview.chromium.org/1467133004

Cr-Commit-Position: refs/heads/master@{#361296}
parent 0e56634f
...@@ -70,13 +70,13 @@ SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui) ...@@ -70,13 +70,13 @@ SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
source->AddResourcePath("engagement_table.js", source->AddResourcePath("engagement_table.js",
IDR_SITE_ENGAGEMENT_ENGAGEMENT_TABLE_JS); IDR_SITE_ENGAGEMENT_ENGAGEMENT_TABLE_JS);
source->AddResourcePath("site_engagement.js", IDR_SITE_ENGAGEMENT_JS); source->AddResourcePath("site_engagement.js", IDR_SITE_ENGAGEMENT_JS);
source->AddResourcePath(
"chrome/browser/ui/webui/engagement/site_engagement.mojom",
IDR_SITE_ENGAGEMENT_MOJO_JS);
source->AddMojoResources();
source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML); source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML);
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release()); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release());
AddMojoResourcePath(
"chrome/browser/ui/webui/engagement/site_engagement.mojom",
IDR_SITE_ENGAGEMENT_MOJO_JS);
} }
SiteEngagementUI::~SiteEngagementUI() {} SiteEngagementUI::~SiteEngagementUI() {}
......
...@@ -22,3 +22,12 @@ void MojoWebUIControllerBase::RenderViewCreated( ...@@ -22,3 +22,12 @@ void MojoWebUIControllerBase::RenderViewCreated(
content::RenderViewHost* render_view_host) { content::RenderViewHost* render_view_host) {
render_view_host->AllowBindings(content::BINDINGS_POLICY_WEB_UI); render_view_host->AllowBindings(content::BINDINGS_POLICY_WEB_UI);
} }
void MojoWebUIControllerBase::AddMojoResourcePath(const std::string& path,
int resource_id) {
if (!mojo_data_source_) {
mojo_data_source_ = content::WebUIDataSource::AddMojoDataSource(
Profile::FromWebUI(web_ui()));
}
mojo_data_source_->AddResourcePath(path, resource_id);
}
...@@ -30,6 +30,10 @@ class MojoWebUIControllerBase : public content::WebUIController { ...@@ -30,6 +30,10 @@ class MojoWebUIControllerBase : public content::WebUIController {
// WebUIController overrides: // WebUIController overrides:
void RenderViewCreated(content::RenderViewHost* render_view_host) override; void RenderViewCreated(content::RenderViewHost* render_view_host) override;
protected:
// Invoke to register mapping between binding file and resource id (IDR_...).
void AddMojoResourcePath(const std::string& path, int resource_id);
private: private:
// Bindings files are registered here. // Bindings files are registered here.
content::WebUIDataSource* mojo_data_source_; content::WebUIDataSource* mojo_data_source_;
......
...@@ -14,16 +14,16 @@ ...@@ -14,16 +14,16 @@
OmniboxUI::OmniboxUI(content::WebUI* web_ui) : MojoWebUIController(web_ui) { OmniboxUI::OmniboxUI(content::WebUI* web_ui) : MojoWebUIController(web_ui) {
// Set up the chrome://omnibox/ source. // Set up the chrome://omnibox/ source.
content::WebUIDataSource* source = content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIOmniboxHost); content::WebUIDataSource::Create(chrome::kChromeUIOmniboxHost);
source->AddResourcePath("omnibox.css", IDR_OMNIBOX_CSS); html_source->AddResourcePath("omnibox.css", IDR_OMNIBOX_CSS);
source->AddResourcePath("omnibox.js", IDR_OMNIBOX_JS); html_source->AddResourcePath("omnibox.js", IDR_OMNIBOX_JS);
source->AddResourcePath("chrome/browser/ui/webui/omnibox/omnibox.mojom", html_source->SetDefaultResource(IDR_OMNIBOX_HTML);
IDR_OMNIBOX_MOJO_JS);
source->AddMojoResources();
source->SetDefaultResource(IDR_OMNIBOX_HTML);
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
AddMojoResourcePath("chrome/browser/ui/webui/omnibox/omnibox.mojom",
IDR_OMNIBOX_MOJO_JS);
} }
OmniboxUI::~OmniboxUI() {} OmniboxUI::~OmniboxUI() {}
......
...@@ -23,6 +23,31 @@ WebUIDataSource* WebUIDataSource::Create(const std::string& source_name) { ...@@ -23,6 +23,31 @@ WebUIDataSource* WebUIDataSource::Create(const std::string& source_name) {
return new WebUIDataSourceImpl(source_name); return new WebUIDataSourceImpl(source_name);
} }
// static
WebUIDataSource* WebUIDataSource::AddMojoDataSource(
BrowserContext* browser_context) {
WebUIDataSource* mojo_source = Create("mojo");
static const struct {
const char* path;
int id;
} resources[] = {
{ mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS },
{ mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS },
{ mojo::kCodecModuleName, IDR_MOJO_CODEC_JS },
{ mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS },
{ mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS },
{ mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS },
{ mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS },
{ mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS },
};
for (size_t i = 0; i < arraysize(resources); ++i)
mojo_source->AddResourcePath(resources[i].path, resources[i].id);
URLDataManager::AddWebUIDataSource(browser_context, mojo_source);
return mojo_source;
}
// static // static
void WebUIDataSource::Add(BrowserContext* browser_context, void WebUIDataSource::Add(BrowserContext* browser_context,
WebUIDataSource* source) { WebUIDataSource* source) {
...@@ -136,24 +161,6 @@ void WebUIDataSourceImpl::SetRequestFilter( ...@@ -136,24 +161,6 @@ void WebUIDataSourceImpl::SetRequestFilter(
filter_callback_ = callback; filter_callback_ = callback;
} }
void WebUIDataSourceImpl::AddMojoResources() {
static const struct {
const char* path;
int id;
} resources[] = {
{mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS},
{mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS},
{mojo::kCodecModuleName, IDR_MOJO_CODEC_JS},
{mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS},
{mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS},
{mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS},
{mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS},
{mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS},
};
for (size_t i = 0; i < arraysize(resources); ++i)
AddResourcePath(resources[i].path, resources[i].id);
}
void WebUIDataSourceImpl::DisableReplaceExistingSource() { void WebUIDataSourceImpl::DisableReplaceExistingSource() {
replace_existing_source_ = false; replace_existing_source_ = false;
} }
......
...@@ -38,7 +38,6 @@ class CONTENT_EXPORT WebUIDataSourceImpl ...@@ -38,7 +38,6 @@ class CONTENT_EXPORT WebUIDataSourceImpl
void SetDefaultResource(int resource_id) override; void SetDefaultResource(int resource_id) override;
void SetRequestFilter( void SetRequestFilter(
const WebUIDataSource::HandleRequestCallback& callback) override; const WebUIDataSource::HandleRequestCallback& callback) override;
void AddMojoResources() override;
void DisableReplaceExistingSource() override; void DisableReplaceExistingSource() override;
void DisableContentSecurityPolicy() override; void DisableContentSecurityPolicy() override;
void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override;
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h" #include "content/browser/webui/web_ui_controller_factory_registry.h"
...@@ -53,22 +52,10 @@ bool GetResource(const std::string& id, ...@@ -53,22 +52,10 @@ bool GetResource(const std::string& id,
id == mojo::kValidatorModuleName) id == mojo::kValidatorModuleName)
return false; return false;
if (id.find(".mojom") != std::string::npos) {
std::string contents;
CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id),
&contents, std::string::npos))
<< id;
base::RefCountedString* ref_contents = new base::RefCountedString;
ref_contents->data() = contents;
callback.Run(ref_contents);
return true;
}
base::FilePath path;
DCHECK(base::PathService::Get(content::DIR_TEST_DATA, &path));
path = path.AppendASCII(id.substr(0, id.find("?")));
std::string contents; std::string contents;
CHECK(base::ReadFileToString(path, &contents, std::string::npos)) << id; CHECK(base::ReadFileToString(mojo::test::GetFilePathForJSResource(id),
&contents,
std::string::npos)) << id;
base::RefCountedString* ref_contents = new base::RefCountedString; base::RefCountedString* ref_contents = new base::RefCountedString;
ref_contents->data() = contents; ref_contents->data() = contents;
callback.Run(ref_contents); callback.Run(ref_contents);
...@@ -103,14 +90,13 @@ class BrowserTargetImpl : public BrowserTarget { ...@@ -103,14 +90,13 @@ class BrowserTargetImpl : public BrowserTarget {
// WebUIController that sets up mojo bindings. // WebUIController that sets up mojo bindings.
class TestWebUIController : public WebUIController { class TestWebUIController : public WebUIController {
public: public:
TestWebUIController(WebUI* web_ui, base::RunLoop* run_loop) TestWebUIController(WebUI* web_ui, base::RunLoop* run_loop)
: WebUIController(web_ui), run_loop_(run_loop) { : WebUIController(web_ui),
run_loop_(run_loop) {
content::WebUIDataSource* data_source = content::WebUIDataSource* data_source =
WebUIDataSource::Create("mojo-web-ui"); WebUIDataSource::AddMojoDataSource(
data_source->AddMojoResources(); web_ui->GetWebContents()->GetBrowserContext());
data_source->SetRequestFilter(base::Bind(&GetResource)); data_source->SetRequestFilter(base::Bind(&GetResource));
content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
data_source);
} }
protected: protected:
...@@ -219,7 +205,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, EndToEndPing) { ...@@ -219,7 +205,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, EndToEndPing) {
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
base::RunLoop run_loop; base::RunLoop run_loop;
factory()->set_run_loop(&run_loop); factory()->set_run_loop(&run_loop);
GURL test_url("chrome://mojo-web-ui/web_ui_mojo.html?ping"); GURL test_url(embedded_test_server()->GetURL("/web_ui_mojo.html?ping"));
NavigateToURL(shell(), test_url); NavigateToURL(shell(), test_url);
// RunLoop is quit when message received from page. // RunLoop is quit when message received from page.
run_loop.Run(); run_loop.Run();
...@@ -248,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, ConnectToApplication) { ...@@ -248,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, ConnectToApplication) {
ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(), NavigateToURL(shell(),
GURL("chrome://mojo-web-ui/web_ui_mojo_shell_test.html")); embedded_test_server()->GetURL("/web_ui_mojo_shell_test.html"));
DOMMessageQueue message_queue; DOMMessageQueue message_queue;
std::string message; std::string message;
......
...@@ -25,6 +25,12 @@ class WebUIDataSource { ...@@ -25,6 +25,12 @@ class WebUIDataSource {
CONTENT_EXPORT static WebUIDataSource* Create(const std::string& source_name); CONTENT_EXPORT static WebUIDataSource* Create(const std::string& source_name);
// Adds the necessary resources for mojo bindings returning the
// WebUIDataSource that handles the resources. Callers do not own the return
// value.
CONTENT_EXPORT static WebUIDataSource* AddMojoDataSource(
BrowserContext* browser_context);
// Adds a WebUI data source to |browser_context|. // Adds a WebUI data source to |browser_context|.
CONTENT_EXPORT static void Add(BrowserContext* browser_context, CONTENT_EXPORT static void Add(BrowserContext* browser_context,
WebUIDataSource* source); WebUIDataSource* source);
...@@ -71,9 +77,6 @@ class WebUIDataSource { ...@@ -71,9 +77,6 @@ class WebUIDataSource {
// Allows a caller to add a filter for URL requests. // Allows a caller to add a filter for URL requests.
virtual void SetRequestFilter(const HandleRequestCallback& callback) = 0; virtual void SetRequestFilter(const HandleRequestCallback& callback) = 0;
// Adds the necessary resources for mojo bindings.
virtual void AddMojoResources() = 0;
// The following map to methods on URLDataSource. See the documentation there. // The following map to methods on URLDataSource. See the documentation there.
// NOTE: it's not acceptable to call DisableContentSecurityPolicy for new // NOTE: it's not acceptable to call DisableContentSecurityPolicy for new
// pages, see URLDataSource::ShouldAddContentSecurityPolicy and talk to // pages, see URLDataSource::ShouldAddContentSecurityPolicy and talk to
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "third_party/WebKit/public/platform/WebURLResponse.h" #include "third_party/WebKit/public/platform/WebURLResponse.h"
#include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebScriptSource.h" #include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
using v8::Context; using v8::Context;
using v8::HandleScope; using v8::HandleScope;
...@@ -30,6 +29,10 @@ namespace content { ...@@ -30,6 +29,10 @@ namespace content {
namespace { namespace {
// All modules have this prefixed to them when downloading.
// TODO(sky): move this into some common place.
const char kModulePrefix[] = "chrome://mojo/";
void RunMain(base::WeakPtr<gin::Runner> runner, void RunMain(base::WeakPtr<gin::Runner> runner,
v8::Local<v8::Value> module) { v8::Local<v8::Value> module) {
v8::Isolate* isolate = runner->GetContextHolder()->isolate(); v8::Isolate* isolate = runner->GetContextHolder()->isolate();
...@@ -45,8 +48,7 @@ void RunMain(base::WeakPtr<gin::Runner> runner, ...@@ -45,8 +48,7 @@ void RunMain(base::WeakPtr<gin::Runner> runner,
WebUIMojoContextState::WebUIMojoContextState(blink::WebFrame* frame, WebUIMojoContextState::WebUIMojoContextState(blink::WebFrame* frame,
v8::Local<v8::Context> context) v8::Local<v8::Context> context)
: frame_(frame), : frame_(frame),
module_added_(false), module_added_(false) {
module_prefix_(frame_->securityOrigin().toString().utf8() + "/") {
gin::PerContextData* context_data = gin::PerContextData::From(context); gin::PerContextData* context_data = gin::PerContextData::From(context);
gin::ContextHolder* context_holder = context_data->context_holder(); gin::ContextHolder* context_holder = context_data->context_holder();
runner_.reset(new WebUIRunner(frame_, context_holder)); runner_.reset(new WebUIRunner(frame_, context_holder));
...@@ -87,7 +89,7 @@ void WebUIMojoContextState::FetchModules(const std::vector<std::string>& ids) { ...@@ -87,7 +89,7 @@ void WebUIMojoContextState::FetchModules(const std::vector<std::string>& ids) {
} }
void WebUIMojoContextState::FetchModule(const std::string& id) { void WebUIMojoContextState::FetchModule(const std::string& id) {
const GURL url(module_prefix_ + id); const GURL url(kModulePrefix + id);
// TODO(sky): better error checks here? // TODO(sky): better error checks here?
DCHECK(url.is_valid() && !url.is_empty()); DCHECK(url.is_valid() && !url.is_empty());
DCHECK(fetched_modules_.find(id) == fetched_modules_.end()); DCHECK(fetched_modules_.find(id) == fetched_modules_.end());
...@@ -107,10 +109,10 @@ void WebUIMojoContextState::OnFetchModuleComplete( ...@@ -107,10 +109,10 @@ void WebUIMojoContextState::OnFetchModuleComplete(
ResourceFetcher* fetcher, ResourceFetcher* fetcher,
const blink::WebURLResponse& response, const blink::WebURLResponse& response,
const std::string& data) { const std::string& data) {
DCHECK_EQ(module_prefix_, DCHECK_EQ(kModulePrefix,
response.url().string().utf8().substr(0, module_prefix_.size())); response.url().string().utf8().substr(0, arraysize(kModulePrefix) - 1));
const std::string module = const std::string module =
response.url().string().utf8().substr(module_prefix_.size()); response.url().string().utf8().substr(arraysize(kModulePrefix) - 1);
// We can't delete fetch right now as the arguments to this function come from // We can't delete fetch right now as the arguments to this function come from
// it and are used below. Instead use a scope_ptr to cleanup. // it and are used below. Instead use a scope_ptr to cleanup.
scoped_ptr<ResourceFetcher> deleter(fetcher); scoped_ptr<ResourceFetcher> deleter(fetcher);
......
...@@ -77,9 +77,6 @@ class WebUIMojoContextState : public gin::ModuleRegistryObserver { ...@@ -77,9 +77,6 @@ class WebUIMojoContextState : public gin::ModuleRegistryObserver {
// Set of modules we've fetched script from. // Set of modules we've fetched script from.
std::set<std::string> fetched_modules_; std::set<std::string> fetched_modules_;
// The prefix to use for all module requests.
const std::string module_prefix_;
DISALLOW_COPY_AND_ASSIGN(WebUIMojoContextState); DISALLOW_COPY_AND_ASSIGN(WebUIMojoContextState);
}; };
......
...@@ -35,8 +35,9 @@ define('main', [ ...@@ -35,8 +35,9 @@ define('main', [
function (services) { function (services) {
var test = connectToService(services, testMojom.TestMojoService); var test = connectToService(services, testMojom.TestMojoService);
test.getRequestorURL().then(function(response) { test.getRequestorURL().then(function(response) {
domAutomationController.send( // The requestor URL seen by the app should be localhost because the
response.url == 'chrome://mojo-web-ui/'); // connection comes from this script hosted on the test server.
domAutomationController.send(response.url == 'http://127.0.0.1/');
}); });
}, },
function (exposedServices) {}); function (exposedServices) {});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment