Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Issue 16174005: Implement externally_connectable! Web pages can now communicate directly with (Closed)

Created:
7 years, 6 months ago by not at google - send to devlin
Modified:
7 years, 5 months ago
Reviewers:
Jeffrey Yasskin, Paweł
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Visibility:
Public.

Description

Implement externally_connectable! Web pages can now communicate directly with extensions via chrome.runtime.connect() and chrome.runtime.sendMessage() without needing to proxy via a content script. BUG=55316 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=205116

Patch Set 1 #

Patch Set 2 : remove logging #

Patch Set 3 : add back lazy app and webstore #

Patch Set 4 : check permission in browser #

Patch Set 5 : rebase #

Patch Set 6 : add app/webstore bindings back #

Patch Set 7 : add test #

Patch Set 8 : better tests #

Patch Set 9 : no find copies #

Total comments: 31

Patch Set 10 : jeffrey review #

Total comments: 8

Patch Set 11 : comments2 #

Patch Set 12 : rebase and more presubmit warnings apparently #

Patch Set 13 : fix win build #

Patch Set 14 : fix stubs test; use port in URL #

Patch Set 15 : use test_server instead of embedded_test_server #

Patch Set 16 : just disable the damn test #

Patch Set 17 : reenable test and get host address from the test server #

Patch Set 18 : absolute path... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+535 lines, -93 lines) Patch
M chrome/browser/extensions/api/messaging/message_service.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/messaging/message_service.cc View 1 2 3 4 5 6 7 8 9 10 8 chunks +59 lines, -24 lines 0 comments Download
M chrome/browser/extensions/extension_messages_apitest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +159 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/_api_features.json View 1 2 3 4 5 6 7 8 9 3 chunks +7 lines, -2 lines 0 comments Download
M chrome/common/extensions/api/_manifest_features.json View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/_permission_features.json View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/common/extensions/manifest_handlers/externally_connectable.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +11 lines, -4 lines 0 comments Download
M chrome/common/extensions/manifest_handlers/externally_connectable.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +24 lines, -5 lines 0 comments Download
M chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +31 lines, -4 lines 0 comments Download
M chrome/renderer/extensions/dispatcher.cc View 1 2 3 4 5 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/renderer/extensions/runtime_custom_bindings.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +6 lines, -8 lines 0 comments Download
M chrome/renderer/resources/extensions/miscellaneous_bindings.js View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -1 line 0 comments Download
M chrome/renderer/resources/extensions/runtime_custom_bindings.js View 1 chunk +9 lines, -10 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/externally_connectable/not_connectable/background.js View 1 2 3 4 5 6 7 8 9 1 chunk +16 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/externally_connectable/not_connectable/manifest.json View 1 2 3 4 5 6 7 1 chunk +9 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js View 1 2 3 4 5 6 7 8 9 1 chunk +129 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/chromium.org.html View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/google.com.html View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/externally_connectable/web_connectable/background.js View 1 2 3 4 5 6 7 8 9 1 chunk +16 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/messaging/externally_connectable/web_connectable/manifest.json View 1 2 3 4 5 6 7 1 chunk +12 lines, -0 lines 0 comments Download
M chrome/test/data/extensions/api_test/stubs/content_script.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +17 lines, -32 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
not at google - send to devlin
7 years, 6 months ago (2013-06-07 23:05:38 UTC) #1
Jeffrey Yasskin
https://codereview.chromium.org/16174005/diff/34002/chrome/browser/extensions/api/messaging/message_service.cc File chrome/browser/extensions/api/messaging/message_service.cc (right): https://codereview.chromium.org/16174005/diff/34002/chrome/browser/extensions/api/messaging/message_service.cc#newcode205 chrome/browser/extensions/api/messaging/message_service.cc:205: bool is_externally_connectable = true; Default this to false in ...
7 years, 6 months ago (2013-06-08 00:28:09 UTC) #2
not at google - send to devlin
https://codereview.chromium.org/16174005/diff/34002/chrome/browser/extensions/api/messaging/message_service.cc File chrome/browser/extensions/api/messaging/message_service.cc (right): https://codereview.chromium.org/16174005/diff/34002/chrome/browser/extensions/api/messaging/message_service.cc#newcode205 chrome/browser/extensions/api/messaging/message_service.cc:205: bool is_externally_connectable = true; On 2013/06/08 00:28:09, Jeffrey Yasskin ...
7 years, 6 months ago (2013-06-08 02:02:33 UTC) #3
Jeffrey Yasskin
lgtm, after the comments below https://codereview.chromium.org/16174005/diff/86001/chrome/browser/extensions/api/messaging/message_service.h File chrome/browser/extensions/api/messaging/message_service.h (right): https://codereview.chromium.org/16174005/diff/86001/chrome/browser/extensions/api/messaging/message_service.h#newcode216 chrome/browser/extensions/api/messaging/message_service.h:216: // |error_message| for source ...
7 years, 6 months ago (2013-06-08 02:27:47 UTC) #4
not at google - send to devlin
https://codereview.chromium.org/16174005/diff/86001/chrome/browser/extensions/api/messaging/message_service.h File chrome/browser/extensions/api/messaging/message_service.h (right): https://codereview.chromium.org/16174005/diff/86001/chrome/browser/extensions/api/messaging/message_service.h#newcode216 chrome/browser/extensions/api/messaging/message_service.h:216: // |error_message| for source if non-empty. On 2013/06/08 02:27:47, ...
7 years, 6 months ago (2013-06-08 02:36:50 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/112001
7 years, 6 months ago (2013-06-08 02:37:41 UTC) #6
commit-bot: I haz the power
Failed to apply patch for chrome/common/extensions/manifest_handlers/externally_connectable.cc: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
7 years, 6 months ago (2013-06-08 02:37:46 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/88006
7 years, 6 months ago (2013-06-08 02:43:16 UTC) #8
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 6 months ago (2013-06-08 04:17:56 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/134002
7 years, 6 months ago (2013-06-08 04:36:54 UTC) #10
commit-bot: I haz the power
Retried try job too often on linux_aura for step(s) browser_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_aura&number=48335
7 years, 6 months ago (2013-06-08 07:05:23 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/152001
7 years, 6 months ago (2013-06-08 15:44:52 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/157005
7 years, 6 months ago (2013-06-08 17:30:05 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/156003
7 years, 6 months ago (2013-06-08 18:36:10 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/152011
7 years, 6 months ago (2013-06-08 19:03:37 UTC) #15
commit-bot: I haz the power
Retried try job too often on linux_rel for step(s) browser_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_rel&number=136009
7 years, 6 months ago (2013-06-08 20:31:13 UTC) #16
not at google - send to devlin
Hey Pawel, I could really use your help here. I just can't get the critical ...
7 years, 6 months ago (2013-06-08 20:36:20 UTC) #17
方觉(Fang Jue)
On 2013/06/08 20:36:20, kalman wrote: > Hey Pawel, I could really use your help here. ...
7 years, 6 months ago (2013-06-09 01:43:41 UTC) #18
not at google - send to devlin
Yes I bet it's that, thanks! Changing to PathService like the other tests makes it ...
7 years, 6 months ago (2013-06-09 02:58:53 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kalman@chromium.org/16174005/170001
7 years, 6 months ago (2013-06-09 02:59:04 UTC) #20
commit-bot: I haz the power
Change committed as 205116
7 years, 6 months ago (2013-06-09 12:58:06 UTC) #21
Paweł
7 years, 5 months ago (2013-07-24 01:13:45 UTC) #22
Yes, I think it's the issue is with absolute vs. relative paths. Make sure
to base the path off source root obtain from PathService.

Please let me know if you have more questions.

Paweł

On Sat, Jun 8, 2013 at 6:43 PM, <fangjue23303@gmail.com> wrote:

> On 2013/06/08 20:36:20, kalman wrote:
>
>> Hey Pawel, I could really use your help here.
>>
>
>  I just can't get the critical test,
>> ExternallyConnectableMessaging**Test.**ExternallyConnectableMessaging
>> (browser_tests, defined in
>> chrome/browser/extensions/**extension_messages_apitest.cc)**, to pass on
>> the bots.
>> It fails 100% of the time irrespective of whether I use test_server or
>> embedded_test server - maybe something to do with the host resolver?
>>
>
>  The test is supposed to set up two pages on different URLs,
>>
> http://chromium.org and
>
>> http://google.com, and tests that a sample extension can receive
>> messages from
>>
> one not
>
>> the other. Works fine locally every time (gtest_repetitions=100 etc).
>>
>
>  But - it appears to fail to load the page on the bots (404 for the
>> embedded
>>
> test
>
>> server). Example failure:
>>
>
>
> http://build.chromium.org/p/**tryserver.chromium/builders/**
> mac_rel/builds/136386/steps/**browser_tests/logs/**
>
ExternallyConnectableMessaging<http://build.chromium.org/p/tryserver.chromium/builders/mac_rel/builds/136386/steps/browser_tests/logs/ExternallyConnectableMessaging>
>
>  Given the predictability of it, it's not a flake. Presumably just a
>> difference
>> in environment - but why would this be affected by the embedded test
>> server?
>>
> And
>
>> what is the difference anyway?
>>
>
>  I'd be great if you could have a look. I need to land this before Monday
>> so
>> worst case I disable it for now.
>>
>
> What's the 'current directory' when you run the test locally and when it's
> ran
> on the trybot?
> It seems that embedded test server reads files from
> <current
> directory>/chrome/test/data/**extensions/api_test/messaging/**
> externally_connectable
> and if <current directory> isn't src/, files are not found and the result
> will
> be a 404.
>
> Looking at calls of ServeFilesFromDirectory, two of them use absolute
> path. The
> other one
> (ExtensionLoadingTest.**UpgradeAfterNavigatingFromOver**riddenNewTabPage)'s
> path is
> "chrome/test/data" but from the code it seems that this particular test
> will run
> as expected
> even if the url request returns 404.
>
>
https://chromiumcodereview.**appspot.com/16174005/<https://chromiumcodereview...
>

Powered by Google App Engine
This is Rietveld 408576698