jackbuehner / MicrosoftEdge-S.U.R.F.

The S.U.R.F. game from edge://surf
83 stars 54 forks source link

Update request #1

Closed liudonghua123 closed 4 years ago

liudonghua123 commented 4 years ago

I see a new edge://surf/ game in Edge 83, is there any plans for updating.

I tried download all the sources of edge://surf/, but during the running, I got the following errors.

Uncaught (in promise) TypeError: chrome.send is not a function
    at Object.sendWithPromise (cr.js:347)
    at Function.getAllStats (surf.bundle.js:205)
    at surf.bundle.js:6610
    at Generator.next (<anonymous>)
    at surf.bundle.js:6591
    at new Promise (<anonymous>)
    at Cs (surf.bundle.js:6568)
    at surf.bundle.js:6609
    at surf.bundle.js:6621
    at Generator.next (<anonymous>)

The errors come from cr.js:347. Why your code did not invoke this scripts. 😲

rbeesley commented 4 years ago

@liudonghua123, you and I are hitting the same problem. I forked this repro and was going to provide a PR, tagging the first version and providing an update with the latest, but I can't seem to get past that call either. The most obvious thing is that this function wasn't called in the first version.

rbeesley commented 4 years ago

Okay, this looks like it is going to get more complicated. sendWithPromise() and send() are part of WebUI. “WebUI” is a term used to loosely describe parts of Chrome's UI implemented with web technologies (i.e. HTML, CSS, JavaScript). Because the game runs in edge://, it is an internal resource. This also allows it to access and load shared libraries in edge://resources/. It looks like the method it is calling, in this first case get-stats is "native code" and is something built into Edge. surf.bundle.js:formatted@205-245 has 11 calls which are going to cause problems...

It won't save scores and there might be other issues, but I got it working. I'll try to clean things up tomorrow and will try to get a pull request together.

liudonghua123 commented 4 years ago

@rbeesley nice exploration, thanks, look forward to your pr 😄

rbeesley commented 4 years ago

So this is complicated. I fixed things to the point that I'm capable of running the game in Edge. If I switch to InPrivate mode on the same browser or switch to Edge (beta channel) in either normal or InPrivate the same files fail. I was able to get the save scores working, but there must be some cached file which is making this work and which I can't yet track down. I must be close, but I can't for the life of me understand what is different between the different browser instances so that only one of the four configurations I'm using works.

rbeesley commented 4 years ago

Figured it out. When I was trying to do clean up I removed some initializing data I thought which was redundant. It turns out that what I had already saved into localStorage was making my one instance work while the others which did not have this initial state were breaking. I should be able to create the PR with a little more clean up.

rbeesley commented 4 years ago

Resolved with #2