A new browser in the works

For discussions about side projects, potential future projects or helper applications for Pale Moon.
User avatar
noobsoftware
Apollo supporter
Apollo supporter
Posts: 41
Joined: 2020-09-01, 15:19

A new browser in the works

Unread post by noobsoftware » 2022-08-01, 14:56

I'm working on creating a browser built on top of .NET, C#, PHP, Xamarin.Forms and JavaScript. I am working on a JavaScript engine written from scratch, and it's coming along nicely, i already have a majority of the basics completed, although it will probably take some time to iron out the kinks and make it work comparable to other browsers. I am at the point of starting work on a layout engine. And i was wondering if anyone here has relevant information or documentation that might be helpful to get started, I have the CSS Spec to work with but it is amazingly complex. I will be using the layout engine in Xamarin.Forms as the basis for rendering so things like BackgroundColor will be taken care of. But properties like display, position, float etc, will have to be calculated. And i'm wondering if there are some principals to consider when it comes to HTML/CSS layout rendering, that are not obvious from the css standpoint. I must admit i haven't read the entire spec (yet). But i thought people that have worked on Goanna for instance might have a take on this.

Also if people have thoughts on what they would like to see i new browser supporting (HTML/javascript) extensions it would be fun to hear.

Also to explain a little about this project, i mainly started it because i love web technologies but find C++ to be overwhelming and overly complex. Which is why i decided to program this browser almost completely in PHP and C#, my favorite programming languages, hoping that it will be a nice basis for the future.

Also if someone is interested in taking part in the project let me know.

Here's is the repo for php code, if you want to take a look at the javascript parser or engine, async functions require the c# code which i will keep as private repo for the time being.
https://github.com/noobsoftware/ice

User avatar
bSun0000
Hobby Astronomer
Hobby Astronomer
Posts: 17
Joined: 2022-03-22, 23:32

Re: A new browser in the works

Unread post by bSun0000 » 2022-08-01, 19:09

Which is why i decided to program this browser almost completely in PHP and C#
The second worst decision you can make in your life after "she cheated on me but i decide to forgive her".

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 32415
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: A new browser in the works

Unread post by Moonchild » 2022-08-01, 20:52

noobsoftware wrote:
2022-08-01, 14:56
I am working on a JavaScript engine written from scratch
I wish you the best of luck with that one. The ECMAScript specification is obscenely large and complex. And if you want it to be meaningful you'll have to have a solid document object model as well to interface with from JS.
noobsoftware wrote:
2022-08-01, 14:56
I am at the point of starting work on a layout engine.
I'm afraid that the layout engine is going to be more complex than you realise. You think the CSS spec is complicated? Wait until you get into the thick of stacking contexts, flexboxes, animations and transitions/transformations. And let's not forget they are working hard on making CSS a scripting language too now :P
"The best revenge is to not be like the person who wronged you." -- Marcus Aurelius
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
Image

User avatar
Sajadi
Board Warrior
Board Warrior
Posts: 1151
Joined: 2013-04-19, 00:46

Re: A new browser in the works

Unread post by Sajadi » 2022-08-01, 22:27

noobsoftware wrote:
2022-08-01, 14:56
I am working on a JavaScript engine written from scratch
Why not offering your help towards Moonchild Javascript engine wise if you go in depth so far? Pale Moon is in need for more additional skilled people with knowledge in that 8-)

User avatar
RoestVrijStaal
Moon lover
Moon lover
Posts: 78
Joined: 2019-06-19, 19:18
Location: Dependency Hell

Re: A new browser in the works

Unread post by RoestVrijStaal » 2022-08-01, 23:25

Well, creating a browser rendering a subset of HTML, JavaScript, et al could be instructive at worst.

For what reason do you require to use PHP in your project?

Instead of writing a JavaScript engine, you could consider writing an engine which uses a superset of JavaScript instead, like TypeScript.

Same story goes for CSS. Why not make a LESS or SASS engine instead? Why not limit the units used in the styling engine to px? Implementing additional support for pt and (r)em means only more burden.

What most browsers nowadays still do "wrong" is ignoring the programming best practice of "Fail fast". Almost no matter how much element tags you've not closed or attributes you've put into the element, the browser still tries to render despite the document is invalid.

Same goes for encodings. Why accept (redudant) file encoding like Windows-1250, 1252-1254, 1257 while Unicode is around for years? Just accept Unicode only and you do not have to worry about file encodings.

User avatar
noobsoftware
Apollo supporter
Apollo supporter
Posts: 41
Joined: 2020-09-01, 15:19

Re: A new browser in the works

Unread post by noobsoftware » 2022-08-02, 11:58

Sajadi wrote:
2022-08-01, 22:27
noobsoftware wrote:
2022-08-01, 14:56
I am working on a JavaScript engine written from scratch
Why not offering your help towards Moonchild Javascript engine wise if you go in depth so far? Pale Moon is in need for more additional skilled people with knowledge in that 8-)
I've spent some time trying to understand the UXP and Basilisk source codes, and i find them extremely overwhelming, and my c++ skills are not up to par for me to be able to contribute to UXP.
RoestVrijStaal wrote:
2022-08-01, 23:25
Well, creating a browser rendering a subset of HTML, JavaScript, et al could be instructive at worst.

For what reason do you require to use PHP in your project?

Instead of writing a JavaScript engine, you could consider writing an engine which uses a superset of JavaScript instead, like TypeScript.

Same story goes for CSS. Why not make a LESS or SASS engine instead? Why not limit the units used in the styling engine to px? Implementing additional support for pt and (r)em means only more burden.

What most browsers nowadays still do "wrong" is ignoring the programming best practice of "Fail fast". Almost no matter how much element tags you've not closed or attributes you've put into the element, the browser still tries to render despite the document is invalid.

Same goes for encodings. Why accept (redudant) file encoding like Windows-1250, 1252-1254, 1257 while Unicode is around for years? Just accept Unicode only and you do not have to worry about file encodings.
PHP is an excellent high level language which i prefer to use in my projects. Although this implementation is of course always going to be slower then a well implemented C++ browser, and i have to wait and see how the layout engine implementation goes, it will obviously take some time just to get started and even then it will have faults (atleast to start with), as i said this is hopefully a good basis for the future, not something that will be ready soon. I don't get what you mean by the file encodings? And as for making a typescript or LESS or SASS engine that would not be necessary by any means for the web, to my understanding.
Moonchild wrote:
2022-08-01, 20:52
noobsoftware wrote:
2022-08-01, 14:56
I am working on a JavaScript engine written from scratch
I wish you the best of luck with that one. The ECMAScript specification is obscenely large and complex. And if you want it to be meaningful you'll have to have a solid document object model as well to interface with from JS.
noobsoftware wrote:
2022-08-01, 14:56
I am at the point of starting work on a layout engine.
I'm afraid that the layout engine is going to be more complex than you realise. You think the CSS spec is complicated? Wait until you get into the thick of stacking contexts, flexboxes, animations and transitions/transformations. And let's not forget they are working hard on making CSS a scripting language too now :P
Modern web browers definitely have the most complex layout engine you can find, I was hoping, and still am hoping to be able to find simple generalization methods or some simple way to implement this huge complexity, and animations only make matters more complex. But i will try my best.

User avatar
Bilbo47
Fanatic
Fanatic
Posts: 156
Joined: 2017-11-18, 04:24

Re: A new browser in the works

Unread post by Bilbo47 » 2022-08-02, 23:06

Very cool. What is the plan to 'link' php and C++ into a compiled executable system? Does it involve any interpretation of source code at runtime, or any 'just-in-time compiling' at runtime?

User avatar
The Squash
Apollo supporter
Apollo supporter
Posts: 38
Joined: 2021-03-19, 19:39

Re: A new browser in the works

Unread post by The Squash » 2022-08-05, 22:16

Bilbo47 wrote:
2022-08-02, 23:06
What is the plan to 'link' php and C++ into a compiled executable system?
Beware that the OP talked about writing this browser in PHP and C#, not C++. @noobsoftware explicitly mentioned that they are not C++-proficient.
Off-topic:
And, I'm not judging -- after all, I understand C++ but choose never to write it if I can avoid it. As much as people protest, C++ is a very vast and strict programming language and it's plenty easy to shoot yourself in the foot. My preference is C -- you sure can shoot yourself in the foot with C; but since C has far, far fewer language features than C++, it's pretty easy to remember all the rules about the C language. And, when programmers write C++ code, they sort of hide a lot of stuff from the compiler (it's the nature of OOP), so in very huge C++ projects, often the compiler can't do very much optimization at all.
So I tip my hat to @noobsoftware and hope them the best of luck.
Off-topic:
EDIT: Yes, PHP and C# are hard for the compiler / interpreter to optimize for the same reasons that C++ can be tough to optimize. But hey, this browser will probably turn out fairly simple even in the end -- just so long as it doesn't become a platform for e-mail readers, Zip/RAR archive extractors, and Web browsers alike! :grin: (EDIT 2: No offense intended.)
Hang-Inducing Orphaned Zombie Garbage :twisted:

In theaters now -- Rated R

User avatar
Bilbo47
Fanatic
Fanatic
Posts: 156
Joined: 2017-11-18, 04:24

Re: A new browser in the works

Unread post by Bilbo47 » 2022-08-05, 22:31

OP talked about PHP and C#, not C++
Oops, yeah, my goof. Of course my real question is: What is the plan to 'link' php (with or without any other language) into a compiled executable system? "Any other language" could be C / older traditional compile or C++ / newer traditional compile or C# / (dunno if this means Microcrust dotNet framework only). Anyway afaik the hurdle is linking php so that it executes natively and not interprets source at runtime, regardless of also using any other language in the project.

User avatar
noobsoftware
Apollo supporter
Apollo supporter
Posts: 41
Joined: 2020-09-01, 15:19

Re: A new browser in the works

Unread post by noobsoftware » 2022-08-08, 18:51

Bilbo47 wrote:
2022-08-05, 22:31
OP talked about PHP and C#, not C++
Oops, yeah, my goof. Of course my real question is: What is the plan to 'link' php (with or without any other language) into a compiled executable system? "Any other language" could be C / older traditional compile or C++ / newer traditional compile or C# / (dunno if this means Microcrust dotNet framework only). Anyway afaik the hurdle is linking php so that it executes natively and not interprets source at runtime, regardless of also using any other language in the project.
PHP can be used in .NET and C# using a great new thing called PeachPie. But as far as this project goes i'm having trouble making the JavaScript parser work fast enough to be feasible, and as Moonchild said the layout engine is far beyond feasible at this point in time at least. But if anyone is interested and has knowledge of making programming language parsers work fast i would accept any help. Because the js-engine is interesting enough, it can also possibly be used within .NET to use JavaScript within .NET in combination with PHP. Although it would have to access C# objects through PHP. But there are some javascript engines in .NET already, but none that support async functions, atleast i don't think so. But this project was premature to be announced like i did, even though i have a foundation for a "browser" it would look like something from 1995 if it were ever completed. But the JS engine could still be useful.

Post Reply