The Edit HTML Source Tool:
Detects script code and strips it out – so not much use at all in this context.
The Script Editor Web Part:
The best and only logically designed built in option because it accepts ANY code. Find it under web parts » media and content.
This is really a confusing way of doing things because the "embed code" tool isn't rationally designed and is a prominent button in the ribbon while the script editor web part is buried in the list of available web parts with no clear indication it's there. A better design would be to eliminate the redundant "embed code" tool and just have the script editor web part (which lets you add ANY code) available in the ribbon. There's no need for both.
The "Roll Your Own" Option For More Advanced Users
2/. Save as a .txt file and upload to the Site Assets library. Or even easier, create the file directly in Sharepoint Designer.
3/. Insert a content editor web part on your desired page. In the "content link" box, enter the url of your text file.