Static Testing on Firefox

If you wish to contribute to the Ace Attorney Online Game Creation Engine open source project, or just know more about the way it is developed, this is the place.

Moderator: EN - Forum Moderators

Post Reply
User avatar
TimeAxis
Posts: 42
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English

Static Testing on Firefox

Post by TimeAxis »

I was playing around with the idea of possibly doing some development, but I hit a bit of a roadblock. From what I understand, according to the readme, if I just open the editor.html or player.html files in my personal cloned respository, it should load a trial from test_static/mock_trial_data.txt and I should be able to test changes to the editor or player from those files without having to mess with any web server stuff. The readme says this:
Instructions : Just open the /editor.html and /player.html pages in your browser. (Provided the browser's same origin policy does not interfere : as of writing, Firefox's default policy should allow everything to work directly from the file system, while Chrome's doesn't).
However, this appears to no longer be the case for Firefox, as I'm getting this error in the console for every file it tries to read:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///[file path]. (Reason: CORS request not http).
Is there any way for me to get around this and test things locally in my browser without needing to delve into any of the SQL web server stuff? Does anybody else do this? Also another minor question while I'm at it, but if I have a trial on my account here, how exactly do I grab the data from that trial to put it in the mock_trial_data.txt file? Is that something any user can just do?

If anyone can answer these questions, I would appreciate it. If I can get these things working, hopefully I might be able to contribute some things myself rather than just constantly making a bunch of suggestions for other people to do.
User avatar
ThePaSch
Moderator
Posts: 1262
Joined: Sun Jun 13, 2010 5:56 pm
Gender: Male
Spoken languages: English, German (native)
Location: Germany

Re: Static Testing on Firefox

Post by ThePaSch »

Try the following in Firefox:
  • Type "about:config" into the address bar and hit return. Accept any disclaimers that may pop up.
  • In the search bar, search for "privacy.file_unique_origin".
  • Double-click that entry - which should currently be set to "true" - to set it to "false".
  • Restart Firefox and try the static test again.
This process should hopefully be massively simplified as soon as Unas finds the time to migrate the development environment to the new AAOkube container-based architecture that the live site is already based on, but I'm not aware if there is an ETA for that at this time.
Part of the main AAO development team
-----
Image
User avatar
TimeAxis
Posts: 42
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English

Re: Static Testing on Firefox

Post by TimeAxis »

That worked, thanks. Although since I can't actually save a trial that way, it's not too great for actually testing if features work beyond the UI. I guess I'll probably have to just bite the bullet and set up the SQLite/PHP stuff to properly test.
User avatar
ThePaSch
Moderator
Posts: 1262
Joined: Sun Jun 13, 2010 5:56 pm
Gender: Male
Spoken languages: English, German (native)
Location: Germany

Re: Static Testing on Firefox

Post by ThePaSch »

TimeAxis wrote: Sat May 08, 2021 6:53 pm That worked, thanks. Although since I can't actually save a trial that way, it's not too great for actually testing if features work beyond the UI. I guess I'll probably have to just bite the bullet and set up the SQLite/PHP stuff to properly test.
Yes, that was going to be my suggestion anyway. You don't have to go for the full integrated install - I never even set that up on my end - but at least the mocked install would be a good idea if you're looking to get into proper development.
Part of the main AAO development team
-----
Image
User avatar
Enthalpy
Community Manager
Posts: 4981
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Static Testing on Firefox

Post by Enthalpy »

ThePaSch wrote: Sat May 08, 2021 1:00 pm Try the following in Firefox:
  • Type "about:config" into the address bar and hit return. Accept any disclaimers that may pop up.
  • In the search bar, search for "privacy.file_unique_origin".
  • Double-click that entry - which should currently be set to "true" - to set it to "false".
  • Restart Firefox and try the static test again.
This process should hopefully be massively simplified as soon as Unas finds the time to migrate the development environment to the new AAOkube container-based architecture that the live site is already based on, but I'm not aware if there is an ETA for that at this time.
If nothing else, we should make an issue to update the readme. Making issues is the easy part, so I can get to that.
TimeAxis wrote: Sat May 08, 2021 6:53 pm That worked, thanks. Although since I can't actually save a trial that way, it's not too great for actually testing if features work beyond the UI. I guess I'll probably have to just bite the bullet and set up the SQLite/PHP stuff to properly test.
This depends on the feature. If you tell me what you're trying to test, I can offer advice on whether it can be made to work without going through PHP.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Current AAO Development Priority: Issue #94: Grayscale Mode
User avatar
TimeAxis
Posts: 42
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English

Re: Static Testing on Firefox

Post by TimeAxis »

Not to use this thread as a general support thread (I'll stop if I can actually get the bare bones basics running), but I've got a mocked install somewhat running at this point, in that I can create and delete trials and access index.php fine, but I can't actually open those trials in the editor or player. I haven't actually made any changes to any files at this point, apart from following the instructions in the readme (Copying /mocked_install/config.php to /trunk/config.php), so I would assume it should be working. Not sure what I'm doing wrong.

This error is showing up at the bottom of index.php:
Warning: Undefined variable $row in \trunk\index.php on line 101

Warning: Trying to access array offset on value of type null in \trunk\index.php on line 101

Fatal error: Uncaught Error: Undefined constant "OPTION_FLAG_SMILIES" in \trunk\index.php:101 Stack trace: #0 {main} thrown in \trunk\index.php on line 101
When I try to enter the editor or player, I just get an infinite loading screen, and this error in the console:
Uncaught SyntaxError: expected expression, got '<' editor.php:336
Clicking through to that line of editor.php gives me the following:
//EXPORTED VARIABLES
<br />
<b>Warning</b>: Private methods cannot be final as they are never overridden by other classes in <b>trunk\includes\TrialMetadataHandler.class.php</b> on line <b>332</b><br />
var trial_information = JSON.parse("{\"id\":1,\"title\":\"test trial\",\"author_id\":2,\"author\":\"TestUser\",\"language\":\"en\",\"sequence\":null,\"can_read\":true,\"can_write\":true,\"last_edit_date\":1620501406,\"format\":\"Def1\",\"file_path\":\"..\\/mocked_install\\/trial_data\\/1620501406_47ec8ec659d8ecc3a37c164c2bce4763.txt\"}");
var initial_trial_data = JSON.parse("{\"profiles\":[0],\"evidence\":[0],\"places\":[0],\"sounds\":[0],\"music\":[0],\"popups\":[0],\"cross_examinations\":[0],\"scenes\":[0],\"scenes_aai\":[0],\"frames\":[0],\"ui\":{\"base\":\"classic\",\"elements\":[]}}");// trial_data variable is null at first, to avoid any modification until properly initialised.
var trial_data = null;
Anyone have any idea what could be going wrong here?
User avatar
TimeAxis
Posts: 42
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English

Re: Static Testing on Firefox

Post by TimeAxis »

For the record, I was able to fix this by changing line 332 of TrialMetadataHandler.class.php from private final function to just private function (which, from googling, seems to be the correct way to do that anyway). But I'm wary of doing this, because the former was how it was originally and I have no idea what kinds of repercussions changing that could have. I assume if this were actually a mistake, everyone else would have been affected by it too, but that didn't seem to be the case from the lack of response I got. Still, it did fix the problem, so... I guess I'll leave this here for anyone who might run into this problem in the future.
User avatar
Enthalpy
Community Manager
Posts: 4981
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Static Testing on Firefox

Post by Enthalpy »

Doing a bit of investigating, it looks like this is the result of a change in PHP 8. That's why this didn't cause problems earlier: PHP 8 is relatively recent.

I don't know how familiar you are with PHP, but "private" means that child classes can't access the method, and "final" means that child classes can't overwrite the method. This is redundant, and the correct remedy is to remove the redundant "final".

If you know how to work git (I don't know your background with coding), this looks like a good starter pull request to me.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Current AAO Development Priority: Issue #94: Grayscale Mode
User avatar
TimeAxis
Posts: 42
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English

Re: Static Testing on Firefox

Post by TimeAxis »

That’s what I figured, but I didn’t want to confidently make any assumptions about something I’ve only just dipped my toes into. I’ll give making a pull request for it a try.
User avatar
Enthalpy
Community Manager
Posts: 4981
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Static Testing on Firefox

Post by Enthalpy »

Please let me know if you need any help creating a pull request. I have a couple other pull requests ready for review, and I'd like to batch these in to get several uploaded at once.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Current AAO Development Priority: Issue #94: Grayscale Mode
User avatar
TimeAxis
Posts: 42
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English

Re: Static Testing on Firefox

Post by TimeAxis »

I don't have permission to create pull requests, as far as I can tell, so I posted it as an Issue instead.
User avatar
Enthalpy
Community Manager
Posts: 4981
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Static Testing on Firefox

Post by Enthalpy »

You click the "create a pull request" button on your fork, not the main AAO repository. That should work instead.

I'm assuming you know enough git to know what a fork is. Correct me if I'm wrong.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Current AAO Development Priority: Issue #94: Grayscale Mode
User avatar
TimeAxis
Posts: 42
Joined: Fri Jan 01, 2021 8:27 pm
Spoken languages: English

Re: Static Testing on Firefox

Post by TimeAxis »

I do know what a fork is, but I'm not that experienced with bitbucket, sorry. I'm using Git GUI on Windows but I'm not too well versed in it, and I don't fully know how to get the change from my computer onto the branch I created on bitbucket. The most I've used before is github desktop, which is significantly more user friendly.

I think I managed to do it. Let me know if I did anything wrong.
User avatar
Enthalpy
Community Manager
Posts: 4981
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Static Testing on Firefox

Post by Enthalpy »

You got it figured out.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Current AAO Development Priority: Issue #94: Grayscale Mode
Post Reply