PolymerElements / app-storage

Data-pipes and specialized services
61 stars 47 forks source link

fix issue where baseURI was undef in modules #123

Closed e111077 closed 6 years ago

e111077 commented 6 years ago

Description: baseURI was failing in Polymer 3-modulized. This is because our currentScript polyfill was returning the script[type="module] that imported this module, and then calling .baseURI on that returned undefined. I was able to find a fix that passed importPath to these scripts which should return a path related to import.meta.url.

This importPath fix will run if it is defined and will fallback to document.currentScript.baseURI if not (which should only be in Polymer 1)

For reviewing: I would recommend following the data flow of importPath which is:

app-indexeddb-mirror.html -> app-indexeddb-mirror-client.html -> common-worker.html

I have tested this in polymer 3.0 with a manual fix of importPath and it passed our test suite with flying colors. ✈️🌈

NOTE: Currently importPath is broken in 3.0 see Polymer/polymer-modulizer#361 and Polymer/polymer-modulizer#363

e111077 commented 6 years ago

CC @justinfagnani

e111077 commented 6 years ago

Tests seem to generally be failing due to test-fixture not being defined correctly

e111077 commented 6 years ago

Tests seem to fail the same way on master, but I can confirm that tests pass locally. Ready for second review pass

e111077 commented 6 years ago

ping for third pass @justinfagnani