Grammatically, I think the parenthetical clause can only refer to the antecedent "Oracle". I don't know the real-world relationships and histories, but I believe that, like Netscape, Sun and Oracle are "companies" rather than "trademarks" in OP's context.
That being so, OP's sentence isn't just "ambiguous". It's either "ungrammatical" (because the parenthetical clause can't refer all the way back to "Javascript"), or gibberish (because it mixes up "trademarks" and "companies that own trademarks"). I'm guessing what OP really means is...
1. It's widely known that the name "JavaScript" is trademarked by Oracle. It was formerly a trademark of Sun - and prior to that, of Netscape.
...or...
2. It's widely known that the name "JavaScript" is trademarked by Oracle (it was formerly a trademark of Sun - and prior to that, of Netscape).
The brackets in (2) retain OP's "single sentence", but I think it makes for an ungainly construction. But in both cases the "primary subject" of the first sentence/clause is the name "JavaScript", which the second it unambiguously references.
Addressing OP's second request - sticking with a single sentence, and ignoring "real-world" semantic issues with the example...
3. It's widely known that the name "JavaScript" is trademarked by Oracle (itself formerly a trademark of Sun - and prior to that, of Netscape). ["Oracle" was a trademark of Netscape].
4. It's widely known that the name "JavaScript" is trademarked by Oracle (it was formerly a trademark of Sun, which was itself formerly a trademark of Netscape). ["Sun" was a trademark of Netscape].
Note that (3) is essentially just OP's original, with the word "itself" added to guide the reader towards the intended (but semantically problematic) interpretation.
Grammatically speaking, "itself" is again an "optional guide" in (4), but because we're dealing with an even more convoluted set of interrelationships, I'd extend it to "which was itself" to make the intended sense clear.
I'm not sure I'd ever write (4) as a single sentence, but at least this shows how it could be done.