(styleSheetId: Protocol.DOM.StyleSheetId, newText: string, majorChange: boolean)
| 825 | } |
| 826 | |
| 827 | async setStyleSheetText(styleSheetId: Protocol.DOM.StyleSheetId, newText: string, majorChange: boolean): |
| 828 | Promise<string|null> { |
| 829 | const header = this.#styleSheetIdToHeader.get(styleSheetId); |
| 830 | if (!header) { |
| 831 | return 'Unknown stylesheet in CSS.setStyleSheetText'; |
| 832 | } |
| 833 | newText = CSSModel.trimSourceURL(newText); |
| 834 | if (header.hasSourceURL) { |
| 835 | newText += '\n/*# sourceURL=' + header.sourceURL + ' */'; |
| 836 | } |
| 837 | |
| 838 | await this.ensureOriginalStyleSheetText(styleSheetId); |
| 839 | const response = await this.agent.invoke_setStyleSheetText({styleSheetId: header.id, text: newText}); |
| 840 | const sourceMapURL = response.sourceMapURL as Platform.DevToolsPath.UrlString; |
| 841 | |
| 842 | this.#sourceMapManager.detachSourceMap(header); |
| 843 | header.setSourceMapURL(sourceMapURL); |
| 844 | this.#sourceMapManager.attachSourceMap(header, header.sourceURL, header.sourceMapURL); |
| 845 | if (sourceMapURL === null) { |
| 846 | return 'Error in CSS.setStyleSheetText'; |
| 847 | } |
| 848 | this.#domModel.markUndoableState(!majorChange); |
| 849 | this.fireStyleSheetChanged(styleSheetId); |
| 850 | return null; |
| 851 | } |
| 852 | |
| 853 | async getStyleSheetText(styleSheetId: Protocol.DOM.StyleSheetId): Promise<string|null> { |
| 854 | const response = await this.agent.invoke_getStyleSheetText({styleSheetId}); |
no test coverage detected