truth icon indicating copy to clipboard operation
truth copied to clipboard

JavaDoc links to developers.google.com

Open markuss5l opened this issue 6 years ago • 6 comments

Some types in the Truth-JavaDoc are still linked to developers.google.com URLs, which are not accessible for the public.

Example: In the JavaDoc for class LiteProtoTruth and method "assertThat" (https://truth.dev/api/1.0/com/google/common/truth/extensions/proto/LiteProtoTruth.html#assertThat-com.google.protobuf.MessageLite-) the link for parameter type "MessageLight" points to https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/MessageLite.html?is-external=true

markuss5l avatar Jul 09 '19 08:07 markuss5l

https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/MessageLite.html?is-external=true is a publicly-accessible link (as far as I can tell, I've tried it incognito from my cell phone, etc.).

Can you share any more information about why you think this URL isn't publicly-accessible?

nick-someone avatar Jul 09 '19 15:07 nick-someone

The error occurs when the JavaDoc is opened in a desktop browser using the frame-layout. Without frames or on mobile it is displayed without any problems.

The steps are:

  1. Open JavaDoc URL https://truth.dev/api/1.0/ in desktop browser
  2. Select "INDEX" and click on "assertThat(Message)"
  3. In the method documentation click on the "Message" type
  4. The error is: Refused to display 'https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Message?is-external=true' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Sorry for the somewhat weak description in my bug report!

markuss5l avatar Jul 10 '19 07:07 markuss5l

I can repro the detailed report @markuss5l just gave.

Chrome gives me "developers.google.com refused to connect."

As a work around, you can right click on "Message" and select "Open link in new tab" (because the single-origin frame policy no longer applies).

Not exactly sure how we can work around this though...short of maybe inserting a target= for external links. It seems like this problem probably occurs for a lot of external javadocs though?

kluever avatar Jul 10 '19 13:07 kluever

Thanks for the reproduction steps @markuss5l! I suspect that developers.google.com has a strict framing policy out of an abundance of caution.

I'll see what I can do in terms of resolving this from the protobuf javadoc side.

nick-someone avatar Jul 10 '19 13:07 nick-someone

A change to developers.google.com does sound ideal if it's acceptable to them. Thanks for looking into it. (Thanks also for the report.)

As a fallback plan, we could link to javadoc.io instead of developers.google.com: https://javadoc.io/doc/com.google.protobuf/protobuf-java/3.9.0-rc-1

javadoc.io doesn't seem to mind being in a frame: From https://guava.dev/releases/snapshot-jre/api/docs/, click com.google.common.base in the main pane (not the top-left), and then follow the link near the top to @ParametersAreNonnullByDefault.

cpovirk avatar Jul 10 '19 15:07 cpovirk

(Or, presumably, we could look into hosting our own docs on developer.google.com -- thus inflicting this problem on anyone who links to us :) But if the developer.google.com people believe that banning frames is the safe thing to do even for Javadoc (as opposed to just being stuck with it because they apply that policy in general), then maybe we should.)

cpovirk avatar Jul 10 '19 15:07 cpovirk