Firefox handling array/object serialization strangely? - arrays

Building a plugin via trigger.io, I'm seeing strange behavior in Chrome/Safari vs Firefox.
In Firefox, arrays are being turned into objects with numbers as keys, for example:
["getData", ["x"]]
Is getting turned into:
{"0":"getData","1":{"0":"x"}}
This causes all kinds of problems with serialization/deserialization, normalization across browsers, etc., and I'm not clear on why it would be happening.
This seems to be happening when passing objects from the foreground to the background via forge.message - happy to answer any questions to narrow this down!

That does look strange, could you let us know what version of Firefox you are using?
In the mean time you could serialize and deserialize the array yourself using JSON.stringify and JSON.parse.

This is caused by an error in Firefox's serialization of array in extensions, see: Firefox extension is sending javascript Array as an Object instead
As #connorhd said, the solution (until firefox fixes the issue) is to de/serialize to json when sending messages between the foreground and background. Unfortunately for us, this is a hotpath, and not terribly welcome overhead, but it seems to (more or less) solve the problem in Firefox 18.

Related

ReactJS - Freeze/Hangs in safari on mac and iOS only

We have a reactJs application which works fine on all other browsers except safari on macOS and ios. The app works perfectly on Chrome on macOs or windows and ios as well.
Also, once the app freezes, we cannot open dev console in safari and if it is open, most of the things don't work like pausing script execution. And we can say from activity monitor that it goes in some infinite loop as the cpu usage of that page goes to 100% but i am unable to figure out as there are no errors at all and it works on other browsers.
It just freezes on loading and becomes totally unresponsive (No scroll or clicks etc). It looks like there is some infinite loop or dependency issue.
The webapp is kind of LMS and has many dependencies but to give you an idea here is the stack -
GraphQL
React Router Dom
React Hooks
Sentry for Logging
Socket
etc
If you have any questions feel free to ask.
Here is the site - https://i3.stage.cudy.co/
Thanks
I went into trying to see what's going on and I noticed three things:
First couple of times I tried to open your site it froze as you say. Could not even open dev tools.
After previous tries, I suddenly saw the icons for your menu options (browse tutors, assignments, feeds, etc) appear and everything worked "fine" and no more freezes.
However, I did noticed a bunch of errors in dev tools. Most of them are related to urls not allowed to access and some others due a /profiles trying to access an API of some sort.
You have a lot of unhandled promise rejections errors in your *.js so that may also be something to look at.
I would suggest tackling down the cross domain origin policies first and then add logic to handle the promise rejections that you're missing since sometimes those unhandled scenarios leave the app at the dark without knowing what to do and may interrupt your logic process thus rendering frozen sites because of that.
Last but not less important, this is a good way of tracing down the issue.
There are way too many factors involved for us to help you without looking at the code.
I'd recommend the following:
Going through the code history and testing it on each major version change so you can rule out any culprits or suspicions.
I'd disconnect any packages 1 by 1.
Disconnect the API so see if it's a server issue where you're requesting API calls infinitely or something silly like that.
If disconnecting the API works then you know where to look at.
Cheers

React app slows to a crawl with chrome developer tools open. Works fine in incognito

When developing my react app the app becomes unusably slow with the devtools open in chrome. Works fast and fine with them closed or in incognito mode. I have tried disabling all extensions and had the same problem. This seems to have started happening recently when I updated chrome (now on Version 80.0.3987.132).
I am not really sure where to start debugging this issue but it has become very frustrating to develop on my app.
Any advice or help debugging would be appreciated.
TL;DR: Go to the Sources tab and delete all breakpoints for the site.
I had a similar problem. My site was very slow to load, but only in specific circumstances:
Dev-tools were open.
Tab was in a normal window. (not incognito mode)
Profiling was not enabled.
If (and only if) all three of those conditions were met, the site would load unbearably slowly (15+ seconds; normally ~3s), plus have performance issues for certain operations on the site (like changing which subpanel was open). It was very strange.
Like you, I tried disabling all of my extensions, yet the problem persisted.
Attempt 1: I tried clearing all of the site's cookies and local-storage, using the info/lock dropdown at the left of the address-bar. Suprisingly, that seems to have fixed it! (edit: this was not the root problem; see below for that)
So the problem must be that my site was storing too much data in local storage or something, such that dev-tools was choking on it (but only in specific cases, for some reason). This also matches with the issue resolving in incognito mode: incognito mode uses a "clear slate" for site cookies/local-storage.
Anyway, it's an odd one, but the cookies/local-storage clearing seems to have worked for my case. (If the issue comes up again, and the solution above doesn't fix it, I'll try to remember to mention it.)
Update: Oddly, having the profiler on still speeds things up even after the fix (ie. those three conditions being met still slows down page loading and actions, just much less than before the fix). So apparently the fix merely "reduces the intensity" of the problem rather than fully fixing it; like, by resetting local-storage, it lessens the size of that data, which somehow is a variable affecting the core problem (not yet identified).
Attempt 2: I believe I have found the root problem and solution: I removed all breakpoints for the site, and the slowdown was solved completely. So the problem seems to be that I had lots of unneeded breakpoints set at various places in my website code (some enabled, some disabled). Some of these must have been placed in/near "hotspots" that were getting called frequently. By having the dev-tools open, the Javascript engine must have had to start performing some processing related to the breakpoints, slowing things down.
My guess is that the problem would also be fixed by disabling the "JavaScript source maps" settings (as that's the only thing I can think would cause so much slowdown), but I haven't confirmed this.
This has most probably something to do with this commit, titled "Stop sending profile data when recording is off".
They already know there is an issue with the Developer Tools slowing down and they tried to prevent it by preventing profiling data to be sent via the bridge to the frontend, when not recording.
As reported, it seems the issue is not happening anymore, on the latest version. However, the cause is still unknown.
Try uninstalling the Developer Tools extension, clearing browser cache and then installing it again.
You should probably try using a version other than the one you're using, Version 80.0.3987.132. The app you are trying to develop might not be suitable to the version you are using. Delete the extension you are using, clear and remove every trace of browser cache and then re-download the extension, like what Daniele Molinari said. It might help. If it doesn't let me know. I'll try a different approach.

How to properly use PhantomJS for any website?

I'm trying to capture a website using PhantomJS, in particupar I'm using Pageres.
This website has got:
AngularJS
LocalStorage use
AJAX requests to an API
So, I'm testing locally and I'm not getting expected results, sometimes the screenshot will work with errors -rendering part of the contents, sometimes it won't render complete contents.
It really looks like Pagerer gets not enough time to take the screenshot once the site has fully loaded. I already added delay option but it will fail anyways, actually I could said it has worked better with out the delay option.
This is what it should be rendered:
And when it has worked best, this is what I get:
This is my code for rendering:
var pageres = new Pageres({})
.src('fantastica.a2015.mediotiempo.com', ['1440x900'], {delay: 3, crop: false});
pageres.on('warn', function (err,obj) {console.log(err,obj)});
pageres.run(function (err, screenshot) {
screenshot[0].pipe(response);
});
And, (I know there would be MUCH code to explain now) this is JS code being rendered.
Any particular advice?
Be aware of the differences between Phantom versions.
Phantom 1.9.x (which Pageres is using) is a browser engine from quite a few years ago (Chrome 13 is the closest equivalent) and will not render many HTML5 features.
Phantom 2.x is a much more modern webkit engine. But because of: a) because they have not produced a ready-made linux binary; b) some small API changes, projects like CasperJS and Pageres are holding back on supporting it. According a comment in https://github.com/sindresorhus/pageres/issues/77 if you make your own binary, and symlink to it, it works.
Also be aware that SlimerJS is an alternative to PhantomJS, based on Firefox rather than WebKit. There is no similar project based on Blink (to get screenshots how a modern Chrome would render them), but there is TrifleJS for IE. (However the Pageres pages say it is not the goal of the project to support other engines.)
Wait for DOM elements to appear, rather than using a delay.
Ajax calls, delayed loading, etc. make things very hard to predict. So, enter a polling loop, and don't take your screenshot until the DOM element you want in your screenshot is now visible. CasperJS has waitForSelector() for this case. PhantomJS has the slightly lower-level waitFor().
I think pageres would need a bit of hacking to add this functionality.

BigQuery UI - Datasets missing

I have a weird issue with my BigQuery UI (going on https://bigquery.cloud.google.com/queries/my-project-name). I don't know why, but I see no datasets for my projects, when I'm fully aware they exist. My code can still hit these datasets and their tables. There is just no way for me to see them.
In the UI itself, I can still query them if I type the whole query by hand, but being able to see my structure for my schema could be helpful.
When I check my network tab in the developer tools on chrome, I notice that I receive "Failed to load ressource: net::ERR_CACHE_MISS". I then decided to do everything I could to reset my own cache. I cleared my cookies, went incognito, I tried other browsers, even other computers. NOTHING brings back my datasets.
Anyone encountered this and has any ideas how to force my cache to hit?
I had the same problem a while back. When I got the error, I struggled with it and I ended up finding a way to reset this. Seems like it's something cached server-side that makes this incorrect cache-hit. The way to reset the server-side cache is to hit a URL with a project that doesn't exist, so something like https://bigquery.cloud.google.com/queries/bogus-nonexistant-project should reset it all
Did you recently assign a new string ID to your project that previously only had a numeric ID? If so, this is a known issue that has been reported recently, and I'm still working to resolve.
The issue is that the frontend cache gets stuck with the old numeric ID for the project and our frontend JS has a bug where it errors out instead of updating the cache to contain the new string ID. LiY's workaround of going to a bogus, uncacheable URL is the suggested workaround to unstick the cache until this bug is resolved.
(And if you didn't recently assign a new string ID to your project, then I'd love to hear more details about what might have caused this issue so it won't happen to anyone else!)

After a bug is resolved in bugzilla, I don't find the bug existing anymore. How could I access it?

Once the bug is set RESOLVED, the bug is completely removed from my bugs. I wanted to keep a track of the number of issues resolved. How could I see it and get back all in one list?
Go to any "Search" page and make sure "Status" is set to "all" (or whatever). The default is usually "open" and that's why you're not seeing your closed bugs. If you open the "Advanced" tab of the search, you can drill down very precisely.
Your search criterion "Resolution" may have value "---" which is a value, not a wildcard. Complicating things, usually web browsers don't give you an obvious way to deselect the only selected value in a multiselect list such as this one.
Fix:
You can deselect the "---" value of the "Resolution" search field by holding down the Ctrl key and clicking on the "---" value.
That works in Internet Explorer, Firefox, and Chrome. If I recall correctly it works in Safari as well, or maybe that uses Command or Option modifier keys instead of Ctrl.
Of course this fix doesn't apply to mobile devices. Long press? I don't know.
Alternatively there's nothing wrong doing like in Excrubulent's answer: work around this difficulty by selecting all of the values in the Resolution list.
Actually my BzDeck app [1] had the same issue. It was showing My Bugs in the main Inbox thread pane, the core feature of the app, but bugs would suddenly disappear when it's been RESOLVED. My solution was adding a selector to display all/open/closed bugs [2].
There are two different scenarios:
People usually would like to focus on open bugs (bug if they are involved in too many bugs, the My Bugs list could be very long), however,
People sometimes continue discussing on closed bugs (on BMO, RESOLVED FIXED for Firefox bugs only means the patch has been committed to the source code repository)
Given that, a better, possible solution would be:
Distinguish clearly open bugs from closed bugs like GitHub issues (this applies to the all UI on Bugzilla; GitHub issues use green and red icons for this purpose [3])
Provide a selector like BzDeck to switch between all/open/closed bugs, showing all bugs by default
Load/show the bug list lazily to improve performance
As mentioned, My Bugs was the core of BzDeck as well as another experimental Bugzilla client called Buggy [4], and I believe Bugzilla should also implement the same thread sidebar so people can go though their bugs much faster.
https://bugzilla.mozilla.org/show_bug.cgi?id=1380026
Searching under the advanced tab for resolved bugs doesn't work in some versions of Bugzilla. See this bug on the Bugzilla Bugzillaception:
https://bugzilla.mozilla.org/show_bug.cgi?id=663377
That bug says resolved for 4.2.1, but I'm using 4.2.5 and it isn't fixed for me, so apparently your mileage may vary. I've mentioned this issue on that bug.
A potential workaround for now is to search for various resolution values (FIXED, WONTFIX, WORKSFORME, etc). Anything with those values set should have a status of resolved or verified.
When you are using the quick search, ALL is your friend, this word has to be typed at the very beginning of the input line and overrides the status criterion (as can be found in: Examples of Simple Queries).
BTW: Bugzilla's quick search can also be added to the Browser's search engines and combined with a keyword also within its address bar. (confirmed for Firefox and Edge)
I warmly recommend the 5½-minute summary in Bugzilla Quicksearch will BLOW YOUR MIND on YouTube.

Resources