A new browser in the works
-
- Apollo supporter
- Posts: 45
- Joined: 2020-09-01, 15:19
A new browser in the works
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
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
-
- Apollo supporter
- Posts: 36
- Joined: 2022-03-22, 23:32
Re: A new browser in the works
The second worst decision you can make in your life after "she cheated on me but i decide to forgive her".Which is why i decided to program this browser almost completely in PHP and C#
-
- Pale Moon guru
- Posts: 35648
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: A new browser in the works
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.
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
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
-
- Board Warrior
- Posts: 1227
- Joined: 2013-04-19, 00:46
Re: A new browser in the works
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
-
- Moon lover
- Posts: 81
- Joined: 2019-06-19, 19:18
- Location: Dependency Hell
Re: A new browser in the works
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.
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.
-
- Apollo supporter
- Posts: 45
- Joined: 2020-09-01, 15:19
Re: A new browser in the works
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.
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.RoestVrijStaal wrote: ↑2022-08-01, 23:25Well, 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.
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.Moonchild wrote: ↑2022-08-01, 20:52I 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.
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
-
- Fanatic
- Posts: 240
- Joined: 2017-11-18, 04:24
Re: A new browser in the works
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?
-
- Apollo supporter
- Posts: 40
- Joined: 2021-03-19, 19:39
- Location: The Universe (?)
Re: A new browser in the works
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.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.
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! (EDIT 2: No offense intended.)
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! (EDIT 2: No offense intended.)
HANG-INDUCING ORPHANED ZOMBIE GARBAGE
In theaters now -- Rated R
(Thanks @[PCMartin], great title for a movie!)
In theaters now -- Rated R
(Thanks @[PCMartin], great title for a movie!)
-
- Fanatic
- Posts: 240
- Joined: 2017-11-18, 04:24
Re: A new browser in the works
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.OP talked about PHP and C#, not C++
-
- Apollo supporter
- Posts: 45
- Joined: 2020-09-01, 15:19
Re: A new browser in the works
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.Bilbo47 wrote: ↑2022-08-05, 22:31Oops, 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.OP talked about PHP and C#, not C++
-
- Moon lover
- Posts: 94
- Joined: 2021-07-08, 13:08
- Location: São Paulo, Brazil
Re: A new browser in the works
I'm not trying to be repetitive, but it makes me really doubtful the amount of endless work it would take to learn and contribute with some stuff inside PM as a project or addons. I saw you spoke about how the PM project seems hard to even be grasped as much as it's needed, but is it going to be easy to grasp what will be needed to do what you want as the first guy to do it fully, even if in 1995 functionality?
-
- Contributing developer
- Posts: 1537
- Joined: 2018-10-28, 19:56
- Location: Georgia
Re: A new browser in the works
The thing is, there's not really a shortage of simpler 1995-era browser engines like the one you're trying to create...
There's stuff like Dillo, BrowseX, Lynx, Arachne, etc. It's not so much that a new browser engine can't be created exactly like was done in 1995 or so, it's that a new browser engine that supports modern web standards essentially can't be created from scratch by a small team.
https://drewdevault.com/2020/03/18/Reck ... scope.html
I mean, if you're just creating it for educational purposes to see what can be done, go right ahead, but there's a reason Pale Moon exists as a hard fork of Firefox. If we thought starting over from scratch with a new engine would be easier, we would have taken that approach. Though I do admit, the layout engine we have is not in great shape, isn't well-documented, and I could definitely understand why someone would think writing a new one from scratch makes sense.
There's stuff like Dillo, BrowseX, Lynx, Arachne, etc. It's not so much that a new browser engine can't be created exactly like was done in 1995 or so, it's that a new browser engine that supports modern web standards essentially can't be created from scratch by a small team.
https://drewdevault.com/2020/03/18/Reck ... scope.html
I mean, if you're just creating it for educational purposes to see what can be done, go right ahead, but there's a reason Pale Moon exists as a hard fork of Firefox. If we thought starting over from scratch with a new engine would be easier, we would have taken that approach. Though I do admit, the layout engine we have is not in great shape, isn't well-documented, and I could definitely understand why someone would think writing a new one from scratch makes sense.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind
-
- Astronaut
- Posts: 512
- Joined: 2015-08-23, 17:56
- Location: UK / France
Re: A new browser in the works
Having forked a few, I'd suggest that addons would be a good place to start, and certainly not endless work. XUL, used for the interface, is fairly well documented; you clearly understand JavaScript, which is almost universally used for scripting; there are plenty of working examples that can be examined and plenty of others that could be forked. And a couple of issues with one or two of my forked ones that you could take a look atEduardo Lucas wrote: ↑2022-08-12, 01:57...the amount of endless work it would take to learn and contribute with some stuff inside PM as a project or addons.
Forked extensions :
● Add-ons Inspector ● Auto Text Link ● Copy As Plain Text ● Copy Hyperlink Text ● FireFTP button replacement ● gSearch Bar ● Navigation Bar Enhancer ● New Tab Links ● Number Tabs ● Print Preview Button and Keyboard Shortcut 2 ● Scrollbar Search Marker ● Simple Marker ● Tabs To Portfolio ● Update Alert ● Web Developer's Toolbox ● Zap Anything
Hint: If you expect a reply to your PM, allow replies...
-
- Apollo supporter
- Posts: 45
- Joined: 2020-09-01, 15:19
Re: A new browser in the works
Indeed. I have basically canceled this project, the idea of course being that it would be "cleaner" to start from scratch, but i will definitely just focus my efforts on PM, Extensions, and possibly UXP if i can ever grasp it. PM and Basilisk and the mac forks have basically everything a browser needs, but it is very annoying to have to use other browsers. I would love to see things like customelements implemented despite it being a pretty useless feature to my knowledge. And one of the problems i have with grasping the UXP code and the browser code is of course lack of documentation and lack of understanding the structure. And i personally could use a refresher in C++ to understand some of the code. And it's noteworthy that the JavaScript engine in Pale Moon and Basilisk actually runs a simple mathematical program I've written multiple times faster than C# does. And comparable animations run similar in C# and JavaScript in most cases. So the UXP code and PM are amazingly well written and work amazingly well.athenian200 wrote: ↑2022-08-12, 04:36The thing is, there's not really a shortage of simpler 1995-era browser engines like the one you're trying to create...
There's stuff like Dillo, BrowseX, Lynx, Arachne, etc. It's not so much that a new browser engine can't be created exactly like was done in 1995 or so, it's that a new browser engine that supports modern web standards essentially can't be created from scratch by a small team.
https://drewdevault.com/2020/03/18/Reck ... scope.html
I mean, if you're just creating it for educational purposes to see what can be done, go right ahead, but there's a reason Pale Moon exists as a hard fork of Firefox. If we thought starting over from scratch with a new engine would be easier, we would have taken that approach. Though I do admit, the layout engine we have is not in great shape, isn't well-documented, and I could definitely understand why someone would think writing a new one from scratch makes sense.
-Edit-
By animations in C# i of course meant: native animations in native code, not just in C#.
-
- Contributing developer
- Posts: 1537
- Joined: 2018-10-28, 19:56
- Location: Georgia
Re: A new browser in the works
Yeah, I feel the same way. The biggest obstacles we really face with UXP-based browsers are that we're struggling to add all the plumbing for WebComponents. Simple, one-off changes that touch code we have already are fairly easy to backport, and even some simpler stuff that's done to the Rust code can be translated over to what we have easily enough. The problem is that WebComponents requires different parts of the codebase to interact in ways they never did before, and there aren't clear tests you can do to tell if what you have implemented works correctly or not until you have more of it.noobsoftware wrote: ↑2022-08-15, 15:20Indeed. I have basically canceled this project, the idea of course being that it would be "cleaner" to start from scratch, but i will definitely just focus my efforts on PM, Extensions, and possibly UXP if i can ever grasp it. PM and Basilisk and the mac forks have basically everything a browser needs, but it is very annoying to have to use other browsers. I would love to see things like customelements implemented despite it being a pretty useless feature to my knowledge.
WebComponents/Custom Elements builds on itself in a way I dislike, it reminds me of how I always suffered at higher levels of Math and was always told by my teachers it was because "Math builds on itself," and the 10% I didn't get from previous classes was just always catching up with me at higher levels until I could barely keep up despite working my butt off and going to tutoring every day because what was previously a minor gap in my understanding becomes a huge gap that I can't cover up before the next test in the next year. They would always tell me that my approach wasn't good enough and that 95% doesn't cut it in higher-level Math like Calculus, that if you don't understand 100% of the material from the previous class, you aren't really ready for the next one and your mistakes will just build on themselves each year until you can't do the work anymore. WebComponents is designed just like a Math class. It requires you to have a solid foundation, understand how every part interacts with every other part, and learn/implement everything in a very specific order.
Oh yeah, for sure. It's pretty amazing that we have as much as we do and have been able to keep it functioning given how complex the modern web is, when you think about it. It really doesn't help that the pre-Rust layout engine is one the least well documented parts of the Mozilla codebase. There's probably a reason why replacing the layout engine came first on Mozilla's list of things to rewrite with their new language.And one of the problems i have with grasping the UXP code and the browser code is of course lack of documentation and lack of understanding the structure. And i personally could use a refresher in C++ to understand some of the code. And it's noteworthy that the JavaScript engine in Pale Moon and Basilisk actually runs a simple mathematical program I've written multiple times faster than C# does. And comparable animations run similar in C# and JavaScript in most cases. So the UXP code and PM are amazingly well written and work amazingly well.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind
-
- Board Warrior
- Posts: 1322
- Joined: 2014-02-02, 22:15
- Location: Chicagoland
Re: A new browser in the works
Off-topic:
(And then I found out a semester or two later that my first college advisor was rather dim, since my AP high school classes satisfied my college math requirements so I could've taken some other class instead of suffering through college-level calculus. )
Oh man, does THAT bring back memories .... I still don't know how I was able to get through AP Calculus in high school and then more at the college level without being able to fully comprehend trigonometry.athenian200 wrote: ↑2022-08-15, 17:20if you don't understand 100% of the material from the previous class, you aren't really ready for the next one
(And then I found out a semester or two later that my first college advisor was rather dim, since my AP high school classes satisfied my college math requirements so I could've taken some other class instead of suffering through college-level calculus. )
Nichi nichi kore ko jitsu = Every day is a good day.
-
- Apollo supporter
- Posts: 45
- Joined: 2020-09-01, 15:19
Re: A new browser in the works
I've changed plans a bit and am now working on a torrent client called Noob Torrent that will allow JS addons and themes. And i will keep the JavaScript engine as a separate project so it will theoretically be possible to use it for more applications. I will possibly add this functionality to my video player (Noob Player).
-
- Knows the dark side
- Posts: 4983
- Joined: 2015-12-09, 15:45
Re: A new browser in the works
Built using UXP? If so, will you be able to make it a standalone application?noobsoftware wrote: ↑2022-11-10, 18:11a torrent client called Noob Torrent that will allow JS addons and themes.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
-
- Apollo supporter
- Posts: 45
- Joined: 2020-09-01, 15:19
Re: A new browser in the works
Not using UXP, using a JS engine i'm currently building. I've made one application using UXP, called Noob Music but i was able to transfer all of the code to .NET to make it viable for the app store and it was "hackish" because i based it on the basilisk codebase and simply replaced XUL files with my own instead of making it a proper UXP application with its own folder structure. I am focusing on the .NET platform, despite UXP having multiple advantages it's currently simply to complicated for me to start an application. I am still hoping someone with knowledge of UXP can create an app template like you would get in visual studio when starting a new project to make it easier to make UXP applications. But hopefully i can add to the "flora" of applications with JS addons and scriptability with my current project.moonbat wrote: ↑2022-11-10, 23:44Built using UXP? If so, will you be able to make it a standalone application?noobsoftware wrote: ↑2022-11-10, 18:11a torrent client called Noob Torrent that will allow JS addons and themes.