Why:
- The current way of including the forwarder code involves using a
bundle, All the extra unnecessary Canvas code slows things down, costs
more to serve, and can cause errors because some things it expects to
work don't in the iframe.
- This includes the script as a static asset which will be served from
the CDN and only be refetched by the client when the the script
content changes, otherwise it will be cached for a year
(365.2425 days). It will also be gzip-compressed when delivered to
web browsers.
Credit to Jacob Burroughs for figuring out this approach.
Test plan:
Note: this is pretty much the same test plan as the next commit so you
can test just test that commit.
- after checking out code, run `yarn gulp rev` (this may also be done as
part of building assets?).
- to make sure you get the new code, clear your browser's cache, load a
canvas page, and open dev tools. In Network find the (web/doc) request
for /post_message_forwarding?target=... and visit the page to make
sure it has the new code (with script
src="/...lti_post_message_forwarding-1244...js" tag)
- launch an LTI tool and send messages to the forwarder iframe (platform
storage target) and make sure you get the appropriate response. You
can use can use messages like:
{"subject":"lti.put_data","key":"a","value":"b","message_id":"12"}
{"subject":"lti.get_data","key":"a","message_id":"12"}
- send messages from the tool to the parent window and make sure those
work too.
- embed an LTI tool in RCE content and while still editing the content,
send messages from the tool to both the platform storage target and
the parent window, as in the previous 2 steps.
refs INTEROP-8279
flag=none
Change-Id: I0d4ced28efc3c0c7d8180e72d56bab54557d3cce
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334733
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>