Conversation
…nsole.logs to help debugging
If not a Solidus page, InspectorJSON will not be initialized and any existing InspectorJSON instances are destroyed.
|
I made a bunch of improvements to how messaging between pages works. Moved message processing to devpanel.js, and the messages passed from background.js are now all JSON objects to make it easier to pass complex information consistently. With this update the plugin won't initialize InspectorJSON if the inspected window isn't a Solidus page, and if InspectorJSON was already initialized on a previously inspected page, navigating to a non Solidus page will invoke This update also adds a messaging panel that gives the user some information about the current status of the plugin. Styling of the message panel will be tackled with issue #2. |
|
The |
|
@joanniclaborde any thoughts here? I still think customizing the |
|
I think the |
|
For now, I'll update the devtools to check for |
|
I'm about to commit the |
|
It could be useful. I'm trying to decide what should happen if someone is trying to inspect an older Solidus page that's returning |
|
I suggest we only support the Solidus header, if a dev wants to use the devtool on an old site, he just needs to update it first. |
|
Ok. Cool. I'm now checking that the string starts with "Solidus", so we should be able to include the version number on the end. And with that I think this pull request is ready to merge. @pushred what are your thoughts? |
There was a problem hiding this comment.
Should use the strict operator just as a safe, consistent habit. Rather than nitpick style though line-by-line I'm just gonna go ahead and commit a JSHint config file to this branch that covers our standards (formal + informal). Can you set up a Grunt/Gulp task that runs it and starts the basis for tests? I can hook up CircleCI then so we can save time reviewing this sorta thing.
There was a problem hiding this comment.
I like to clean this sort of logic up with a descriptive condition, in this case you might consider two: isDone and isSolidus.
Left a couple fairly trivial comments, aside from that I'd love to see the start of tests here. I know that gets a bit tricky with the browser extensions, but you should be able to mock some Solidus responses and possibly some of the Chrome APIs with Sinon.js? It'd be a lot easier to understand what all is going on vs. trying to follow the various console logs. |
…other JSHint suggestions
…olidus into run-only-on-solidus merging CircleCI addition with latest changes
It doesn't make sense for the Solidus devtools to run on a non-Solidus page, so we need a way to check if a page is a Solidus page before the Solidus devtools runs on it. The Grunt, Facebook React, and other devtools extensions do similar checks and don't run on pages that aren't using those tools.
There are a lot of ways we can check if a page is a Solidus page. @pushred and I had discussed using the page's x-powered-by headers. Currently that header shows Express, but we could potentially change that to be more specific to Solidus. The downside of this approach would be that it requires a second XMLHttpRequest to check the headers with JavaScript. Since we have to request the page's JSON object anyway, maybe we could just check that route and make sure that it's a Solidus object before running the rest of the DevTools. That would save a request and wouldn't depend on us changing the headers.
Another option could be whether or not a page has a Solidus object, though @pushred had mentioned that the pages may not be served with a Solidus object in the future.
Perhaps a meta tag in the HTML head would be another workable option to consider.